How to hack uboot and linux step by step QEMU介绍 QEMU是一个支持各种目标处理器(例如x86,ARM,MIPS等)的模拟器。当用作机器仿真器时,QEMU可以在另一台机器(例如x86 PC)上运行为一台机器(例如ARM板)制作的操作系统和程序。在本文中,将详细列举出如何一步步搭建QEMU+ARM的仿真环境,虚拟的开发板为vexpress-a9 BC my laptop is MAC. so will use docker. 1. QEMU环境搭建 (setup qemu) ``` brew install qemu ``` 2. docker搭建 (setup docker) `docker pull ROCPROJECT/CROSS-ARM-LINUX-GNUEABIHF` 3. pull uboot ``` git clone https://source.denx.de/u-boot/u-boot.git ``` 5. run docker ``` docker run -it -v $(pwd)/:/root/src/ rocproject/cross-arm-linux-gnueabihf /bin/bash ``` 7. make uboot add the `PLATFORM_CPPFLAGS := -ggdb` to config.mk more info : https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc.pdf ``` make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm vexpress_ca9x4_defconfig make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm -j8 ``` 当遇到需要安装的lib的时候按照提示安装 7. run qemu ``` qemu-system-arm -M vexpress-a9 -m 512M -kernel ./u-boot/u-boot -nographic -no-reboot ``` 可以看到u-boot已经正常运行,但是由于找不到kernel,所以无法启动kernel,因此停留在u-boot命令行模式下。这里我们先开始debug uboot 之旅 8. 如何 track uboot 在mac 端 运行 qemu-system-arm -M vexpress-a9 -m 256M -nographic -kernel u-boot -s -S 在docker 端运行:gdb-multiarch u-boot target remote 192.168.0.104:1234 (mac ip)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up