From 395791b70bfe9e49063472ef09c2777f88485a99 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 28 Oct 2025 23:54:20 +0800 Subject: [PATCH 1/3] make volume label different for alt-boot mode this helps differentiate the modes to end users --- bao1x-boot/boot1/src/platform/bao1x/usb/handlers.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bao1x-boot/boot1/src/platform/bao1x/usb/handlers.rs b/bao1x-boot/boot1/src/platform/bao1x/usb/handlers.rs index 6b8da719c..75ad9f9f0 100644 --- a/bao1x-boot/boot1/src/platform/bao1x/usb/handlers.rs +++ b/bao1x-boot/boot1/src/platform/bao1x/usb/handlers.rs @@ -44,6 +44,12 @@ fn fill_sparse_data(dest: &mut [u8], offset: usize) { let copy_len = (dest.len().saturating_sub(write_start_in_dest)).min(block.len()); dest[write_start_in_dest..write_start_in_dest + copy_len].copy_from_slice(&block[..copy_len]); + #[cfg(feature = "alt-boot1")] + // patch the volume name so we can tell alt-boot apart + if addr == 0x410000 { + // patch ALT over BAO. Assumes that the block is aligned. + dest[write_start_in_dest..write_start_in_dest + 3].copy_from_slice(&[0x41, 0x4c, 0x54]) + } } } From d9cc76541957a3bc3ef4ac01c70a5cbadf1f087f Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 29 Oct 2025 00:50:24 +0800 Subject: [PATCH 2/3] add a feature to force board type this is useful in the limited case that the board type is incorrect in alt-boot mode. saves a step having to type in a command to fix it. --- bao1x-boot/boot1/Cargo.toml | 1 + bao1x-boot/boot1/src/main.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/bao1x-boot/boot1/Cargo.toml b/bao1x-boot/boot1/Cargo.toml index 4395d11ee..546dcde29 100644 --- a/bao1x-boot/boot1/Cargo.toml +++ b/bao1x-boot/boot1/Cargo.toml @@ -45,6 +45,7 @@ print-ifr = [] test-boot0-keys = [] alt-boot1 = [] +force-dabao = [] verilator-only = [] default = [] diff --git a/bao1x-boot/boot1/src/main.rs b/bao1x-boot/boot1/src/main.rs index 119a49c46..e46a7c31e 100644 --- a/bao1x-boot/boot1/src/main.rs +++ b/bao1x-boot/boot1/src/main.rs @@ -82,6 +82,16 @@ pub unsafe extern "C" fn rust_entry() -> ! { crate::println!("Configured board type: {:?}", board_type); if board_type == BoardTypeCoding::Baosec { IS_BAOSEC.store(true, Ordering::SeqCst); + #[cfg(all(feature = "force-dabao", feature = "alt-boot1"))] + { + while one_way.get_decoded::().expect("owc coding error") + != bao1x_api::BoardTypeCoding::Dabao + { + one_way.inc_coded::().expect("increment error"); + } + board_type = one_way.get_decoded::().expect("owc coding error"); + crate::println!("Re-configured board type: {:?}", board_type); + } } let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32); From cebc87d29ad447ee2a5a989e40086b2e204c9882 Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 29 Oct 2025 00:51:09 +0800 Subject: [PATCH 3/3] Revert "make acl correct by default for the data region" This reverts commit 643946a82af2d573498ad0ad8d77b950e58560a8. --- bao1x-boot/blobs/ac-block-0x3dc000.bin | Bin 32 -> 32 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bao1x-boot/blobs/ac-block-0x3dc000.bin b/bao1x-boot/blobs/ac-block-0x3dc000.bin index fca97d69cc186f053ff16e037efe2c56ae7868e9..73552f63173b9cb58669d5c51533ccee7e0b1ace 100644 GIT binary patch literal 32 RcmZQ#_`rY+n1Fm_3;;UN1iJtL literal 32 OcmZQ#_`tw~2Lk|kKnIZk