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

tegra: support creating wic images along with tegraflash #1083

Merged
merged 14 commits into from
Mar 29, 2023

Conversation

ricardosalveti
Copy link
Member

No description provided.

@ricardosalveti ricardosalveti requested review from caiotpereira, a team and Tim-Anderson March 27, 2023 18:42
Copy link
Member

@quaresmajose quaresmajose left a comment

Choose a reason for hiding this comment

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

LGTM, maybe one day we could switch from the resize-helper script to systemd-repart that can automatically grow and add partitions

@ricardosalveti
Copy link
Member Author

LGTM, maybe one day we could switch from the resize-helper script to systemd-repart that can automatically grow and add partitions

Only when it supports MBR and after we support systemd in the initrd.

When ID_PART_ENTRY_NAME is available it was returning the full string
and not going over cut, due the || true assignment.

Signed-off-by: Ricardo Salveti <[email protected]>
Avoid manipulating the partition table to try to extend the size of
rootfs when it is not the last partition from the block device.

When rootfs is not the last we can assume that the partition table is
correct and just try to resize the file system instead.

Signed-off-by: Ricardo Salveti <[email protected]>
Resize-helper is now able to handle devices with known and fixed
partition table, and when the rootfs is not the last partition used by
the system.

Signed-off-by: Ricardo Salveti <[email protected]>
So it can be consumed when generating wic images.

Signed-off-by: Ricardo Salveti <[email protected]>
Used by tegra targets, without any special config, just the standard
boot efi loader.

Signed-off-by: Ricardo Salveti <[email protected]>
Wic image can be used when flashing an external storage device, instead
of using tegraflasher.

Signed-off-by: Ricardo Salveti <[email protected]>
Set IMAGE_ROOTFS_SIZE to the default size (65536) otherwise the tegra
layer will replace the variable with the size available in the emmc
device, which can be quite large.

We don't need the fs to be the exact partition size as we now have
resize-helper which can extend the fs dynamically up to the limit of the
partition on first run.

Signed-off-by: Ricardo Salveti <[email protected]>
Besides setting up the fs label, also set the partition name to otaroot,
a a way to help bootloaders identifying the partition used by the
ota-based rootfs.

Signed-off-by: Ricardo Salveti <[email protected]>
Prefer using label for the rootfs instead of the fixed mmc partition
number in order to allow using the rootfs on external devices (e.g. usb,
sata, etc).

Signed-off-by: Ricardo Salveti <[email protected]>
Support looking for otaroot named partitions when booting via
l4tlauncher and also disable a/b rootfs support as that is not used in
LmP and causes the device to jump into recovery when not needed.

Signed-off-by: Ricardo Salveti <[email protected]>
Allow integrating and flashing an external wic image for the rootfs.

Signed-off-by: Ricardo Salveti <[email protected]>
Useful when flashing the rootfs on an external device and avoiding
conflicts with the previous rootfs flashed in the emmc rootfs partition.

Signed-off-by: Ricardo Salveti <[email protected]>
Import initrd-flash.sh script from meta-tegra rev e132ae1186fd.

Additional customizations to follow in separated commits.

Signed-off-by: Ricardo Salveti <[email protected]>
Update initrd-flash.sh script to add support for formatting emmc
partitions and flash wic images on external devices via bmaptool.

User can enable external wic flashing support via:
- TEGRAFLASH_ROOTFS_EXTERNAL=1
- TEGRA_EXTERNAL_ROOTFS_WIC=1
- ROOTFS_DEVICE_FOR_INITRD_FLASH=<device>, like nvme0n1

Signed-off-by: Ricardo Salveti <[email protected]>
@ricardosalveti
Copy link
Member Author

ricardosalveti commented Mar 29, 2023

Tested by adding the following to conf/local.conf (or conf/machine/include/lmp-factory-custom.inc on a factory):

TEGRAFLASH_ROOTFS_EXTERNAL:jetson-agx-xavier-devkit = "1"
TEGRA_EXTERNAL_ROOTFS_WIC:jetson-agx-xavier-devkit = "1"
ROOTFS_DEVICE_FOR_INITRD_FLASH:jetson-agx-xavier-devkit = "nvme0n1"

