1. 配置工作環境
sudo apt install gcc build-essential bison flex gettext tcl sharutils libncurses-dev zlib1g-dev exuberant-ctags g++ texinfo patch vim libtool bc git
安裝qemu工具:
sudo apt install qemu-system-arm
2. 下載buildroot
到buildroot.org官網下載相應的壓縮包:buildroot-2017.05.2.tar.gz。
然后解壓tar -zxvf buildroot-2017.05.2.tar.gz。
或者通過gi他下載指定branch。
git clone https://github.com/arnoldlu/buildroot.git -b arnoldlu_2017_05_2
然后新建分支,上傳git push origin your_branch。
3. 配置編譯buildroot
make qemu_arm_vexpress_defconfig--------選擇虛擬qemu配置
make-------------------------------------------------下載並且編譯包
結果在output/images下生成zImage、vexpress-v2p-ca9.dtb、rootfs.ext2三個文件,分別是內核、DeviceTree文件和文件系統。
qemu-system-arm -M vexpress-a9 -smp 4 -m 1024M -kernel output/images/zImage -append "root=/dev/mmcblk0 console=ttyAMA0 loglevel=8" -dtb output/images/vexpress-v2p-ca9.dtb -sd output/images/rootfs.ext2 -nographic
但需要停止qemu的時候通過killall qemu-system-arm。
然后就進入如下console,輸入root: