Prerequisite: the aarch64 cross-compile chain which can download from Linaro.
1. Get the qemu source code
git clone git://git.qemu-project.org/qemu.git
2. Compile the qemu source code
cd qemu/
./configure --target-list=aarch64-softmmu
make
Then will get the binary 'qemu-system-aarch64' in the 'qemu/aarch64-softmmu/'
3. Compile the kernel
git clone http://rnd-github.xxxx.com/kernel/xxx.git
cd xxx/
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image
Then will get the kernel image 'Image' in the 'hulk/arch/arm64/boot/'.
4. Use the busybox
1) Download the source code
http://busybox.net/downloads/busybox-1.22.1.tar.bz2
2)Decompression
tar jxvf busybox-1.22.1.tar.bz2
3)Buid code
cd busybox-1.22.1/
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- install
Build BusyBox as a static binary (found in 'Busybox Settings --> Build Options')
cd _install/
mkdir proc sys dev etc etc/init.d
cd ..
create a new _install/etc/init.d/rcS with the following content
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s
chmod +x _install/etc/init.d/rcS
cd _install
find . | cpio -o --format=newc > ../rootfs.img
cd ..
gzip -c rootfs.img > rootfs.img.gz
2) Run QEMU with the busybox
cd qemu/
./aarch64-softmmu/qemu-system-aarch64 \
-machine virt -cpu cortex-a57 \
-kernel <kernel-dir>/arch/arm