- Mastering Embedded Linux Programming
- Chris Simmonds
- 500字
- 2021-07-30 09:45:02
Barebox
I will complete this chapter with a look at another bootloader that has the same roots as U-Boot but takes a new approach to bootloaders. It is derived from U-Boot and was actually called U-Boot v2 in the early days. The Barebox developers aimed to combine the best parts of U-Boot and Linux, including a POSIX-like API and mountable filesystems.
The Barebox project website is mailing list is <barebox@lists.infradead.org>
.
Getting Barebox
To get Barebox, clone the git repository and check out the version you want to use:
$ git clone git://git.pengutronix.de/git/barebox.git $ cd barebox $ git checkout v2014.12.0
The layout of the code is similar to U-Boot:
arch
: Contains code specific to each supported architecture, which includes all the major embedded architectures. SoC support is inarch/[architecture]/mach-[SoC]
. Support for individual boards is inarch/[architecture]/boards
.common
: Contains core functions, including the shell.commands
: Contains the commands that can be called from the shell.Documentation
: Contains the templates for documentation files. To build it, type "make docs
". The results are put inDocumentation/html
.drivers
: Contains the code for the device drivers.include
: Contains header files.
Building Barebox
Barebox has used kconfig/kbuild
for a long time. There are default configuration files in arch/[architecture]/configs
. As an example, assume that you want to build Barebox for the BeagleBoard C4. You need two configurations, one for the SPL, and one for the main binary. Firstly, build MLO:
$ make ARCH=arm CROSS_COMPILE=arm-cortex_a8-linux-gnueabi- omap3530_beagle_xload_defconfig $ make ARCH=arm CROSS_COMPILE=arm-cortex_a8-linux-gnueabi-
The result is the secondary program loader, MLO.
Next, build Barebox:
$ make ARCH=arm CROSS_COMPILE=arm-cortex_a8-linux-gnueabi- omap3530_beagle_defconfig $ make ARCH=arm CROSS_COMPILE=arm-cortex_a8-linux-gnueabi-
Copy both to an SD card:
$ cp MLO /media/boot/ $ cp barebox-flash-image /media/boot/barebox.bin
Then, boot up the board and you should see messages like these on the console:
barebox 2014.12.0 #1 Wed Dec 31 11:04:39 GMT 2014 Board: Texas Instruments beagle nand: Trying ONFI probe in 16 bits mode, aborting ! nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron ), 256MiB, page size: 2048, OOB size: 64 omap-hsmmc omap3-hsmmc0: registered as omap3-hsmmc0 mci0: detected SD card version 2.0 mci0: registered disk0 malloc space: 0x87bff400 -> 0x87fff3ff (size 4 MiB) booting from MMC barebox 2014.12.0 #2 Wed Dec 31 11:08:59 GMT 2014 Board: Texas Instruments beagle netconsole: registered as netconsole-1 i2c-omap i2c-omap30: bus 0 rev3.3 at 100 kHz ehci ehci0: USB EHCI 1.00 nand: Trying ONFI probe in 16 bits mode, aborting ! nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron NAND 256MiB 1,8V 16-bit), 256MiB, page size: 2048, OOB size: 64 omap-hsmmc omap3-hsmmc0: registered as omap3-hsmmc0 mci0: detected SD card version 2.0 mci0: registered disk0 malloc space: 0x85e00000 -> 0x87dfffff (size 32 MiB) environment load /boot/barebox.env: No such file or directory Maybe you have to create the partition. no valid environment found on /boot/barebox.env. Using default environment running /env/bin/init... Hit any key to stop autoboot: 0
Barebox is continuing to evolve. At the time of writing, it lacks the breadth of hardware support that U-Boot has, but it is worth considering for new projects.
- 移動UI設計(微課版)
- Mastering Ember.js
- Apache Spark 2 for Beginners
- AppInventor實踐教程:Android智能應用開發前傳
- HTML 5與CSS 3權威指南(第3版·上冊)
- Android項目實戰:手機安全衛士開發案例解析
- Python程序設計與算法基礎教程(第2版)(微課版)
- Learning Jakarta Struts 1.2: a concise and practical tutorial
- Hack與HHVM權威指南
- PHP項目開發全程實錄(第4版)
- 軟硬件綜合系統軟件需求建模及可靠性綜合試驗、分析、評價技術
- Scala實用指南
- PHP從入門到精通(微視頻精編版)
- Modern R Programming Cookbook
- 趣學Python游戲編程