arm linux内核编译与测试

 

 

$ sudo apt-get install build-essential ddd cpio libncurses5-dev libsdl-dev zlib1g-dev

$ wget http://www.codesourcery.com/sgpp/lite/arm/portal/package6490/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi.bin

$ chmod +x arm-2010q1-202-arm-none-linux-gnueabi.bin

$ ./arm-2010q1-202-arm-none-linux-gnueabi.bin

$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.tar.bz2

$ tar xjf linux-2.6.35.tar.bz2

$ cd linux-2.6.35/

$ make ARCH=arm versatile_defconfig

$ make ARCH=arm menuconfig

When the menu appears, I go into the “Kernel Features” section and enable EABI support; then I exit (saving the configuration) and compile:

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- all

$ cd ..

The result is a compressed kernel image in “./linux-2.6.35/arch/arm/boot/zImage”.

$ wget http://busybox.net/downloads/busybox-1.17.1.tar.bz2

$ tar xjf busybox-1.17.1.tar.bz2

$ cd busybox-1.17.1

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- defconfig

$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- install

$ cd ..

$ wget http://download.savannah.gnu.org/releases/qemu/qemu-0.12.5.tar.gz

$ tar xzf qemu-0.12.5.tar.gz

$ cd qemu-0.12.5

$ ./configure --enable-sdl --disable-kvm --enable-debug --target-list=arm-softmmu

$ ./make

$ cd ..

$ wget http://ftp.gnu.org/gnu/hello/hello-2.6.tar.gz

$ tar xzf hello-2.6.tar.gz

$ cd hello-2.6

$ ./configure --host=arm-none-linux-gnueabi

$ make

$ cd ..

$ cd busybox-1.17.1/_install

$ mkdir -p lib

$ cp /home/francesco/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib/ld-linux.so.3 lib/

$ cp /home/francesco/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib/libgcc_s.so.1 lib/

$ cp /home/francesco/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib/libm.so.6 lib/

$ cp /home/francesco/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib/libc.so.6 lib/

$ cp /home/francesco/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib/libdl.so.2 lib/

$ cp /home/francesco/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/usr/bin/gdbserver usr/bin/

$ cp ../../hello-2.6/src/hello usr/bin/

$ cd ../../

#!/bin/sh

mount -t proc none /proc

mount -t sysfs none /sys

/sbin/mdev -s

ifconfig lo up

ifconfig eth0 10.0.2.15 netmask 255.255.255.0

route add default gw 10.0.2.1

$ cd busybox-1.17.1/_install

$ mkdir -p proc sys dev etc etc/init.d

$ cp ../../rcS etc/init.d

$ chmod +x etc/init.d/rcS

$ find . | cpio -o --format=newc | gzip > ../../rootfs.img.gz

$ cd ../../

$ ./qemu-0.12.5/arm-softmmu/qemu-system-arm -M versatilepb -m 128M -kernel ./linux-2.6.35/arch/arm/boot/zImage -initrd ./rootfs.img.gz -append "root=/dev/ram rdinit=/sbin/init" -redir tcp:1234::1234

# gdbserver --multi 10.0.2.15:1234

$ ddd --debugger arm-none-linux-gnueabi-gdb

set solib-absolute-prefix nonexistantpath

set solib-search-path /home/francesco/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib/

file ./hello-2.6/src/hello

target extended-remote localhost:1234

set remote exec-file /usr/bin/hello

break main

run

 

 

参考自:

 http://balau82.wordpress.com/2010/08/17/debugging-arm-programs-inside-qemu/

 

 

 

你可能感兴趣的:(linux,内核,ARM)