Barebox is a bootloader responsible for hardware initialization, loading and booting linux kernel. It is also used for module flashing.
Build
Binary files build with Codesourcery toolchain are known to work correctly.
Export toolchain variables for every related terminal session.
Initial steps
Create working directory
mkdir -pv ~/workdir/vmx53/barebox/
Set shell variables
BB_VERSION=2014.03.0
SW_VERSION=20150308
cd ~/workdir/vmx53/barebox/
wget http://barebox.org/download/barebox-${BB_VERSION}.tar.bz2
tar xvjf barebox-${BB_VERSION}.tar.bz2
mv barebox-${BB_VERSION} barebox-${BB_VERSION}.orig
cp -rv barebox-${BB_VERSION}.orig barebox-${BB_VERSION}.work
Patch
cd ~/workdir/vmx53/barebox/
wget https://www.voipac.com/downloads/imx/53/src/barebox-${BB_VERSION}_vmx53_${SW_VERSION}.cfg
wget https://www.voipac.com/downloads/imx/53/src/barebox-${BB_VERSION}_vmx53_${SW_VERSION}.patch
cd ~/workdir/vmx53/barebox/barebox-${BB_VERSION}.work
patch -p1 < ../barebox-${BB_VERSION}_vmx53_${SW_VERSION}.patch
cp ../barebox-${BB_VERSION}_vmx53_${SW_VERSION}.cfg .config
Compile
cd ~/workdir/vmx53/barebox/barebox-${BB_VERSION}.work
#make ARCH=arm menuconfig
make -j4
Output file is called arch/arm/pbl/zbarebox.bin
Edit boot options
By default the barebox has predefined 4 boot configurations:
- nand-legacy-ubi
- Load kernel (nand - kernel)
- Attach rootfs (nand - rootfs)
- nand-dtb-ubi
- Load kernel (nand - kernel)
- Load device tree (nand - bareboxenv)
- Attach rootfs (nand - rootfs)
- net-legacy
- Load kernel (tftp)
- Attach rootfs (nfs)
- net-dtb
- Load kernel (tftp)
- Load device tree (tftp)
- Attach rootfs (nfs)
The boot configuration files include option such as kernel and rootfs name and paths (can be edited)
[email protected] VMX53:/ edit /env/config
# list of boot entries. These are executed in order until one
# succeeds. An entry can be:
# - a filename in /env/boot/
# - a full path to a directory. All files in this directory are
# treated as boot files and executed in alphabetical order
global.boot.default
=nand-dtb-ubi
Set correct DTB file based on module configuration
This is important when booting with Device Tree.