i.MX8 - Nitrogen8M Yocto Customizing Boot Sequence

< IMX8‎ | Nitrogen8M‎ | Yocto
Revision as of 17:41, 23 November 2018 by Mmontero (talk | contribs) (Created page with "<!-- Please add custom keywords relevant to the page as arguments to the head macro. For example: {{IMX8/Head|carrier,carrier board,base board,SOM,System on Module,Boundary De...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)




  Index  






Modifying Bootscript

Nitrogen8M U-Boot is made to look for and execute a bootscript named boot.src. This script will load the device tree, kernel and setup bootargs. When you are developing, you may need to modify this script, following instructions will show you how to modify it from your yocto enviroment.

Custom meta layer

You will need your own meta layer, if you already have one, skip this and follow to the next section

Adding U-Boot script recipe

1. Create recipe directories

# You need to set YOCTO_BUILD_DIR and META_LAYER to match your setup
cd $YOCTO_BUILD_DIR/sources/$META_LAYER
mkdir -p recipes-bsp/u-boot/files

2. Download/Modify your boot script. You can download the Boundary bootscript text file bootscript-yocto.txt, found inside the U-Boot source code under the bootscripts folder (board/boundary/bootscripts/). Modify the file as you want and then copy it into the files directory:

# You need to set YOCTO_BUILD_DIR and META_LAYER to match your setup
cp bootscript-yocto.txt $YOCTO_BUILD_DIR/sources/$META_LAYER/recipes-bsp/u-boot/files

3. Create .bbappend for the uboot-script recipe.

# You need to set YOCTO_BUILD_DIR and META_LAYER to match your setup
cp bootscript-yocto.txt $YOCTO_BUILD_DIR/sources/$META_LAYER/recipes-bsp/u-boot/
touch u-boot-script-boundary_%.bbappend

This commands created an empty file u-boot-script-boundary_%.bbappend, the percentage allows the recipe to be used for the current package version. Open the file with your favorite editor and fill it as follows:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://bootscript-yocto.txt"

BOOTSCRIPT = "${WORKDIR}/bootscript-yocto.txt"

This tells to the u-boot-script-boundary recipe where to find the bootscript text file.

Building Bootscript

Now that you have the append recipe in place pointing to your custom bootscript file you can create the binary boot.src

#Assuming your build directory name is build, otherwise you need to change the name "build" to your corresponding directory name

cd $YOCTO_BUILD_DIR
source setup-environment build/
bitbake u-boot-script-boundary

The boot.src can be found on your yocto directory at $YOCTO_BUILD_DIR/build/tmp/work/nitrogen8m-fslc-linux/u-boot-script-boundary/$VERSION/image/, notice that $VERSION depends of your u-boot version, for example for u-boot 2018.07 the corresponding path is tmp/work/nitrogen8m-fslc-linux/u-boot-script-boundary/v2018.07+gitAUTOINC+f35ba6cfbe-r0/image/. Copy boot.src to your boot device at the boot partition.


Modifying Bootargs

If you just need a temporal change to the bootargs and don't want to build your own bootscript, you can use the cmd_custom u-boot enviroment variable to set them as follows:

1. Power ON the Nitrogen8M board, and stop the boot up process on u-boot, (press a key during the boot up count down)

2. While in u-boot set the cmd_custom variable

#Set <custom_bootargs> with your bootargs parameters

setenv cmd_custom 'setenv bootargs $bootargs <custom_bootargs>

Example:

# Add bootargs to keep serial console alive on power management for debugging purposes

setenv cmd_custom 'setenv bootargs $bootargs no_console_suspend=1


  Index Next: N