2

This is a continuation of my other post.

I've managed to create an image with u-boot and rauce.

I've made a simple rauc system.conf:

[system]
compatible=Jetson Nano
bootloader=uboot 
#
[slot.rootfs.0]
device=/dev/mmcblk0p1
type=ext4
bootname=system0
# 
[slot.rootfs.1]
device=/dev/mmcblk0p13
type=ext4
bootname=system1

[UPDATED]:

Pretty much copy pasted the contrib uboot.sh script.

Then I've added a bb file from here into my bsp layer.

And added rauc to my IMAGE_INSTALL.

When i boot up the nano with my image, rauc isn't working as it should. When i check the status on the service with systemctl status rauc-mark-service-good.service it returns:

● rauc-mark-good.service - Rauc Good-marking Service
   Loaded: loaded (/lib/systemd/system/rauc-mark-good.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Tue 2019-10-01 07:51:22 UTC; 4s ago
  Process: 4147 ExecStart=/usr/bin/rauc status mark-good (code=exited, status=0/SUCCESS)
 Main PID: 4147 (code=exited, status=0/SUCCESS)

Oct 01 07:51:22 jetson-nano systemd[1]: Started Rauc Good-marking Service.
Oct 01 07:51:22 jetson-nano rauc[4147]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:51:22 jetson-nano rauc[4147]: rauc mark: marked slot rootfs.0 as good
Oct 01 07:51:22 jetson-nano systemd[1]: rauc-mark-good.service: Succeeded.

systemctl status rauc returns:

● rauc.service - Rauc Update Service
   Loaded: loaded (/lib/systemd/system/rauc.service; static; vendor preset: enabled)
   Active: active (running) since Tue 2019-10-01 07:49:36 UTC; 2min 0s ago
     Docs: https://rauc.readthedocs.io
 Main PID: 4092 (rauc)
    Tasks: 3 (limit: 4178)
   Memory: 4.4M
   CGroup: /system.slice/rauc.service
           └─4092 /usr/bin/rauc --mount=/run/rauc service

Oct 01 07:49:36 jetson-nano systemd[1]: Starting Rauc Update Service...
Oct 01 07:49:36 jetson-nano systemd[1]: Started Rauc Update Service.
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed to load status file /slot.raucs: No such file or directory
Oct 01 07:49:48 jetson-nano rauc[4092]: mounting slot /dev/mmcblk0p13
Oct 01 07:49:48 jetson-nano rauc[4092]: Failed to load status file /run/rauc/rootfs.1/slot.raucs: No such file or directory
Oct 01 07:51:22 jetson-nano rauc[4092]: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot
Oct 01 07:51:22 jetson-nano rauc[4092]: rauc mark: marked slot rootfs.0 as good

And rauc status returns:


(rauc:4195): rauc-WARNING **: 07:51:46.126: Failed getting primary slot: Failed getting primary slot: Unable to find primary boot slot

Compatible:  Jetson Nano
Variant:
Booted from: rootfs.0 (/dev/mmcblk0p1)
Activated:   (null) ((null))
slot states:
  rootfs.0: class=rootfs, device=/dev/mmcblk0p1, type=ext4, bootname=system0
      state=booted, description=, parent=(none), mountpoint=/
      boot status=bad
  rootfs.1: class=rootfs, device=/dev/mmcblk0p13, type=ext4, bootname=system1
      state=inactive, description=, parent=(none), mountpoint=(none)
      boot status=bad

So there is no /slot.raucs file and it failed to find primary boot slot.

After that, systemctl status rauc-mark-good returns that the rootfs.0 slot has been marked as good in the end, but systemctl status rauc shows that the boot status is bad.

What am I missing here?

Varyag
  • 676
  • 12
  • 29
  • [u-boot-fw-utils-tegra](https://github.com/madisongh/meta-tegra/blob/master/recipes-bsp/u-boot/u-boot-fw-utils-tegra_2016.07.bb) installs corresponding [fw_env.config](https://github.com/madisongh/meta-tegra/blob/master/recipes-bsp/u-boot/files/tegra210/fw_env.config), it installs it directly to eMMC boot partition. – Nayfe Oct 08 '19 at 09:09
  • Well I can find in /etc/fw_env.config but it only contains the TX1 u-boot params and nothing about the Jetson Nano u-boot. The Jetson Nano doesn't even have a mmcblk0boot1 partition. – Varyag Oct 08 '19 at 09:17
  • I found [this post](https://devtalk.nvidia.com/default/topic/1057840/jetson-nano-u-boot-tool-fw_printenv-and-fw_setenv/?offset=2) that apparently has a solution but it isn't working for me at the moment. – Varyag Oct 08 '19 at 09:30
  • Problem with u-boot environment in system partition is that it will be overwritten by RAUC at every system update? Shouldn't it be in a separate partition? – Nayfe Oct 08 '19 at 09:42
  • Yes, I see your point. But then i don't know how i can use u-boot and RAUC on the Jetson Nano Dev kit? It seems like the RAUC is looking for the boot partition to be able to work, but how can i provide the information it needs then? – Varyag Oct 08 '19 at 11:15
  • I don't know your Jetson Nano partition scheme and do you plan to update bootloader from RAUC. Something quite easy is to create a separate partition for fw_env file and point to it in EXT4_ENV_DEVICE_AND_PART u-boot config. – Nayfe Oct 08 '19 at 11:21
  • I will attempt to do that. I think i know how to make another partition, but how to point to it in the u-boot config I'll have to look into. – Varyag Oct 08 '19 at 11:35
  • But i still need to know what to put into the fw_env.config file? I've added my partition scheme to the question in the top. – Varyag Oct 08 '19 at 12:16
  • `/uboot.env 0x0000 0x2000` depending on `EXT4_ENV_FILE`. 0x2000 reflects value of `CONFIG_ENV_SIZE` and 0x0000 `CONFIG_ENV_OFFSET`. In normal time, it allows u-boot to write in unformatted partition at specific place on device. – Nayfe Oct 08 '19 at 13:03
  • I've updated my question at EDIT 4 with my progress and a new questions. Thank you for helping! – Varyag Oct 09 '19 at 08:41
  • @Nayfe i've managed to get the u-boot environment to the SPI thanks to the maintainer of the meta-tegra layer. I've updated the question again, ty. – Varyag Oct 15 '19 at 06:00
  • I don't use RAUC so I can't help you anymore on this, maybe try to reach ML rauc@pengutronix.de ? – Nayfe Oct 15 '19 at 07:11
  • 1
    Allright I'll give it a go, but thank you very much for helping me get this far, I appreciate it. – Varyag Oct 15 '19 at 07:16

1 Answers1

2

I edited the uboot script to the following:

test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "system0 system1"
test -n "${BOOT_system0_LEFT}" || setenv BOOT_system0_LEFT 3
test -n "${BOOT_system1_LEFT}" || setenv BOOT_system1_LEFT 3

setenv bootargs
for BOOT_SLOT in "${BOOT_ORDER}"; do
  if test "x${bootargs}" != "x"; then
    # skip remaining slots
  elif test "x${BOOT_SLOT}" = "xsystem0"; then
    if test ${BOOT_system0_LEFT} -gt 0; then
      setexpr BOOT_system0_LEFT ${BOOT_system0_LEFT} - 1
      echo "Found valid slot system0, ${BOOT_system0_LEFT} attempts remaining"
      setenv distro_bootpart "1"
      setenv boot_line "mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf"
    fi
  elif test "x${BOOT_SLOT}" = "xsystem1"; then
    if test ${BOOT_system1_LEFT} -gt 0; then
      setexpr BOOT_system1_LEFT ${BOOT_system1_LEFT} - 1
      echo "Found valid slot system1, ${BOOT_system1_LEFT} attempts remaining"
      setenv distro_bootpart "13"
      setenv boot_line "mmc 1:D any ${scriptaddr} /boot/extlinux/extlinux.conf"
    fi
  fi
done

if test -n "${bootargs}"; then
  saveenv
else
  echo "No valid slot found, resetting tries to 3"
  setenv BOOT_system0_LEFT 3
  setenv BOOT_system1_LEFT 3
  saveenv
  reset
fi

sysboot ${boot_line}

And it ended up working. Apparently there was some issues with the BOOT_ORDER "system0 system1" in the the uboot script that was somehow not the same as in the RAUC system.conf. When i re-wrote the script, there was no issues and RAUC was running fine.

Varyag
  • 676
  • 12
  • 29
  • Can u also show me your local.conf or layer.conf file. PS I am trying to make rauc work the same way as you did it with raspberrypi3, I am stuck with setting up the uboot environment – apex May 22 '20 at 09:47
  • As far as i remember, the only thing rauc related from my local.conf is the line "DEBUG_PREFIX_MAP=""" which prevents a bitbaking error and the layer.conf is just standard. What errors or problems are you having? – Varyag May 25 '20 at 06:44
  • I have posted an issue here https://github.com/rauc/rauc/issues/594 – apex May 29 '20 at 10:25