Skip to content

Commit

Permalink
[board] load Image and sunxi.dtb files, instead of zImage file
Browse files Browse the repository at this point in the history
Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
  • Loading branch information
luojia65 committed Jan 22, 2025
1 parent 5c9b07b commit d061ea7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions board/100ask-d1-h-rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use syterkit::{clock_dump, entry, print, println, show_banner, Clocks, Periphera
enum Base<'a> {
/// Get/set bootargs for kernel.
Bootargs,
/// Rescan TF Card and reload DTB, Kernel zImage.
/// Rescan TF Card and reload DTB, Kernel Image.
Reload,
/// Print out env config.
Print,
Expand Down Expand Up @@ -100,13 +100,13 @@ fn main(p: Peripherals, c: Clocks) {

/// Executes the loaded payload
fn run_payload() -> ! {
const ZIMAGE_ADDRESS: usize = 0x4180_0000; // Load address of Linux zImage
const IMAGE_ADDRESS: usize = 0x4180_0000; // Load address of Linux Image
const DTB_ADDRESS: usize = 0x4100_8000; // Address of the device tree blob
const HART_ID: usize = 0; // Hartid of the current core

type KernelEntry = unsafe extern "C" fn(hart_id: usize, dtb_addr: usize);

let kernel_entry: KernelEntry = unsafe { core::mem::transmute(ZIMAGE_ADDRESS) };
let kernel_entry: KernelEntry = unsafe { core::mem::transmute(IMAGE_ADDRESS) };
unsafe {
kernel_entry(HART_ID, DTB_ADDRESS);
}
Expand Down Expand Up @@ -143,10 +143,10 @@ fn load_from_sdcard<S: AsRef<RegisterBlock>, P>(smhc: &mut Smhc<S, P>) -> Result
let volume0 = volume_res.unwrap();
let root_dir = volume_mgr.open_root_dir(volume0).unwrap();

// Load `snuxi.dtb` and `zImage`
// Load `sunxi.dtb` and `Image`
for (filename, addr, size) in [
("SUNXI.DTB", 0x4100_8000, 64 * 1024),
("ZIMAGE", 0x4180_0000, 512 * 1024 * 1024),
("IMAGE", 0x4180_0000, 512 * 1024 * 1024),
] {
match unsafe { load_file_into_memory(&mut volume_mgr, root_dir, filename, addr, size) } {
Ok(bytes) => {
Expand Down
2 changes: 1 addition & 1 deletion rust/src/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn set_logger_stdout() {
if self.enabled(record.metadata()) {
let mut lock = STDOUT.lock();
if let Some(stdout) = &mut *lock {
writeln!(stdout.inner, "{} - {}", record.level(), record.args()).ok();
write!(stdout.inner, "{} - {}\r\n", record.level(), record.args()).ok();
}
drop(lock);
}
Expand Down

0 comments on commit d061ea7

Please sign in to comment.