2

I've created an image (with Yocto and meta-tegra) and got a Jetson Nano devkit running with two rootfs that RAUC updating uses. I am currently (temporarily during testing) using the Jetson Nano devkit SPI flash to store the u-boot environment.

I have a script that I successfully got running on my device with tftp. I've also manually typed in every line of my script to an environment variable, saved it and set bootcmd to run it. But if i want more than one device with this u-boot, i wouldn't want to manually type in the script for every device i make. But I also don't want a tftp server to be running at the side to be able to boot.

I want to run my script completely independent and automatically. So I've been thinking about having the script on a partition on it's own and get u-boot to load the script from there. But how do i tell u-boot to look for at script in the specific partition? Can i use source SCRIPT_PARTITION_OFFSET?

I've also seen that the standard boot.scr can be run from the u-boot shell. Where is this boot.scr located? I can't seem to find where it is created or where it is stored.

*****************************************************EDIT:***************************************************** As a temporary solution I have put the boot script image into /boot/ folder and set the u-boot to scan for scripts in the that folder on both rootfs and then run it if it can find it.

For this solution i still have to edit the u-boot env to make u-boot boot this custom way, so it is not a solution i can use in the long run. I might as well make a script to run once via tftp that will set bootcmd to be the entire boot script content.

Can i edit the u-boot source code with a patch that has my script in it's environment? - if so, how?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Varyag
  • 676
  • 12
  • 29
  • In `include/common` you'll probably find a header with your _default_ environment. You could edit that and rebuild. Remember you need to default your environment in uboot to see the change. – Richard Nixon Oct 20 '19 at 12:58
  • Thank you, I found something alike your comment suggests. The file `u-boot-tegra/include/config_distro_bootcmd.h` that contains the variable `distro_bootcmd` that is run by default by `bootcmd` at normal build. I've made a patch for that file that has the distro_bootcmd variable contain my script content. If it works, i will write an answer. – Varyag Oct 21 '19 at 08:24

1 Answers1

1

As said in the comments, i was able to make a patch for u-boot-tegra/include/config_distro_bootcmd.h that has the variable distro_bootcmd set to my script content. When i then build my yocto image and boot up my Jetson Nano, i can see that the variable is in fact set.

This way should work for any u-boot and not just for Jetson Nano. Just find the bootcmd variable in the u-boot that runs at default boot and patch it.

Varyag
  • 676
  • 12
  • 29