Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Luca Barbato
Luca Barbato

Posted on • Edited on

     

Honeycomb-lx2k - Replacing the bootloader

I saw some interesting changes for u-boot landing in theimage-builderSolidRun provides and almost coincidentally their customer service replied to my initial inquiry about the booting process.

That lead to some more tries and testing, I had yet to see if there is a linux kernel update that makes rebooting work as should, but at least now I know that the problem is just software.

Since I do not want to wipe the eMMC image all the time I asked them directions on how to just update the bootloader and they provided me with enough directions.

Since it isn't yet trivial to get the sources in the right shape here a short blogpost about it.

Getting the sources

Our point of truth is again theimage-builder since it contains the patches and how to apply them.
I'm using Gentoo so I just read therunme.sh and adapt it.
I want to useu-boot, the boot image is of theTrusted Firmware-A kind, so I need to fetchaft to assemble the whole thing andrcw to build the Pre-Boot Loader initialization code.

cd /usr/src# Get the build script and the patchsetsgit clone https://github.com/SolidRun/lx2160a_build# u-boot as the main bootloadergit clone https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot# trusted firmware buildergit clone https://source.codeaurora.org/external/qoriq/qoriq-components/atf# pre-boot initialization compilergit clone https://source.codeaurora.org/external/qoriq/qoriq-components/rcw
Enter fullscreen modeExit fullscreen mode

Patches

There are plenty and they apply on specific tags, I'm usingLSDK-20.04 as base.
The patches could live inpatches/<tool name> orpatches/<tool-name>-<tag>.

forainrcw u-boot;dopushd$a    git checkout-b LSDK-20.04 refs/tags/LSDK-20.04    git am ../lx2160a_build/patches/$a-LSDK-20.04/*popddonepushdaftgit checkout-b LSDK-20.04 refs/tags/LSDK-20.04git am ../lx2160a_build/patches/aft/*popd
Enter fullscreen modeExit fullscreen mode

Binary blobs

The script fetches and uses some binary blobs

cd aft/tools/fiptool/git clone https://github.com/NXP/ddr-phy-binary.gitmake./fiptool create --ddr-immem-udimm-1d ddr-phy-binary/lx2160a/ddr4_pmu_train_imem.bin --ddr-immem-udimm-2d ddr-phy-binary/lx2160a/ddr4_2d_pmu_train_imem.bin --ddr-dmmem-udimm-1d ddr-phy-binary/lx2160a/ddr4_pmu_train_dmem.bin --ddr-dmmem-udimm-2d ddr-phy-binary/lx2160a/ddr4_2d_pmu_train_dmem.bin --ddr-immem-rdimm-1d ddr-phy-binary/lx2160a/ddr4_rdimm_pmu_train_imem.bin --ddr-immem-rdimm-2d ddr-phy-binary/lx2160a/ddr4_rdimm2d_pmu_train_imem.bin --ddr-dmmem-rdimm-1d ddr-phy-binary/lx2160a/ddr4_rdimm_pmu_train_dmem.bin --ddr-dmmem-rdimm-2d ddr-phy-binary/lx2160a/ddr4_rdimm2d_pmu_train_dmem.bin fip_ddr_all.bin
Enter fullscreen modeExit fullscreen mode

Building

We need to buildu-boot and thercw images first and then put everything together with atf.

u-boot

pushdu-bootmake lx2160acex7_tfa_defconfigmake-j16exportBL33=$PWD/u-boot.binpopd
Enter fullscreen modeExit fullscreen mode

Note: if you are using gcc-10, you should apply a patch on top of the set

diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.lindex fd825ebba6..24af549977 100644--- a/scripts/dtc/dtc-lexer.l+++ b/scripts/dtc/dtc-lexer.l@@ -38,7 +38,6 @@ LINECOMMENT   "//".*\n #include "srcpos.h" #include "dtc-parser.tab.h"-YYLTYPE yylloc; extern bool treesource_error; /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
Enter fullscreen modeExit fullscreen mode

rcw

# Set the configuration for your memory timings and the SERDES configuration for your networking# Options at hand# DDR_SPEED=2400,2600,2900,3200exportDDR_SPEED=${DDR_SPEED:-3200}# SERDES=8_5_2, 13_5_2, 20_5_2exportSERDES=${SERDES:-8_5_2}exportSPEED=2000_700_${DDR_SPEED}pushdrcw/lx2160acex7mkdir-p RCWecho"#include <configs/lx2160a_defaults.rcwi>"> RCW/template.rcwecho"#include <configs/lx2160a_${SPEED}.rcwi>">> RCW/template.rcwecho"#include <configs/lx2160a_${SERDES}.rcwi>">> RCW/template.rcwmake cleanmake-j 16popd
Enter fullscreen modeExit fullscreen mode

Once those two componets are built we assemble everything in our image

pushdatfmakePLAT=lx2160acex7 cleanmake-j16PLAT=lx2160acex7 all fip pblRCW=../rcw/lx2160acex7/RCW/template.binTRUSTED_BOARD_BOOT=0GENERATE_COT=0BOOT_MODE=autoSECURE_BOOT=false
Enter fullscreen modeExit fullscreen mode

Inbuild/lx2160acex7/release/fip.bin we have our final product if everything went well.

Flashing

The process itself is quite simple, you copy with dd the image to an offset of your boot device (either the eMMC/dev/mmcblk1 or the SD/dev/mmcblk0).

Note: just in case you might back up the firmware

ddif=/dev/mmcblk0of=backup-fip.binbs=512seek=2048conv=notrunc
Enter fullscreen modeExit fullscreen mode

And then overwrite it

ddif=build/lx2160acex7/release/fip.binof=/dev/mmcblk0bs=512seek=2048conv=notrunc
Enter fullscreen modeExit fullscreen mode

Once you reboot you should look for something like:

U-Boot 2019.10-00019-g16209d0bf6 (Jul 08 2020 - 15:14:33 +0300)
Enter fullscreen modeExit fullscreen mode

In the early boot messages.

Word of warning

The currentu-boot code available as today is fairly new and has two interesting features:

  • u-boot is able topoweroff (linux is not, yet, sadly)
  • u-boot would stop setting the fan at full blast

Make sure your kernel is able to drive the fans correctly otherwise the system will hit the shutdown temperature.

I'm looking forward the time this nice machine could power on and power off correctly.

Coming next

Hopefully I'll complete and publish some more information aboutrav1e, both its API and its internals.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I do opensource stuff, lately in Rust
  • Location
    Torino
  • Joined

More fromLuca Barbato

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp