I'm trying to boot a compressed kernel (vmlinuz) with a custom bootloader on a switch containing a MIPS 24KEc processor. I didn't write this bootloader, it is present in NOR flash on the product and the source code was provided by the vendor in their GPL archive.
The bootloader reads a header from a fixed location in flash containing:
- Header magic (SPIM)
- Kernel load address
- Length of data to load
- Kernel entry address
It then copies num_bytes following the header to the kernel load address and jumps to the entry address specified. The boot command line and initrd are compiled into the kernel image (via CONFIG_CMDLINE and CONFIG_INITRAMFS_SOURCE).
Uncompressed kernel images (vmlinux) boot normally. When I try to boot a compressed kernel, I do not have any output from the decompressor or kernel.
I noticed that the Linux kernel saves the argument registers before clearing BSS and jumping to the decompressor (from arch/mips/boot/compressed/head.S):
start:
/* Save boot rom start args */
move s0, a0
move s1, a1
move s2, a2
move s3, a3
I am new to MIPS assembly, but I know that the above move statements are saving argument registers to saved registers. The saved registers are restored after the kernel is decompressed but before jumping to the kernel entry point:
move a0, s0
move a1, s1
move a2, s2
move a3, s3
PTR_LI k0, KERNEL_ENTRY
I looked at the u-boot source code and I'm wondering if this call in boot_jump_linux corresponds to the "boot rom start args" mentioned above:
kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env,
linux_extra);
I could not find any kernel documentation explaining what arguments the kernel is expecting the boot rom to pass to it in registers a0, a1, a2, and a3.
fw_arg0..3and then platform code accesses those, e.g.argc = fw_arg0;