본문 바로가기
System/Linux

QEMU & ARM & buybox 빌드하기

by bbolmin 2015. 2. 8.






QEMU 빌드



아래 사이트에서 최신버전 qemu를 다운로드 받는다.


http://wiki.qemu.org/Download




tar xvjf qemu-1.5.1.tar.bz2
cd qemu-1.5.1

As a preparation, I needed to update my Ubuntu 13.04 installation. It turned out that the following installations were needed:

sudo apt-get install zlib1g-dev
sudo apt-get install libglib2.0
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install libsdl-console
sudo apt-get install libsdl-console-dev

I could then configure QEMU, using the command

./configure --target-list=i386-softmmu,arm-softmmu,x86_64-softmmu --disable-vnc --enable-sdl

I could then build and install, using

make
sudo make install



Ref) https://theintobooks.wordpress.com/2012/10/30/installing-qemu/



arm만 사용할 것이라면 --target-list에 arm-softmmu만 넣어줘도 된다.


위의 블로그를 참고 해서 빌드하면 된다. 너무 잘 정리해봐서 쉽게 할 수 있었다 ~~ 


bbolmin@bbolmin-virtual-machine:~$ qemu-system-arm --version

QEMU emulator version 2.2.0, Copyright (c) 2003-2008 Fabrice Bellard

bbolmin@bbolmin-virtual-machine:~$ 








ARM 커널 빌드





apt-get install gcc-arm-linux-gnueabi



export ARCH=arm

export CROSS_COMPILE=arm-linux-gnueabi-



make vexpress_defconfig

make menuconfig ( 참고 - http://kyuhyuk.kr/m/post/355 )

make




qemu-system-arm -M versatilepb -m 128M -kernel ./zImage -serial stdio



Ref) 

https://balau82.wordpress.com/2012/03/31/compile-linux-kernel-3-2-for-arm-and-emulate-with-qemu/

http://kyuhyuk.kr/m/post/355




BusyBox 빌드


busybox 다운 http://www.busybox.net/downloads/ 


$ make defconfig

$ make menuconfig ( 참고 - http://kyuhyuk.kr/m/post/355 )


$ cd busybox-1.21.1/_install

$ 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



$ chmod +x etc/init.d/rcS

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

$ cd ..

$ gzip -c rootfs.img > rootfs.img.gz




qemu-system-arm -M versatilepb -m 128M -kernel ./zImage -initrd ./rootfs.img.gz -append "root=/dev/ram rdinit=/sbin/init" -serial stdio







Linaro ARM ubuntu 파일시스템 적용


우선 http://releases.linaro.org/에서 아래 파일을 다운 받는다.

http://releases.linaro.org/15.01/ubuntu/utopic-images/developer/linaro-utopic-developer-20150115-694.tar.gz



qemu-img create -f raw rootfs.img 3G

mkfs.ext3 rootfs.img

mkdir mnt

mount -o loop rootfs.img mnt

rsync -a binary/boot/filesystem.dir/ mnt/

umount mnt


qemu-system-arm -M vexpress-a9 -m 512 -kernel test -sd rootfs.img -append "root=/dev/mmcblk0 rw physmap.enabled=0 console=ttyAMA0" -net nic -net user,hostfwd=tcp::9999-:22 -nographic


9999포트로 접근시 22번 포트로 리다이렉션


아... 지금 내가 컴파일 한 이미지로 실행이 안된다 


Ref) http://daehee87.tistory.com/282






'System > Linux' 카테고리의 다른 글

[ARM bof] - system함수 RTL  (2) 2015.02.25
[ARM bof] - execve 쉘코드  (0) 2015.02.18
페도라 오버플로우 공략법 글  (0) 2013.12.15
linux x64 쉘코드  (0) 2013.12.15
Linux system call Table 참고  (0) 2013.12.15