Skip to content

Conversation

@J0SH1X
Copy link
Contributor

@J0SH1X J0SH1X commented Mar 5, 2025

Im pretty bored theese days and wanted to test A/B slots on my lumia 950XL

The phone can now use slotted partitions with vAB and dynamic partitions,

LK1ST can now display the current active slot and also switch the slot

#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

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)
{

Comment on lines +159 to +163
#define fbcon_printfn(color, y, incr, x...) \
do { \
fbcon_printf(color, y, x); \
} while(0)

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?

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

Comment on lines -82 to +89
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
}

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)


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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants