Skip to content

Tegra initrd flasher fixes#1002

Merged
ricardosalveti merged 2 commits intofoundriesio:mainfrom
quaresmajose:tegra-cboot
Jan 17, 2023
Merged

Tegra initrd flasher fixes#1002
ricardosalveti merged 2 commits intofoundriesio:mainfrom
quaresmajose:tegra-cboot

Conversation

@quaresmajose
Copy link
Copy Markdown
Member

No description provided.

@quaresmajose
Copy link
Copy Markdown
Member Author

These fixes should unblock foundriesio/lmp-manifest#278

INITRAMFS_RECOVERY_IMAGE ?= ""
do_install[depends] += "virtual/kernel:do_deploy ${@['${INITRAMFS_RECOVERY_IMAGE}:do_image_complete', ''][d.getVar('INITRAMFS_RECOVERY_IMAGE') == '']}"

INITRAMFS_FSTYPES:remove:tegra = "cpio.gz.cboot"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The problem on moving to a specific recipe is that the general setting of INITRAMFS_FSTYPES via append on the bsp layer influences every initrd that gets generated by the build, and why we removed on lmp-machine-custom (via remove).

The issue:

meta-tegra/conf/machine/include/tegra234.inc:INITRAMFS_FSTYPES:append = "${@'' if d.getVar('INITRAMFS_IMAGE_BUNDLE') == '1' else ' cpio.gz.cboot cpio.gz.cboot.bup-payload'}"
meta-tegra/conf/machine/include/tegra194.inc:INITRAMFS_FSTYPES:append = "${@'' if d.getVar('INITRAMFS_IMAGE_BUNDLE') == '1' else ' cpio.gz.cboot cpio.gz.cboot.bup-payload'}"

This forces this variable to be expanded on every recipe using it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yup, and maybe the ostree-kernel-initramfs is the reason we need to remove this types on lmp-machine-custom as this recipe refuses to build with it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Right, the reason is that in LmP we don't want to build any special type of initrd for the normal rootfs, since we're booting either via UEFI or u-boot, and on both the normal type is already enough.

PREFERRED_PROVIDER_virtual/kernel:tegra ?= "linux-tegra"
IMAGE_TEGRAFLASH_FS_TYPE:sota:tegra = "ota-ext4"
INITRAMFS_FSTYPES:remove:tegra = "cpio.gz.cboot cpio.gz.cboot.bup-payload"
INITRAMFS_FSTYPES:remove:tegra = "cpio.gz.cboot.bup-payload"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can probably let as before here and create a tegra-initrd-flash-initramfs.bbappend adding what is missing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The issue with the tegra-initrd-flash-initramfs is because the image_types_tegra.bbclass expect a *.cboot initrd but as we remove here is not possible to add it again.
To add the cpio.gz.cboot only for the tegra-initrd-flash-initramfs we need a new variable here

INITRAMFS_FSTYPES_REMOVE = "cpio.gz.cboot cpio.gz.cboot.bup-payload"
INITRAMFS_FSTYPES:remove:tegra = "$INITRAMFS_FSTYPES_REMOVE"

and on the tegra-initrd-flash-initramfs.bbappend we override to don't drop the *.cboot initrd

INITRAMFS_FSTYPES_REMOVE = "cpio.gz.cboot.bup-payload"

@quaresmajose
Copy link
Copy Markdown
Member Author

Another way can be change the assignment upstream to use a weak IMAGE_TEGRAFLASH_INITRD_FLASHER ?= and in lmp change it to to use the default cpio.gz but don't know if this will work.

OE4T/meta-tegra@40b259e#diff-eba3b42a4b688730e5000092bb2b752a86b8bd73170e271e200f6f5bca97dbb9R74

@ricardosalveti
Copy link
Copy Markdown
Member

Another way can be change the assignment upstream to use a weak IMAGE_TEGRAFLASH_INITRD_FLASHER ?= and in lmp change it to to use the default cpio.gz but don't know if this will work.

I would also check with upstream if this override can be set without append, as that is what causes the issue on the first place (as append ends up affecting every recipe).

@quaresmajose
Copy link
Copy Markdown
Member Author

quaresmajose commented Jan 11, 2023

It builds with our initrd type so I will change this PR to that

diff --git a/meta-lmp-bsp/conf/machine/include/lmp-machine-custom.inc b/meta-lmp-bsp/conf/machine/include/lmp-machine-custom.inc
index 45d038d0..85c5ba57 100644
--- a/meta-lmp-bsp/conf/machine/include/lmp-machine-custom.inc
+++ b/meta-lmp-bsp/conf/machine/include/lmp-machine-custom.inc
@@ -609,6 +609,7 @@ DISTRO_FEATURES_DEFAULT:remove:tegra = "modsign"
 PREFERRED_PROVIDER_virtual/kernel:tegra ?= "linux-tegra"
 IMAGE_TEGRAFLASH_FS_TYPE:sota:tegra = "ota-ext4"
 INITRAMFS_FSTYPES:remove:tegra = "cpio.gz.cboot cpio.gz.cboot.bup-payload"
+IMAGE_TEGRAFLASH_INITRD_FLASHER:tegra = "${DEPLOY_DIR_IMAGE}/${TEGRAFLASH_INITRD_FLASH_IMAGE}-${MACHINE}.cpio.gz"
 INITRD_IMAGE:tegra = ""
 IMAGE_TEGRAFLASH_KERNEL:tegra = "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}"
 IMAGE_FSTYPES:remove:tegra = "wic wic.gz wic.bmap"

@quaresmajose quaresmajose changed the title Tegra initrd cboot fixes Tegra initrd flasher fixes Jan 11, 2023
CORE_IMAGE_BASE_INSTALL:remove:tegra = "resize-helper"
OSTREE_DEPLOY_DEVICETREE:tegra = "1"
PREFERRED_PROVIDER_virtual/optee-os:tegra = "optee-os"
#MACHINE_EXTRA_RDEPENDS:remove = "tegra-redundant-boot"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is commented out here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And it should probably be tegra specific.

tegra-redundant-boot pulls setup-nv-boot-control and the two
is installing some files in /opt that is not supported by ostree.

/opt
└── nvidia
    ├── esp
    └── l4t-bootloader-config
        └── nv-l4t-bootloader-config.sh

Signed-off-by: Jose Quaresma <[email protected]>
The image_types_tegra bbclass is using the "cboot" initrd type
in the new IMAGE_TEGRAFLASH_INITRD_FLASHER [1].
Change it to the default "cpio.gz" that is what we use.

[1] - OE4T/meta-tegra@40b259e

Signed-off-by: Jose Quaresma <[email protected]>
Copy link
Copy Markdown
Member

@ricardosalveti ricardosalveti left a comment

Choose a reason for hiding this comment

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

LGTM

@ricardosalveti ricardosalveti merged commit b16da27 into foundriesio:main Jan 17, 2023
@quaresmajose quaresmajose deleted the tegra-cboot branch January 17, 2023 14:16
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.

2 participants