Table of Contents
A short success story with kexec.
I have a working kexeced system on a TP-Link TL-WR741ND. After making the usb mod, i've started from this two topics: https://forum.openwrt.org/viewtopic.php?id=23901 https://forum.openwrt.org/viewtopic.php?id=24124 And after some more experimentig, i ended up with a working kexeced system.
Preparation of the usb bootable system - step by step
- Download the sources. I downloaded a full fresh copy of the build system with this command:
svn checkout svn://svn.openwrt.org/openwrt/branches/backfire - Change directory to bildroot:
cd backfire - Update the feeds:
./scripts/feeds update - Install the feeds:
./scripts/feeds install -a make V=99 defconfig- Execute
make menuconfig. In my case i selected the followings:
Target System → Atheros AR71xx/AR7240/AR913x
Target Profile → TP-LINK TL-WR741ND v1
Target Images → * ramdisk → Compression → lzma
Target Images → * tar.gz
Kernel modules → Filesystems → * kmod-fs-ext2and* kmod-fs-ext3
Kernel modules → USB Support → * kmod-usb-coreand* kmod-usb-ohciand* kmod-usb-storage
Utilities → * kexec tools → Configuration → (mips) Target name for kexec kernel
Exit from menu and save configuration. make V=99
if it's not successful, then solve the problem somehow- I modified the files: "
./build_dir/linux-ar71xx/linux-2.6.32.27/arch/mips/kernel/machine_kexec.c" and "./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"
In the 55th line i changed from:
kexec_start_address = image→start;
to:
kexec_start_address = (unsigned long) phys_to_virt(image→start);
in both files. - For the USB support, i modified two files:
in./target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
at theconfig AR71XX_MACH_TL_WR741ND
section i inserted that line:select AR71XX_DEV_USB
below the line:select AR71XX_DEV_LEDS_GPIO
it was the 176th line.
and in./target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c
at the includes, i inserted that line:#include "dev-usb.h"#include "dev-leds-gpio.h"
below the line:
it was the 22nd line.
And in thestatic void __init tl_wr741nd_setup(void)
function i inserted:ar71xx_add_device_usb();
below the line:u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
it was the 102nd line
(the line numbers are the insertion points) - Run "
make kernel_menuconfig" and select:
Kernel type → * Kexec system call
General setup → * Support initial ramdisks compressed using LZMAandBuilt-in initramfs compression mode –> LZMA
Device Drivers → SCSI device support → M SCSI device supportandM SCSI disk supportand* Probe all LUNs on each SCSI device
Device Drivers → USB support → M Support for Host-side USBandM OHCI HCD support → * USB OHCI support for Atheros AR71xxandM USB Mass Storage supportand optionally if you want to see messages in dmesg output, when connecting or disconnecting usb devices:* USB 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
add the line:
rootfs=/dev/sda1
right after line
. /etc/diag.sh
Optionally you can modify./target/linux/generic-2.6/base-files/init
Line 50 from:mount $rootfs /mnt
to:mount $rootfs /mnt -o noatime
to make sure, that the access time of the read files is not stored on the USB drive. It may be important if you consider to use Flash based storage, because blocks wear out earlier if we write every time, when a file is accessed. make cleanmake V=99- Repeat step 8, because the clean made some trouble, but the clean is necessary for the USB patch to work (at least it doesn't work for me without clean).
make V=99- partition a usb flash or disk and format the 1st partition to ext2
- extract the content of
./bin/ar71xx/openwrt-ar71xx-rootfs.tar.gzto the root of the newly created file system - copy
./bin/ar71xx/openwrt-ar71xx-vmlinux-initramfs.elfto the same place
(to be continued)
doc/howto/kexec.txt · Last modified: 2012/02/09 17:48 by mateakos