Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAVQP-30: re-work reliable upgrade support as an image feature #45

Open
wants to merge 1 commit into
base: imx-5.15.32-vb
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/board/voxelbotics/navqp/navqp.c b/board/voxelbotics/navqp/navqp.c
index e1232aacca..01ec173423 100644
--- a/board/voxelbotics/navqp/navqp.c
+++ b/board/voxelbotics/navqp/navqp.c
@@ -550,7 +550,15 @@ int board_init(void)
int board_late_init(void)
{
#ifdef CONFIG_ENV_IS_IN_MMC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of hard-coding partitioning into the code?
Also, if we do boot1/root1/boot2/root2 partitioning this code may not be required?

+ char mmcblk[32];
+ u32 dev_no = mmc_get_env_dev();
+ /* rootfs partition number is boot partition + 2 for reliable upgrade */
+ int part = env_get_ulong("mmcpart", 10, 1) + 2;
+
board_late_mmc_env_init();
+ sprintf(mmcblk, "/dev/mmcblk%dp%d rootwait rw",
+ mmc_map_to_kernel_blk(dev_no), part);
+ env_set("mmcroot", mmcblk);
#endif
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
env_set("board_name", "EVK");
2 changes: 2 additions & 0 deletions recipes-bsp/u-boot/u-boot-imx_2022.04.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/u-boot-imx:"

SRC_URI = "git://github.com/voxelbotics/u-boot-imx.git;protocol=https;branch=imx-5.15.32-vb"

SRC_URI:append = " ${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'navq-swupdate', 'file://001-reliable_update_mmcroot_setup.patch', '', d)} "

SRCREV = "${AUTOREV}"
34 changes: 14 additions & 20 deletions recipes-core/images/files/sw-description
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ software =
partitions: (
{
type = "diskformat";
device = "/dev/mmcblk2p1";
device = "@@SWU_STG_DEV@@p1";

properties: {
fstype = "vfat";
Expand All @@ -19,7 +19,7 @@ software =
},
{
type = "diskformat";
device = "/dev/mmcblk2p3";
device = "@@SWU_STG_DEV@@p3";

properties: {
fstype = "ext4";
Expand All @@ -33,15 +33,15 @@ software =
filename = "@@SWU_UBOOT_FILE@@";
version = "@@SWU_UBOOT_VERSION@@";
install-if-different = true;
device = "/dev/mmcblk2";
device = "@@SWU_STG_DEV@@";
offset = "32K";
sha256 = "$swupdate_get_sha256(@@SWU_UBOOT_FILE@@)";
}
);
files: (
{
filename = "Image";
device = "/dev/mmcblk2p1";
device = "@@SWU_STG_DEV@@p1";
path = "/Image";
filesystem = "vfat";
preserve-attributes = true;
Expand All @@ -50,7 +50,7 @@ software =
},
{
filename = "@@KERNEL_DEVICETREE_BASENAME@@.dtb";
device = "/dev/mmcblk2p1";
device = "@@SWU_STG_DEV@@p1";
path = "/@@KERNEL_DEVICETREE_BASENAME@@.dtb";
filesystem = "vfat";
preserve-attributes = true;
Expand All @@ -60,9 +60,10 @@ software =
{
filename = "@@SWU_ROOTFS_FILE@@";
type = "archive";
device = "/dev/mmcblk2p3";
device = "@@SWU_STG_DEV@@p3";
path = "/";
filesystem = "ext4";
installed-directly = true;
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(@@SWU_ROOTFS_FILE@@)";

Expand All @@ -73,18 +74,14 @@ software =
name = "mmcpart";
value = "1";
},
{
name = "mmcroot";
value = "/dev/mmcblk2p3 rootwait rw";
},
);
};
copy2:
{
partitions: (
{
type = "diskformat";
device = "/dev/mmcblk2p2";
device = "@@SWU_STG_DEV@@p2";

properties: {
fstype = "vfat";
Expand All @@ -93,7 +90,7 @@ software =
},
{
type = "diskformat";
device = "/dev/mmcblk2p4";
device = "@@SWU_STG_DEV@@p4";

properties: {
fstype = "ext4";
Expand All @@ -107,15 +104,15 @@ software =
filename = "@@SWU_UBOOT_FILE@@";
version = "@@SWU_UBOOT_VERSION@@";
install-if-different = true;
device = "/dev/mmcblk2";
device = "@@SWU_STG_DEV@@";
offset = "32K";
sha256 = "$swupdate_get_sha256(@@SWU_UBOOT_FILE@@)";
}
);
files: (
{
filename = "Image";
device = "/dev/mmcblk2p2";
device = "@@SWU_STG_DEV@@p2";
path = "/Image";
filesystem = "vfat";
preserve-attributes = true;
Expand All @@ -124,7 +121,7 @@ software =
},
{
filename = "@@KERNEL_DEVICETREE_BASENAME@@.dtb";
device = "/dev/mmcblk2p2";
device = "@@SWU_STG_DEV@@p2";
path = "/@@KERNEL_DEVICETREE_BASENAME@@.dtb";
filesystem = "vfat";
preserve-attributes = true;
Expand All @@ -134,9 +131,10 @@ software =
{
filename = "@@SWU_ROOTFS_FILE@@";
type = "archive";
device = "/dev/mmcblk2p4";
device = "@@SWU_STG_DEV@@p4";
path = "/";
filesystem = "ext4";
installed-directly = true;
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(@@SWU_ROOTFS_FILE@@)";
}
Expand All @@ -146,10 +144,6 @@ software =
name = "mmcpart";
value = "2";
},
{
name = "mmcroot";
value = "/dev/mmcblk2p4 rootwait rw";
},
);
};
};
Expand Down
11 changes: 8 additions & 3 deletions recipes-core/images/navq-rootfs.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SECTION = ""
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

IMAGE_FSTYPES = "tar.bz2"
IMAGE_FSTYPES = "tar.bz2 wic.bz2"

include recipes-core/images/core-image-minimal.bb

Expand All @@ -18,13 +18,18 @@ IMAGE_INSTALL:append = " \
navq-wpa-supplicant \
usb-gadgets-mtp1 \
openssh \
opkg \
${@bb.utils.contains('PACKAGE_CLASSES', 'package_ipk', 'opkg', '', d)} \
${@bb.utils.contains('PACKAGE_CLASSES', 'package_rpm', 'rpm', '', d)} \
"

FEATURE_PACKAGES_navq-swupdate = " \
swupdate \
e2fsprogs \
dosfstools \
libgcc \
u-boot-imx-env \
libubootenv-bin \
libubootenv \
${@bb.utils.contains('PACKAGE_CLASSES', 'package_rpm', 'rpm', '', d)} \
"

WKS_FILE := " ${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'navq-swupdate', 'imx8mpnavq-emmc-swupdate-minimal.wks.in', '${WKS_FILE}', d)}"
6 changes: 6 additions & 0 deletions recipes-core/images/navq-swu.bb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SRC_URI = " \
SWU_VERSION = "${NAVQ_DISTRO_VERSION}"

SWU_ROOTFS = "navq-rootfs"
SWU_STG_DEV = "/dev/mmcblk2"

SWU_ROOTFS_FILE = "${SWU_ROOTFS}-${MACHINE}.tar.bz2"
SWU_UBOOT_FILE = "imx-boot"
Expand All @@ -31,3 +32,8 @@ SWUPDATE_IMAGES = "${SWU_ROOTFS} ${SWU_UBOOT_FILE} ${SWU_KERNEL_FILE} ${SWU_DTB_
SWUPDATE_IMAGES_FSTYPES[navq-rootfs] = "-${MACHINE}.tar.bz2"

inherit swupdate

python () {
if not bb.utils.contains('EXTRA_IMAGE_FEATURES', 'navq-swupdate', True, False, d):
bb.fatal("EXTRA_IMAGE_FEATURES must include 'navq-swupdate' for .swu build")
}
151 changes: 151 additions & 0 deletions recipes-fsl/images/files/sw-description
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
software =
{
version = "@@SWU_VERSION@@";
hardware-compatibility: [ "@@SWU_HWCOMPAT@@" ];
@@SWU_BOARD@@ = {
stable:
{
copy1:
{
partitions: (
{
type = "diskformat";
device = "@@SWU_STG_DEV@@p1";

properties: {
fstype = "vfat";
force = "true";
}
},
{
type = "diskformat";
device = "@@SWU_STG_DEV@@p3";

properties: {
fstype = "ext4";
force = "true";
}
}
);
images: (
{
name = "bootloader";
filename = "@@SWU_UBOOT_FILE@@";
version = "@@SWU_UBOOT_VERSION@@";
install-if-different = true;
device = "@@SWU_STG_DEV@@";
offset = "32K";
sha256 = "$swupdate_get_sha256(@@SWU_UBOOT_FILE@@)";
}
);
files: (
{
filename = "Image";
device = "@@SWU_STG_DEV@@p1";
path = "/Image";
filesystem = "vfat";
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(Image)";

},
{
filename = "@@KERNEL_DEVICETREE_BASENAME@@.dtb";
device = "@@SWU_STG_DEV@@p1";
path = "/@@KERNEL_DEVICETREE_BASENAME@@.dtb";
filesystem = "vfat";
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(@@KERNEL_DEVICETREE_BASENAME@@.dtb)";

},
{
filename = "@@SWU_ROOTFS_FILE@@";
type = "archive";
device = "@@SWU_STG_DEV@@p3";
path = "/";
filesystem = "ext4";
installed-directly = true;
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(@@SWU_ROOTFS_FILE@@)";

}
);
bootenv: (
{
name = "mmcpart";
value = "1";
},
);
};
copy2:
{
partitions: (
{
type = "diskformat";
device = "@@SWU_STG_DEV@@p2";

properties: {
fstype = "vfat";
force = "true";
}
},
{
type = "diskformat";
device = "@@SWU_STG_DEV@@p4";

properties: {
fstype = "ext4";
force = "true";
}
}
);
images: (
{
name = "bootloader";
filename = "@@SWU_UBOOT_FILE@@";
version = "@@SWU_UBOOT_VERSION@@";
install-if-different = true;
device = "@@SWU_STG_DEV@@";
offset = "32K";
sha256 = "$swupdate_get_sha256(@@SWU_UBOOT_FILE@@)";
}
);
files: (
{
filename = "Image";
device = "@@SWU_STG_DEV@@p2";
path = "/Image";
filesystem = "vfat";
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(Image)";

},
{
filename = "@@KERNEL_DEVICETREE_BASENAME@@.dtb";
device = "@@SWU_STG_DEV@@p2";
path = "/@@KERNEL_DEVICETREE_BASENAME@@.dtb";
filesystem = "vfat";
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(@@KERNEL_DEVICETREE_BASENAME@@.dtb)";

},
{
filename = "@@SWU_ROOTFS_FILE@@";
type = "archive";
device = "@@SWU_STG_DEV@@p4";
path = "/";
filesystem = "ext4";
installed-directly = true;
preserve-attributes = true;
sha256 = "$swupdate_get_sha256(@@SWU_ROOTFS_FILE@@)";
}
);
bootenv: (
{
name = "mmcpart";
value = "2";
},
);
};
};
};
}
Loading