Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/aboot/aboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -4789,14 +4789,14 @@ void CmdUpdateSnapshot(const char *arg, void *data, unsigned sz)
if (command) {
command++;

if(!strncmp (command, "merge", AsciiStrLen ("merge"))) {
if(!strncmp (command, "merge", strlen ("merge"))) {
if (GetSnapshotMergeStatus () == MERGING) {
cmd_reboot_fastboot(Arg, Data, Size);
cmd_reboot_fastboot(arg, data, sz);
}
FastbootOkay ("");
fastboot_okay ("");
return;
}
else if (!strncmp (Command, "cancel", AsciiStrLen ("cancel"))) {
else if (!strncmp (command, "cancel", strlen ("cancel"))) {
if(!device.is_unlocked) {
fastboot_fail ("Snapshot Cancel is not allowed in Lock State");
return;
Expand Down
8 changes: 6 additions & 2 deletions app/aboot/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,17 @@ int _emmc_recovery_init(void)
static int read_misc(unsigned page_offset, void *buf, unsigned size)
{
const char *ptn_name = "misc";
uint32_t pagesize = get_page_size();
unsigned offset;

if (size == 0 || buf == NULL)
return -1;

offset = page_offset * pagesize;
#if VIRTUAL_AB_OTA
offset = page_offset;
#else
uint32_t pagesize = get_page_size();
offset = page_offset * pagesize;
#endif

if (target_is_emmc_boot())
{
Expand Down
1 change: 0 additions & 1 deletion app/aboot/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ OBJS += \

ifeq ($(ABOOT_STANDALONE), 1)
DEFINES += ABOOT_STANDALONE=1
OBJS := $(filter-out $(LOCAL_DIR)/recovery.o, $(OBJS))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the recovery code?

DEFINES := $(filter-out SSD_ENABLE TZ_SAVE_KERNEL_HASH TZ_TAMPER_FUSE, $(DEFINES))
endif

Expand Down
21 changes: 20 additions & 1 deletion lk2nd/device/menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <lk2nd/device/keys.h>
#include <lk2nd/util/minmax.h>
#include <lk2nd/version.h>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not add extra churn, please keep the empty line as-is

#include "../device.h"

// Defined in app/aboot/aboot.c
Expand Down Expand Up @@ -127,6 +126,13 @@ static void opt_recoery(void) { reboot_device(RECOVERY_MODE); }
static void opt_bootloader(void) { reboot_device(FASTBOOT_MODE); }
static void opt_edl(void) { reboot_device(EMERGENCY_DLOAD); }
static void opt_shutdown(void) { shutdown_device(); }
#if SLOTS_SUPPORTED
static void opt_switch_slot(void){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static void opt_switch_slot(void){
static void opt_switch_slot(void)
{

int current_active_slot = partition_find_active_slot();
partition_switch_slots(current_active_slot, !current_active_slot, true);
reboot_device(FASTBOOT_MODE);
}
#endif

static struct {
char *name;
Expand All @@ -137,6 +143,9 @@ static struct {
{ " Continue ", WHITE, opt_continue },
{ " Recovery ", ORANGE, opt_recoery },
{ "Bootloader", ORANGE, opt_bootloader },
#if SLOTS_SUPPORTED
{ "Switch Slot", RED, opt_switch_slot },
#endif
{ " EDL ", RED, opt_edl },
{ " Shutdown ", RED, opt_shutdown },
};
Expand All @@ -147,6 +156,11 @@ static struct {
y += incr; \
} while(0)

#define fbcon_printfn(color, y, incr, x...) \
do { \
fbcon_printf(color, y, x); \
} while(0)

Comment on lines +159 to +163
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just call fbcon_printf directly?

#define fbcon_puts_ln(color, y, incr, center, str) \
do { \
fbcon_puts(str, color, y, center); \
Expand Down Expand Up @@ -228,6 +242,11 @@ void display_fastboot_menu(void)
if (lk2nd_dev.bootloader)
fbcon_printf_ln(SILVER, y, incr, false, " Bootloader: %s", lk2nd_dev.bootloader);
#endif
#if SLOTS_SUPPORTED
int current_active_slot = partition_find_active_slot();
fbcon_printfn(SILVER, y, incr, false, " Active Slot: ");
fbcon_printf_ln(current_active_slot ? GREEN : RED, y, incr, false, " %s", current_active_slot ? "B" : "A");
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me why A/B should be color-coded, nor why B should be green/"good" and A should be red/"bad"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just looks cool, lol.

No color is good/bad for me it just looks cool as said but we can keep it silver if you like it more


fbcon_printf_ln(armv8 ? GREEN : YELLOW, y, incr, false, " ARM64: %s",
armv8 ? "available" : "unavailable");
Expand Down
8 changes: 8 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ ifeq ($(DYNAMIC_PARTITION_SUPPORT),1)
DEFINES += DYNAMIC_PARTITION_SUPPORT=1
endif

ifeq ($(SLOTS_SUPPORTED),1)
DEFINES += SLOTS_SUPPORTED=1
endif

ifeq ($(VIRTUAL_AB_OTA),1)
DEFINES += VIRTUAL_AB_OTA=1
endif

ifeq ($(TARGET_DTBO_NOT_SUPPORTED),1)
DEFINES += TARGET_DTBO_NOT_SUPPORTED=1
endif
Expand Down
10 changes: 7 additions & 3 deletions platform/msm_shared/include/ab_partition_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ int partition_fill_partition_meta(char has_slot_pname[][MAX_GET_VAR_NAME_SIZE],
char has_slot_reply[][MAX_RSP_SIZE],
int array_size); /* Fill partition slot info meta*/

static inline bool partition_multislot_is_supported(void)
{
return target_is_emmc_boot() && _partition_multislot_is_supported();
static inline bool partition_multislot_is_supported(void){
#if SLOTS_SUPPORTED
return true;
#else
return false;
#endif
}

Comment on lines -82 to +89
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand correctly that SLOTS_SUPPORTED "forces" slots on instead of relying on caf lk's code that detects the presence of blah_a and blah_b? In this case, if this is just an lk2nd extension, please rename it to something like LK2ND_FORCE_AB_SLOTS and keep existing behavior if it's not enabled. Do I understand correctly that you need it due to dynamic partitions?

(...) thinking of this more I'm not sure how to integrate this into the menu nicely....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to look into this again either the detection code was just plainly broken or didn't work for me it was some weeks ago I fixed the code.

Iirc it was badly ported over from edk2's aboot impl (probably taken from shift phone xbl)