Minor fix to get entrypoint in the right place

This commit is contained in:
Zhang Junyang 2023-10-22 20:17:14 +08:00 committed by Tate, Hongliang Tian
parent 8910af1294
commit 922fbd0c91
2 changed files with 8 additions and 5 deletions

View File

@ -15,8 +15,6 @@
// are filled by the loader and will be read by Jinux.
.code16
sentinel: .byte 0xff, 0xff
.org 0x01f1
hdr:
SETUP_SECTS = 4
@ -56,8 +54,8 @@ hardware_subarch_data: .quad 0
payload_offset: .long 0xabababab # at 0x248/4, to be filled by the runner
payload_length: .long 0xabababab # at 0x24c/4, to be filled by the runner
setup_data: .quad 0
pref_address: .quad 0x8000000 # 128MiB
init_size: .long 0x4000000 # 64MiB
pref_address: .quad 0
init_size: .long 0xabababab # at 0x260/4, to be filled by the runner
handover_offset: .long 0
kernel_info_offset: .long 0
@ -66,6 +64,6 @@ kernel_info_offset: .long 0
// 32-bit setup code starts here.
.code32
start_of_setup32:
.org 0x200 * SETUP_SECTS
.org 0x200 * (SETUP_SECTS + 1)
.extern _rust_setup_entry
jmp _rust_setup_entry

View File

@ -199,6 +199,11 @@ fn make_zimage(path: &Path, kernel_path: &Path, header_path: &Path) -> std::io::
0x24C, /* payload_length */
&(kernel_len as u32).to_le_bytes(),
);
fill_header_field(
&mut header,
0x260, /* init_size */
&((kernel_len + header_len) as u32).to_le_bytes(),
);
let mut kernel_image = File::create(path)?;
kernel_image.write_all(&header)?;