book@ubuntu:~$ tar jxf busybox-1.20.0.tar.bz2
book@ubuntu:~$ cd busybox-1.20.0/
book@ubuntu:~/busybox-1.20.0$ make menuconfig
CONFIG_CROSS_COMPILER_PREFIX:
Location:
-> Busybox Settings
-> Build Options
book@ubuntu:~/busybox-1.20.0$ make
book@ubuntu:~/busybox-1.20.0$ mkdir /work/s3c2440/nfs/fs/fs_mini_mdev -p
book@ubuntu:~/busybox-1.20.0$ make install CONFIG_PREFIX=/work/s3c2440/nfs/fs/fs_mini_mdev
book@ubuntu:~/busybox-1.20.0$ cd /work/s3c2440/nfs/fs/fs_mini_mdev
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ ls
bin linuxrc sbin usr
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ mkdir lib
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ mkdir usr/lib -p
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ cp /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/*so* /work/s3c2440/nfs/fs/fs_mini_mdev/lib -d
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ cp /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/*so* /work/s3c2440/nfs/fs/fs_mini_mdev/usr/lib -d
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ mkdir etc
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ cd etc
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc$ vi inittab
inittab:
# /etc/inittab
::sysinit:/etc/init.d/rcS
console::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/mount -a -r
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc$ mkdir init.d
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc$ cd init.d
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc/init.d$ vi rcS
rcS:
#!/bin/sh
#ifconfig eth0 172.16.122.84
mount -a
mkdir /dev/pts
mount -t devpts devpts /dev/pts
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc/init.d$ chmod +x rcS
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc/init.d$ cd ..
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc$ vi fstab
fstab:
# device mount-point type options dump fsck order
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev tmpfs defaults 0 0
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/etc$ cd ..
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ mkdir dev
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ cd dev
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/dev$ sudo mknod console c 5 1
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/dev$ sudo mknod null c 1 3
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/dev$ ls
console null
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev/dev$ cd ..
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ mkdir mnt proc tmp sys root
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ ls
bin dev etc lib linuxrc mnt proc root sbin sys tmp usr
book@ubuntu:/work/s3c2440/nfs/fs/fs_mini_mdev$ cd ..
book@ubuntu:/work/s3c2440/nfs/fs$ sudo apt-get install mtd-utils
book@ubuntu:/work/s3c2440/nfs/fs$ mkfs.jffs2 -n -s 2048 -e 128KiB -d fs_mini_mdev -o fs_mini_mdev.jffs2
book@ubuntu:/work/s3c2440/nfs/fs$ ls
fs_mini_mdev fs_mini_mdev.jffs2
SMDK2440 # nfs 30000000 $serverip:/work/s3c2440/nfs/fs/fs_mini_mdev.jffs2
SMDK2440 # nand erase.part rootfs
SMDK2440 # nand write.jffs2 30000000 260000 $filesize
SMDK2440 # set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2
SMDK2440 # set bootcmd "nfs 30000000 $serverip:/work/s3c2440/nfs/kernel/uImage_3.5;bootm 30000000"
SMDK2440 # save
SMDK2440 # reset
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
在Source Insight中查找Attempted to kill init!
反向查找调用函数:
do_exit
exit_notify
forget_original_parent
find_new_reaper
panic("Attempted to kill init! exitcode=0x%08x\n",
father->signal->group_exit_code ?:
father->exit_code);
根据上面提示信息 exitcode=0x00000004
内核启动出错调用do_exit(SIGILL)
SIGILL为非法指令
产生非法指令的原因,我们来查看交叉编译工具
book@ubuntu:/work/s3c2440/nfs/fs$ arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/julian/lite-respin/linux/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2008q3-72' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
交叉编译工具用的是eabi接口编译内核的
book@ubuntu:/work/s3c2440/nfs/fs$ cd ~/linux-3.5
book@ubuntu:~/linux-3.5$ make menuconfig
CONFIG_AEABI:
Location:
-> Kernel Features
book@ubuntu:~/linux-3.5$ make uImage