AnsweredAssumed Answered

rebuilding uboot with flex-builder: my tricks

Question asked by john Reed on Jul 8, 2020
Latest reply on Jul 8, 2020 by Yiping Wang

Here's some findings on u-boot some of you may find valuable.


Couple days ago I'm doing some low-level work, trying to get a SATA drive recognized on a layerscape platform (1043ardb).    I wanted to add both the 'sata' command and the 'scsi' command to u-boot.    Maybe start there, see what's what.


Ohhhhhh, fancy, shmancy tool called "flex-builder" to automate everything for me!!   Slam dunk.   30 minutes max.

About a day-and-a-half later, and a little frustration.....


After a bit of searching/reading/messing around, I settled on a 2-stage approach for rebuilding u-boot:


    flex-builder -c firmware -m ls1043ardb -b sd

    flex-builder -i mkfw -m ls1043ardb -b sd


The 1st one rebuilds the firmware pieces: which includes uboot.

The 2nd one creates the .img you burn to the sdcard with dd.


What I found was that I could indeed re-compile u-boot and it does build fine, but the changes would not get into the final image.      A simple example:  I tried changing the string "autoboot" to "Autoboat". (in common/autoboot.c).


Trick #1:  reconfiguring u-boot

     - File to edit is:  <product>_tfa_defconfig       (my mistake was thinking the file was:   <product>_sdcard_defconfig)

     - after eding the tfa_defconfig, manually delete this directory:


     - rebuild u-boot with 3 stage approach (my Trick #2)


Trick #2:  2-stage approach from above changed to 3 stage approach:

    - rm -f $FBDIR/build/firmware/u-boot/ls1043ardb/uboot_<product>_tfa.bin

    - flex-builder -c firmware -m ls1043ardb -b sd

    - flex-builder -i mkfw -m ls1043ardb -b sd


That 'rm -f' statement forces the tfa configuration of u-boot to rebuild.   Without that, it doesn't rebuild.


Happy Layer-scaping!!