i.MX25 SODIMM PC Barebox

From Voipac Wiki
Revision as of 10:28, 23 October 2021 by Voipac (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

i.MX25 SODIMM PC - Development Kit uses Barebox as a bootloader. This page displays how to configure and build it.

Barebox is a bootloader responsible for hardware initialization, loading and booting Linux kernel. It is also used for module flashing.

Barebox 2017.12.0

Set toolchain

Export toolchain variables for every related terminal session.

Download and extract source code

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

Compile

Output file is stored as images/barebox-voipac-vmx25.img

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

Configuring bootloader environment

DTB file selection

As different module configurations use altered device trees, defining the actual board variant is important. The correct global.vmx.model variable is set based on these options:

  • "254" for Basic configuration
  • "264" for Pro configuration
  • "265" for Max configuration
barebox@Voipac 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

The Barebox environment should be saved afterwards to apply the changes:

barebox@Voipac VMX25:/ saveenv

Barebox 2014.03.0

Set toolchain

Export toolchain variables for every related terminal session.

Set shell variables

BB_VERSION=2014.03.0
SW_VERSION=20151129

Download and extract source code

mkdir -pv ~/workdir/vmx/bootloader/
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

Download and apply Voipac patches

cd ~/workdir/vmx/bootloader/
wget http://downloads.voipac.com/files/i.MX25_SODIMM_PC-Development_kit/module/software/barebox/sources/barebox-${BB_VERSION}_vmx25_${SW_VERSION}.cfg
wget http://downloads.voipac.com/files/i.MX25_SODIMM_PC-Development_kit/module/software/barebox/sources/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

Output file is stored in arch/arm/pbl/zbarebox.bin:

cd ~/workdir/vmx/bootloader/barebox-${BB_VERSION}.work
#make ARCH=arm menuconfig
make -j4

Configuring bootloader environment

Edit boot options

Barebox provides 4 boot configurations by default:

  • 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)


Boot configuration files support custom kernel definition. These settings also allow updating paths or names for binaries:

barebox@Voipac VMX25:/ edit /env/boot/net-legacy
barebox@Voipac 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

DTB file selection

As different module configurations use altered device trees, defining the correct board variant is important:

barebox@Voipac VMX25:/ edit /env/config
...
# BASIC=254, PRO=264, MAX=265
#global.vmxmodel=254
#global.vmxmodel=264
#global.vmxmodel=265
...
barebox@Voipac VMX25:/ saveenv
barebox@Voipac VMX25:/ reset