twlkh
, qemu
, buildroot
Building Embedded Linux Full Tutorial for ARM
BPFTEST_VERSION = 1.0
BPFTEST_SITE = $(TOPDIR)/../bpftest
BPFTEST_SOURCE = "apps modules"
BPFTEST_SITE_METHOD = local
BPFTEST_LICENSE = GPLv3+
BPFTEST_LICENSE_FILES = COPYING
BPFTEST_MODULE_SUBDIRS = modules
BPF_MODULE_MAKE_OPTS = KVERSION=$(LINUX_VERSION_PROBED) KERNEL_DIR=$(LINUX_DIR)
define BPFTEST_EXTRACT_CMDS
cp -a $(TOPDIR)/$(BPFTEST_SOURCE) $(@D)
endef
define BPFTEST_BUILD_CMDS
$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)/apps all
endef
define BPFTEST_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/apps/hello $(TARGET_DIR)/usr/bin
endef
$(eval $(kernel-module))
$(eval $(generic-package))
git clone https://git.busybox.net/buildroot
cd buildroot
make qemu_arm_vexpress_defconfig
#這會跑很久,要下載新的 cross-toolchain, kernel, ... 並且把他全部 build起來
make
#接下來就可用 qemu跑了歐,簡單吧
# Ref:https://github.com/buildroot/buildroot/tree/master/board/qemu/arm-vexpress
qemu-system-arm -M vexpress-a9 -smp 1 -m 256 -kernel output/images/zImage -dtb output/images/vexpress-v2p-ca9.dtb -drive file=output/images/rootfs.ext2,if=sd,format=raw -append "console=ttyAMA0,115200 root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user
參考資料:
Build Your ARM Image for QEMU
FicHugh blog - buildRoot study - 建立自己的作業系統
$ configure --prefix=/path/to/install --target-list=arm-softmmu
$ make
$ make install
https://wiki.linaro.org/PeterMaydell/QemuVersatileExpress
-M vexpress-a15
-kernel /path/to/zImage
-dtb /path/to/dtb
-drive ...
-serial stdio
-net nic,vlan=1 -net user,vlan=1,hostfwd=udp:127.0.0.1:6669-:69
-append "root=/dev/mmcblk0 console=ttyAMA0,115200n8"
-s
or -gdb tcp::1234
/ -S
-d op -D /path/to/qemu.log
example command
$ /path/to/install/bin/qemu-system-arm \
-M vexpress-a15 \
-kernel buildroot/output/images/zImage \
-dtb buildroot/output/images/vexpress-v2p-ca15_a7.dtb \
-drive file=buildroot/output/images/rootfs.ext2,if=sd \
-smp 2 \
-s \
-serial stdio \
-append "root=/dev/mmcblk0 console=ttyAMA0,115200n8" \
-net nic,vlan=1 -net user,vlan=1,hostfwd=udp:127.0.0.1:6669-:69