Topic: kexec working on brcm47xx (Asus WL500gP V2)!
I wanted to create the system allowing me to develop drivers and applications for my Asus WL500gP V2 without continuous reflashing.
The system was supposed to consist of a small kernel+system flashed into the AP, and able only to mount
the USB disk, and then to boot another kernel from that disk and mount the rootfs from the disk.
A few people have reported success, but their description was not very detailed
I have tried to utilize the patch mentioned in both above threads:
http://people.mandriva.com/~apatard/kexec_mips.patch, described in
however it didn't applied cleanly to the kernel 126.96.36.199, used in the newest trunk.
After some investigations, I have found, that one modification from the above patch is sufficient
to get the kexec working in Asus WL500gP V2:
In file /arch/mips/kernel/machine_kexec.c
@@ -52,7 +73,9 @@ machine_kexec(struct kimage *image) reboot_code_buffer = (unsigned long)page_address(image->control_code_page); - kexec_start_address = image->start; + kexec_start_address = + (unsigned long) phys_to_virt(image->start); + kexec_indirection_page = (unsigned long) phys_to_virt(image->head & PAGE_MASK);
I have compile the trunk with the above modification (of course I had also to select the kexec-tools
package in "make menuconfig" in "Utilities" section, and to enable the "Kexec system call" after
"make kernel_menuconfig" in "Kernel type" section).
In fact for tests I have compiled the ramdisk image, so I had also to compile the USB and ext2fs
support into the kernel and to unselect as much other options (e.g. wireless, netfilter and others) to keep
the size of kernel+ramdisk below 4MB.
Therefore I was able to test my kexec-enabled image without reflashing, just from CFE:
CFE> ifconfig eth0 -addr=172.17.1.6
CFE> boot -elf 172.17.1.1:openwrt-brcm47xx-vmlinux.elf
After booting of such kernel I was able to mount the USB disk:
#mkdir /tmp/d ; mount /dev/sda1 /tmp/d
and boot the kernel from it:
# kexec --command-line="root=/dev/sda1 rootfstype=ext2 noinitrd console=ttyS0,115200" -l vmlinux.elf # kexec -e
The kernel booted successfully, however it is not able yet to find the root file system on the USB disk.
Probably I need to compile the final image also with ramdisk, allowing the kernel to properly
initialize the USB storage.