【问题标题】:u-boot script to allow choosing between which rootfs part to boot (RAUC)u-boot 脚本允许选择要引导的 rootfs 部分 (RAUC)
【发布时间】:2020-01-30 15:30:03
【问题描述】:

我已经成功地创建了一个包含两个 rootfs 分区的映像,以便使用 yocto/poky 在我的 jetson nano 上运行。我已经按照 meta-rauc 层 README 和 rauc 用户手册,创建了 system.conf 文件和 rauc_%.bbappend 文件,并且我能够成功创建捆绑包。

据我了解,我需要某种u-boot script

为了使 RAUC 能够切换正确的插槽,其系统配置必须从引导加载程序的角度指定相应插槽的名称。您还必须通过脚本(如 GRUB、U-Boot)或使用专用的引导选择基础架构(例如 Barebox 中的 bootchooser)在引导加载程序本身中设置适当的引导选择逻辑。

引导加载程序还必须提供一组 Linux 用户空间可以修改的变量,以更改引导顺序或优先级。

准备好此接口后,RAUC 将负责适当地设置启动逻辑。例如,它将在写入之前停用要更新的插槽,并在成功完成安装后重新激活它。

我是在 yocto 层或 build 文件夹中的某处制作脚本,还是在制作图像后需要将它放在 jetson nano 上的脚本? - 这个脚本的内容是什么?

**************************************************** ***编辑********************************************** **********

我已经制作了这个脚本:

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"
      setenv bootargs "${default_bootargs} root=/dev/mmcblk0p1 rauc.slot=system0"
    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"
      setenv bootargs "${default_bootargs} root=/dev/mmcblk0p13 rauc.slot=system1"
    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}

我在我的元层中有这个食谱recipes-bsp/u-boot/u-boot-script.bb

LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e"

S = "${WORKDIR}/git"

PACKAGE_ARCH = "${MACHINE_ARCH}"

DEPENDS = "u-boot-mkimage-native"

inherit deploy

BOOTSCRIPT ??= "${THISDIR}/uboot.sh"

do_mkimage () {
    uboot-mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
                  -n "boot script" -d ${BOOTSCRIPT} ${S}/boot.scr
}

addtask mkimage after do_compile before do_install

do_compile[noexec] = "1"

do_install () {
    install -D -m 644 ${S}/boot.scr ${D}/boot.scr
}

do_deploy () {
    install -D -m 644 ${D}/boot.scr \
                      ${DEPLOYDIR}/boot.scr-${MACHINE}-${PV}-${PR}

    cd ${DEPLOYDIR}
    rm -f boot.scr-${MACHINE}
    ln -sf boot.scr-${MACHINE}-${PV}-${PR} boot.scr-${MACHINE}
}

addtask deploy after do_install before do_build

FILES_${PN} += "/"

COMPATIBLE_MACHINE = "jetson-nano"

我可以看到脚本图像正在进入work/jetson_nano_poky-linux/u-boot-tegra/2016.07.../git/ 文件夹。

但是如何在 u-boot 中使用它呢? - 我如何确保这个脚本在每次启动时自动运行?

【问题讨论】:

  • 你看过这个presentation
  • 我没有!试一试,然后返回编辑问题或给出答案,ty。
  • @Nayfe 它说要使用 mkimage 从 uboot.sh 脚本制作图像,但我该怎么做?我该怎么处理这个图像?
  • 例如你可以看看这个u-boot script recipe
  • 我添加了 uboot.sh 和 u-boot-script.bb。我刚刚将链接的 u-boot-script 更改为“uboot.sh”而不是“boot.scr”,并更改了 uboot.sh 文件中的部件号以适合我的情况。它现在正在使用 bitbake 构建,所以我们将看看它是否有效

标签: yocto u-boot nvidia-jetson nvidia-jetson-nano


【解决方案1】:

默认引导顺序的 U 引导部分尝试在其引导的第一个分区中查找名为 boot.src 的文件。 如果找到此文件,则它将尝试运行此脚本。 放入文件中的命令可以基于 RAUC 语法,因此当 RAUC 在用户空间中激活时,它可以更新相同的环境变量。 因此 RAUC 通过放入脚本文件的命令来处理引导顺序。 RAUC 无法直接改变 U Boot 启动顺序的流程

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-31
    • 2020-04-23
    • 1970-01-01
    • 1970-01-01
    • 2013-01-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多