diff --git a/bao1x-boot/blobs/ac-block-0x3dc000.bin b/bao1x-boot/blobs/ac-block-0x3dc000.bin index fca97d69c..73552f631 100644 Binary files a/bao1x-boot/blobs/ac-block-0x3dc000.bin and b/bao1x-boot/blobs/ac-block-0x3dc000.bin differ 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); 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]) + } } }