【xboot】xboot环境搭建
1.xboot
1.1 xboot简介
XBoot是一个为嵌入式系统设计的高效、灵活的启动加载器(bootloader),它支持多种处理器架构,如ARM和MIPS,并具有广泛的设备树支持 。它由Alex Forencich开发和维护,目的是提供一种简单、轻量级的方式来引导嵌入式系统 。
XBoot的主要特点包括:
1.支持多种处理器架构,包括ARM和MIPS。
2.提供了对多种SoC和开发板的设备树支持。
3.高度可配置,以满足特定需求和限制。
4.支持多种文件系统类型,例如FAT、EXT2/EXT3/EXT4、JFFS2等。
5.轻量级设计,便于快速启动和在资源受限的环境中运行。
XBoot的应用场景多样,可以用于嵌入式Linux系统开发、单板计算机(SBC)的启动加载、物联网(IoT)设备的初始引导、实时操作系统(RTOS)的引导加载程序,以及OTA固件更新 。XBoot根据硬件平台和需求进行配置。配置完成后,通过执行make命令构建XBoot,并将其安装到目标设备上。它还可以作为SOC片上系统应用软件执行引擎,允许APP上电后直接执行,无需依赖复杂的操作系统
1.2 下载xboot源码
git clone https://gitee.com/xboot/xboot.git
2.交叉编译各种环境下的xboot
2.1 rapi3
rapi3交叉工具链下载路径:
https://developer.arm.com/downloads/-/gnu-a
编译rapi3命令:
make clean
make CROSS_COMPILE=/home/zx/Desktop/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf- PLATFORM=arm64-raspi3
编译成功:
2.2 rapi2
rapi2的交叉工具链:
编译rapi2命令:
make clean
make CROSS_COMPILE=/home/zx/Desktop/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf- PLATFORM=arm32-raspi2
2.3 Realview平台
使用qeum-system-arm模拟器
make clean
make CROSS_COMPILE=/home/zx/Desktop/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf- PLATFORM=arm32-realview
2.4 全志V3S(荔枝派lichee-pi zero)
make clean
make CROSS_COMPILE=/path/to/arm-none-linux-gnueabihf- PLATFORM=arm32-v3s
2.5 x86_64位Linux系统下的sandbox
sudo apt-get install libsdl2-dev
make clean
make CROSS_COMPILE="" PLATFORM=x64-sandbox
3.qeum仿真运行xboot.bin文件
执行以下脚本后发现当前Ubuntu的qemu不支持rasp3
查看当前版本所支持的板子:
qemu-system-aarch64 -M ?
表示当前只支持2代板子
运行realview环境,执行成功
运行log
zx@ubuntu:~/Desktop/codes/xboot/tools/qemu-system/linux$ ./realview-run.sh
WARNING: Image format was not specified for '/home/zx/.xboot/sdcard.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
█████████████████████████
██ ▄▄▄▄▄ ██▄▀▀▀█ ▄▄▄▄▄ ██
██ █ █ █ ▀▄█ █ █ █ ██
██ █▄▄▄█ ██▄ ██ █▄▄▄█ ██
██▄▄▄▄▄▄▄█▄█ █ █▄▄▄▄▄▄▄██
████▀▄ ▀▄▄█ ▀█▄▀█▀▀ █▀██
███▀▄▀ ▀▄ ▄█▀▀▄▀█ ▀█ ▄███
███▄█▄█▄▄▄▀▀ ▄ ▀ ▄▄ ▀ ██
██ ▄▄▄▄▄ █▄ ▄█▄▀▄████▄▄██
██ █ █ █ ▀█▄█▄▄█ ▄▀█▄██
██ █▄▄▄█ ██▀ █ ▄▄▄▄█▄ ██
██▄▄▄▄▄▄▄███▄██▄▄▄▄▄▄▄███
█████████████████████████
_ _
_ _ | |___ _____ _____ _| |_
\ \/ /| _ | _ | _ |_ _| (C) 2007-2023
) ( | |_| | |_| | |_| | | |____JIANJUN.JIANG__
/_/\_\|_____|_____|_____| |_____________________|
V3.0.0 (Jul 24 2024 - 05:36:47) - [realview-pbx-a9][ARM RealView Platform Baseboard Explore for Cortex-A9]
[ 0.000020]Probe device 'blk-romdisk.0' with blk-romdisk
[ 0.000800]Probe device 'xtal' with clk-fixed
[ 0.000810]Probe device 'uclk' with clk-fixed
[ 0.000820]Probe device 'kclk' with clk-fixed
[ 0.000830]Probe device 'mclk' with clk-fixed
[ 0.000840]Probe device 'timclk' with clk-fixed
[ 0.000850]Probe device 'refclk' with clk-fixed
[ 0.000860]Probe device 'irq-gic.0' with irq-gic
[ 0.000870]Probe device 'dma-pl08x.0' with dma-pl08x
[ 0.000880]Probe device 'gpio-pl061.0' with gpio-pl061
[ 0.000890]Probe device 'gpio-pl061.1' with gpio-pl061
[ 0.000900]Probe device 'gpio-pl061.2' with gpio-pl061
[ 0.000910]Probe device 'ce-sp804.0' with ce-sp804
[ 0.000398]Probe device 'cs-sp804.0' with cs-sp804
[ 0.001550]Probe device 'uart-pl011.0' with uart-pl011
[ 0.002338]Probe device 'uart-pl011.1' with uart-pl011
[ 0.003141]Probe device 'uart-pl011.2' with uart-pl011
[ 0.004067]Probe device 'uart-pl011.3' with uart-pl011
[ 0.004923]Probe device 'i2c-versatile.0' with i2c-versatile
[ 0.006058]SD/MMC card at the 'sdhci-pl180.0' host controller:
[ 0.006631] Attached is a SD card
[ 0.006950] Version: 2.0
[ 0.007747] Capacity: 128.000MB
[ 0.008063] CID: AA585951-454D5521-01DEADBE-EF006218
[ 0.008540] CSD: 0026005A-5F59E07F-FFFFDFFF-92600058
[ 0.009033] Max transfer speed: 50000000 HZ
[ 0.009432] Manufacturer ID: AA
[ 0.009742] OEM/Application ID: 5859
[ 0.010080] Product name: 'QEMU!'
[ 0.010400] Product revision: 0.1
[ 0.010952] Serial no: 4292870034
[ 0.011426] Manufacturing date: 2006.2
[ 0.012759]Found mbr partition:
[ 0.013116] 0x0000000000000000 ~ 0x0000000007ffffff 128.000MB - sdhci-pl180.0.sdcard
[ 0.014063] 0x0000000000100000 ~ 0x00000000040fffff 64.000MB - sdhci-pl180.0.sdcard.p0
[ 0.014925] 0x0000000004100000 ~ 0x0000000007ffffff 63.000MB - sdhci-pl180.0.sdcard.p1
[ 0.015782]Probe device 'sdhci-pl180.0' with sdhci-pl180
[ 0.016986]Probe device 'key-gpio-polled.0' with key-gpio-polled
[ 0.017672]Fail to probe device with rc-gpio
[ 0.018107]Fail to probe device with rotary-gpio
[ 0.018792]Probe device 'keyboard-pl050.0' with keyboard-pl050
[ 0.019698]Probe device 'mouse-pl050.0' with mouse-pl050
[ 0.021019]Probe device 'led-gpio.0' with led-gpio
[ 0.021536]Probe device 'led-gpio.1' with led-gpio
[ 0.022136]Probe device 'ledtrigger-heartbeat.0' with ledtrigger-heartbeat
[ 0.025838]Probe device 'ledtrigger-general.0' with ledtrigger-general
[ 0.026795]Probe device 'buzzer-gpio.0' with buzzer-gpio
[ 0.027401]Probe device 'vibrator-gpio.0' with vibrator-gpio
[ 0.028068]Probe device 'rtc-pl031.0' with rtc-pl031
[ 0.030807]Probe device 'rtc-ds1338.0' with rtc-ds1338
[ 0.046167]Probe device 'fb-pl111.0' with fb-pl111
[ 0.046487]Probe device 'console-uart.0' with console-uart
[ 0.046951]Probe device 'console-uart.1' with console-uart
[ 0.049718]Probe device 'console-uart.2' with console-uart
[ 0.050061]Probe device 'console-uart.3' with console-uart
[ 0.050994]mount /private with 'ram' filesystem
[ 0.101480]ext4: directory indexing is not available
Press any key to stop auto boot: 0.000
xboot: /#