顯示具有 QEMU 標籤的文章。 顯示所有文章
顯示具有 QEMU 標籤的文章。 顯示所有文章

2017年7月12日 星期三

[docker] Build up Linux kernel research environment by using docker/qemu

Download

    $ git clone https://github.com/tinyclub/cloud-lab.git
    $ cd cloud-lab && tools/docker/choose linux-lab

Install

    $ tools/docker/pull        # Pull from docker hub
    or
    $ tools/docker/build       # Build from source

Run

    $ tools/docker/run        # Start to run
[Happy@localhost cloud-lab]$ sudo tools/docker/rm
[sudo] password for Happy: 
LOG: Current Lab is linux-lab
LOG: Running ' docker rm -f linux-lab-27586 '
linux-lab-27586
[Happy@localhost cloud-lab]$ sudo tools/docker/run
LOG: Current Lab is linux-lab
LOG: Wait for lab launching...
LOG: Container ID: 89fadc31d6ae Container Name: linux-lab-28086
LOG: User: ubuntu Password: e9nU1doA7nhtsUA VNC Password: 1tC2ya4RCMRrXXA
LOG: Current Lab is linux-lab
LOG: No chromium-browser found, use firefox instead.
Please login http://localhost:6080/vnc.html?token=2dcb0b51f6f2a6a6800bc33a93dfc210&password=1tC2ya4RCMRrXXA&autoconnect=0&encrypt=0

Connect to Docker by ssh

ssh 172.17.0.3 -l ubuntu

Connect to simulation board

    $ cd /labs/linux-lab
    $ make boot

Get Source Code

    $ make source -j3             # Download linux-stable, qemu 和 buildroot

Reference:

2015年7月25日 星期六

[Embedded][Emulator] qemu for mini2440


1. Download package
git clone git://repo.or.cz/qemu/mini2440.git  qemu

2. configure
./configure --prefix=/tmp --target-list=arm-softmmu
Solve : undefined reference to `clock_gettime’
Edit vim arm-softmmu/Makefile
LIBS+=-lm --> LIBS+=-lm -lrt

3. Install
make -j8

Reference:

2015年1月16日 星期五

[QEMU][Raspberry Pi] Building With QEMU User Mode Emulation

In user mode, only the ARM CPU is emulated and your real file system is used as storage.
1.
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
cat /proc/sys/fs/binfmt_misc/status
If it says enabled, you’re good to go.


2. create a directory to hold your chroot environment:
export LFS=/lfs
mkdir $LFS
cd $LFS
wget http://circu.it/pilfs/ch5-tools-20141203.tar.xz
tar xvf ch5-tools-20141203.tar.xz


3. Install qemu to get qemu-arm binary
apt-get install qemu binfmt-support qemu-user-static


Copy qemu-arm-static to Emulation system.

mkdir -pv $LFS/usr/bin
cp -v /usr/bin/qemu-arm-static $LFS/usr/bin

4. Make a wrapper binary that will call qemu-arm-static with the correct arguments to emulate the same CPU family and kernel version as that of a Raspberry Pi.

wget http://www.intestinate.com/pilfs/patches/qemu-arm-wrapper.c
gcc -static qemu-arm-wrapper.c -s -o qemu-arm-wrapper
cp -v qemu-arm-wrapper $LFS/usr/bin

5. Register a binfmt_misc handler for our ARM binaries

echo ":arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-wrapper:" > /proc/sys/fs/binfmt_misc/register

6. trying to chroot into your /lfs directory:
chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h

7. See a prompt that reads “I have no name!”, everything is working correctly.

Reference:

1. QEMU User Emulation
2. Linux From Scratch on the Raspberry Pi