====================================================================== BUILD 시스템 build_root 설정 export XTARGET=arm-linux or export XTARGET=arm-unknown-linux-gnueabi export XBUILDSRC=path/to/src/root ($HOME/workspace/x-tool/src) export XBUILDROOT=path/to/build-install/root ($HOME/workspace/x-tool/usr) ========================================================= // gdb download // BUILD GDB (host executable) $ cd $XTARGETSRC $ w get http://ftp.gnu.org/gnu/gdb/gdb-7.2.tar.gz $ tar xzvf gdb-7.2.tar.gz $ cd gdb-7.2 $ mkdir buildgdb & mkdir buildgdbserver $ cd buildgdb $ ../configure --target=$XTARGET --prefix=$XTARGETBIN $ make && make install // BUILD GDBSERVER (target executable) $ cd ../buildgdbserver $ CC=arm-unknown-linux-gnueabi-gcc ../gdb/gdbserver/configure --host=arm-unknown-linux-gnueabi --prefix=$XTARGETBIN $ make && make install (make에서 libinproctrace.so 관련 에러 참조) // Debug Sample (GNU Hello) $ w get http://ftp.gnu.org/gnu/hello/hello-2.6.tar.gz $ tar xzvf hello-2.6.tar.gz $ cd hello-2.6 $ configure --host=arm-unknown-linux-gnueabi $ make gdbserver, hello는 연관된 so 파일들과 함께 target의 root file system 생성에 포함 (/usr/bin/, /lib) $ readelf -a gdbserver | grep lib gdb는 host에서 tcp connection을 이용해서 디버깅한다. // tcp connection을 이용해 디버깅하기 위해 target system의 network을 동작 시켜야 한다 (target의 /etc/init.d/rcS 파일을 아래와 같이 수정한다) -------------------------------------------------------------------- #!/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 -------------------------------------------------------------------- // debugging $ qemu-system-arm -M versatilepb -m 128M -kernel linux-2.6.35.6/arch/arm/boot/zImage -initrd rootfs.img.gz -append "root=/dev/ram rdinit=/sbin/init" -redir tcp:1234::1234 // on target system library path가 잡혀있지 않으므로 환경변수를 먼저설정한다 $ export LD_LIBRARY_PATH=/lib $ gdbserver --multi 10.0.2.15:1234 // on host system $ ddd --debugger arm-unknown-linux-gnueabi-gdb : set solib-absolute-prefix nonexistantpath : set solib-search-path $XBUILDROOT/lib/ : file hello-2.6/src/hello : target extended-remote localhost:1234 : set remote exec-file /usr/bin/hello : break main : run |
|
'qemu'에 해당되는 글 3건
- 2010/09/27 scott [QEMU] #3. qemu + gdb 디버깅하기
- 2010/09/27 scott [QEMU] #2. qemu + rootfs(Busybox SHELL)
- 2010/09/27 scott [QEMU] #1. qemu용 ARM eabi linux 커널 Build
받은 트랙백이 없고,
댓글이 없습니다.
댓글+트랙백 RSS :: http://www.semanogic.com/blog/tc/scott/rss/response/68
댓글+트랙백 ATOM :: http://www.semanogic.com/blog/tc/scott/atom/response/68
// busybox source $ w get http://www.busybox.net/downloads/busybox-1.17.2.tar.bz2 $ tar xvjf busybox-1.17.2.tar.bz2 $ cd busybox-1.17.2 $ make menuconfig ==> build option의 static executable, build prefix를 eabi toolchain의 prefix로 맞춰준다 $ make & make install make install에 의해 _install 폴더에 설치된 busybox를 root file system으로 변환 $ cd _install /sbin/init을 이용하여 초기화하기 $ mkdir proc sys dev etc etc/init.d $ vi etc/init.d/rcS --------------------------------------------- #!/bin/sh mount -t proc none /proc mount -t sysfs none /sys /sbin/mdev -s --------------------------------------------- rootfs 생성 $ find . | cpio -o --format=newc > ../rootfs.img $ cd .. $ gzip -c rootfs.img > rootfs.img.gz $ cd .. $ qemu-system-arm -M versatilepb -m 128M -kernel linux-2.6.35.6/arch/arm/boot/zImage -initrd busybox-1.17.2/rootfs.img.gz -append "root=/dev/ram rdinit=/bin/sh" or $ qemu-system-arm -M versatilepb -m 128M -kernel linux-2.6.35.6/arch/arm/boot/zImage -initrd busybox-1.17.2/rootfs.img.gz -append "root=/dev/ram rdinit=/sbin/init" |
받은 트랙백이 없고,
댓글이 없습니다.
댓글+트랙백 RSS :: http://www.semanogic.com/blog/tc/scott/rss/response/67
댓글+트랙백 ATOM :: http://www.semanogic.com/blog/tc/scott/atom/response/67
- QEMU 설치 ubuntu 기본 패키지로 설치되는 qemu로 실행에 문제가 있어 직접 소스코드를 컴파일 http://wiki.qemu.org/Download $ ./configure $ make & make install - Kernel Compile kernel.org에서 최신 vanilla 커널을 구한다. $ w get ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.6.tar.gz $ tar xzvf linux-2.6.35.6.tar.gz // configure $ make ARCH=arm versatile_defconfig $ make ARCH=arm menuconfig ==> menuconfig에서 module support를 삭제하고 EABI support를 enable 시킨다 // build (앞선 post에서 작성한 GNU/LINUX toolchain을 사용한다) $ make ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- all // qemu에 빌드된 zImage 올리기 $ qemu-system-arm -M versatilepb -m 128M -kernel linux-2.6.35.6/arch/arm/boot/zImage ==> root file system이 없기 때문에 에러가 발생함 // 간단한 root file system 만들기 $ vi simple_rootfs.c ----------------------------------------------- #include <stdio.h> void main() { printf("Welcome to QEMU!\n"); while(1); } ----------------------------------------------- $ arm-unknown-linux-gnueabi-gcc -static simple_rootfs.c -o simple_rootfs $ echo simple_rootfs | cpio -o --format=newc > rootfs $ qemu-system-arm -M versatilepb -m 128M -kernel linux-2.6.35.6/arch/arm/boot/zImage -initrd rootfs -append "root=/dev/ram rdinit=/simple_rootfs" ==> 커널 booting 후, root file system을 mount하고 simple_rootfs를 실행하여 "Welcome to QEMU"를 찍고 멈춰있게 된다 |
받은 트랙백이 없고,
댓글이 없습니다.