Wiki Home » vmx25 » barebox

barebox

Last modified by Administrator on 2018/10/21 17:21
Barebox is a bootloader responsible for hardware initialization, loading and booting linux kernel. It is also used for module flashing.

Build

Set toolchain

Export toolchain variables for every related terminal session.

Initial steps

Create working directory

mkdir -pv ~/workdir/vmx/bootloader/

Barebox 2017.12.0

Download & Extract source code

cd ~/workdir/vmx/bootloader/
git clone https://github.com/voipac/barebox.git barebox-voipac
cd barebox-voipac
git checkout barebox-v2017.12.0

Compile

cd ~/workdir/vmx/bootloader/barebox-voipac
#make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- imx_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8
Output file is called images/barebox-voipac-vmx25.img

Configure

Set correct DTB file based on module configuration

Barebox have build in 3 dtb files for configuration 254 (BASIC), 264(PRO), 265(MAX).
Correct 'global.vmx.model' shall be set for for proper operation.

[email protected] VMX25:/ edit env/config-board
#!/bin/sh

# board defaults, do not change in running system. Change /env/config
# instead

global vmx
global vmx.model
global vmx.kernelno
global vmx.kernel
global vmx.dtb

#global.vmx.model=254
#global.vmx.model=264
global.vmx.model=265
global.vmx.dtb=imx25-voipac-vmx25-${global.vmx.model}.dtb

global.hostname=vmx25
global.linux.bootargs.base="console=ttymxc0,115200"
global.boot.default=nand-ubi
[email protected] VMX25:/ saveenv

Barebox 2014.03.0

Set shell variables

BB_VERSION=2014.03.0
SW_VERSION=20140817

Download & Extract source code

cd ~/workdir/vmx/bootloader/
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/vmx/bootloader/
wget https://www.voipac.com/downloads/imx/25/src/barebox/barebox-${BB_VERSION}_vmx25_${SW_VERSION}.cfg
wget https://www.voipac.com/downloads/imx/25/src/barebox/barebox-${BB_VERSION}_vmx25_${SW_VERSION}.patch
cd ~/workdir/vmx/bootloader/barebox-${BB_VERSION}.work
patch -p1 < ../barebox-${BB_VERSION}_vmx25_${SW_VERSION}.patch
cp ../barebox-${BB_VERSION}_vmx25_${SW_VERSION}.cfg .config

Compile

cd ~/workdir/vmx/bootloader/barebox-${BB_VERSION}.work
#make ARCH=arm menuconfig
make -j4
Output file is called images/barebox-vmx25.img

Configure

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] VMX25:/ edit /env/boot/net-legacy
[email protected] VMX25:/ 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-legacy-ubi

Set correct DTB file based on module configuration

This is important when booting with Device Tree.

[email protected] VMX25:/ edit /env/config
...
# BASIC=254, PRO=264, MAX=265
#global.vmxmodel=254
#global.vmxmodel=264
#global.vmxmodel=265
...
[email protected] VMX25:/ saveenv
[email protected] VMX25:/ reset
Tags:
Created by Administrator on 2014/08/19 18:17

This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.1 - Documentation