Configuring kexec
I have a working kexeced system on a TP-Link TL-WR741ND. After making the USB mod, and additional experimenting, I ended up with a working kexeced system.
Prepare USB Bootable System
- Download sources:
svn checkout svn://svn.openwrt.org/openwrt/branches/backfire
- Change directory to bildroot, then update & install feeds:
cd backfire && ./scripts/feeds update && ./scripts/feeds install -a
- Create defconfig and enter MenuConfig:
make V=s defconfig && make menuconfig
- Select the following:
Target System→Atheros AR71xx/AR7240/AR913xTarget Profile→TP-LINK TL-WR741ND v1Target Images→ramdisk→Compression→lzmaTarget Images→tar.gz
Kernel modules→Filesystems→kmod-fs-ext2kmod-fs-ext3
Kernel modules→USB Support→kmod-usb-corekmod-usb-ohcikmod-usb-storage
Utilities→kexec tools→Configuration→(mips) Target name for kexec kernel
- Exit from menu and save configuration
make V=s
- Modify:
./build_dir/linux-ar71xx/linux-2.6.32.27/arch/mips/kernel/machine_kexec.c- Change Line 55 to:
kexec_start_address = (unsigned long) phys_to_virt(image→start);
./build_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/linux-2.6.32.27/arch/mips/kernel/machine_kexec.c- Change Line 55 to:
kexec_start_address = (unsigned long) phys_to_virt(image→start);
- For USB support:
./target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig- Add new line 176 (under
config AR71XX_MACH_TL_WR741ND):select AR71XX_DEV_USB
./target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c- Add Line 22 (under
includes):#include “dev-usb.h” - Add line 102 (under
static void __init tl_wr741nd_setup(void)):ar71xx_add_device_usb();
make kernel_menuconfig- Select the following:
Kernel type→Kexec system call
General setup→Support initial ramdisks compressed using LZMABuilt-in initramfs compression mode→LZMA
Device Drivers→SCSI device support→M SCSI device supportM SCSI disk supportProbe all LUNs on each SCSI device
Device Drivers→USB support→M Support for Host-side USBM OHCI HCD support→USB OHCI support for Atheros AR71xxM USB Mass Storage supportUSB announce new devices
Kernel hacking→Default kernel command string→rootfstype=ext2 noinitrd console=ttyS0,115200 board=TL-WR741ND
- Modify:
./package/base-files/files/etc/preinit- Below
. /etc/diag.sh, add line:rootfs=/dev/sda1
- Optionally you can modify:
./target/linux/generic-2.6/base-files/init- Change line 50 to:
mount $rootfs /mnt -o noatime- Blocks wear out faster if written to every time a file is accessed
make clean && make V=s
- Repeat Step 5
- Clean operation creates issues, however it's necessary for the USB patch to work
make V=s
- Partition external storage, then format first partition as ext2
- Extract contents of
./bin/ar71xx/openwrt-ar71xx-rootfs.tar.gzto root of file system
- Copy
./bin/ar71xx/openwrt-ar71xx-vmlinux-initramfs.elfto root of file system
(to be continued)