Flashing:

tar -xvf lmp-factory-image-jetson-agx-xavier-devkit.tegraflash.tar.gz
sudo ./initrd-flash --format-mmc-part=mmcblk0p1

If you want to use a different wic (e.g. from a different job run), just download and replace the local lmp-factory-image.wic.gz file.

@ricardosalveti
Copy link
Member Author

@MrCry0 @quaresmajose mind having another look? added the initrd related patches, thanks!

Copy link
Member

@quaresmajose quaresmajose left a comment

Choose a reason for hiding this comment

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

LGTM. The tegra-flash-init and the tegra-helper-scripts look appropriate to submit to meta-tegra, should I do that?

Copy link
Contributor

@MrCry0 MrCry0 left a comment

Choose a reason for hiding this comment

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

Still LGTM

@ricardosalveti
Copy link
Member Author

@quaresmajose sure, it would be good to check what is nvidia bsp / jetpack and what is meta-tegra specific there, and propose the changes, as it should indeed be generic. Please have a look and let me know if you need a hand in there.

@ricardosalveti ricardosalveti merged commit 1ffce71 into foundriesio:main Mar 29, 2023
@quaresmajose
Copy link
Member

@quaresmajose sure, it would be good to check what is nvidia bsp / jetpack and what is meta-tegra specific there, and propose the changes, as it should indeed be generic. Please have a look and let me know if you need a hand in there.

Ok, I will do that.

quaresmajose pushed a commit to quaresmajose/meta-tegra that referenced this pull request Sep 5, 2023
So it can be consumed when generating wic images.

foundriesio/meta-lmp#1083

Signed-off-by: Ricardo Salveti <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
quaresmajose pushed a commit to quaresmajose/meta-tegra that referenced this pull request Sep 5, 2023
Useful when flashing the rootfs on an external device and avoiding
conflicts with the previous rootfs flashed in the emmc rootfs partition.

foundriesio/meta-lmp#1083

Signed-off-by: Ricardo Salveti <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
quaresmajose pushed a commit to quaresmajose/meta-tegra that referenced this pull request Sep 5, 2023
Update initrd-flash.sh script to add support for formatting emmc
partitions and flash wic images on external devices via bmaptool.

User can enable external wic flashing support via:
- TEGRAFLASH_ROOTFS_EXTERNAL=1
- TEGRA_EXTERNAL_ROOTFS_WIC=1
- ROOTFS_DEVICE_FOR_INITRD_FLASH=<device>, like nvme0n1

foundriesio/meta-lmp#1083

Signed-off-by: Ricardo Salveti <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
quaresmajose pushed a commit to quaresmajose/meta-tegra that referenced this pull request Sep 5, 2023
Allow integrating and flashing an external wic image for the rootfs.

foundriesio/meta-lmp#1083

Signed-off-by: Ricardo Salveti <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
quaresmajose pushed a commit to quaresmajose/meta-tegra that referenced this pull request Sep 6, 2023
So it can be consumed when generating wic images.

foundriesio/meta-lmp#1083

Signed-off-by: Ricardo Salveti <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
quaresmajose pushed a commit to quaresmajose/meta-tegra that referenced this pull request Sep 6, 2023
Update initrd-flash.sh script to add support for formatting emmc
partitions and flash wic images on external devices via bmaptool.

User can enable external wic flashing support via:
- TEGRAFLASH_ROOTFS_EXTERNAL=1
- TEGRA_EXTERNAL_ROOTFS_WIC=1
- ROOTFS_DEVICE_FOR_INITRD_FLASH=<device>, like nvme0n1

foundriesio/meta-lmp#1083

Signed-off-by: Ricardo Salveti <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
quaresmajose pushed a commit to quaresmajose/meta-tegra that referenced this pull request Sep 6, 2023
Allow integrating and flashing an external wic image for the rootfs.

foundriesio/meta-lmp#1083

Signed-off-by: Ricardo Salveti <[email protected]>
Signed-off-by: Jose Quaresma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants