Merge pull request #708 from betrusted-io/minor-fixes

Minor fixes
This commit is contained in:
bunnie 2025-10-29 00:56:33 +08:00 committed by GitHub
commit 52b229a39c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 0 deletions

View file

@ -45,6 +45,7 @@ print-ifr = []
test-boot0-keys = []
alt-boot1 = []
force-dabao = []
verilator-only = []
default = []

View file

@ -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::<bao1x_api::BoardTypeCoding>().expect("owc coding error")
!= bao1x_api::BoardTypeCoding::Dabao
{
one_way.inc_coded::<bao1x_api::BoardTypeCoding>().expect("increment error");
}
board_type = one_way.get_decoded::<bao1x_api::BoardTypeCoding>().expect("owc coding error");
crate::println!("Re-configured board type: {:?}", board_type);
}
}
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);

View file

@ -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])
}
}
}