Comment 2 for bug 2045914

Revision history for this message
ZhangXiao (zhangxiao-windriver) wrote :

Workaround:
Step1) Check the boot checksum order:
Checkout files from ostree repo's "usr/lib/ostree--boot", then check to see the order that calculate the checksum, for example:
$ostree --repo=/localdisk/deploy/ostree_repo ls starlingx /usr/lib/ostree-boot
d02755 0 751 0 /usr/lib/ostree-boot
00644 0 751 0 /usr/lib/ostree-boot/.ostree-bootcsumdirsource
-00644 0 751 179190353 /usr/lib/ostree-boot/initramfs-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a
-00644 0 751 589 /usr/lib/ostree-boot/initramfs.sig
-00644 0 751 1134 /usr/lib/ostree-boot/kernel.env
-00644 0 751 11035264 /usr/lib/ostree-boot/vmlinuz-5.10.0-6-amd64
-00644 0 751 589 /usr/lib/ostree-boot/vmlinuz-5.10.0-6-amd64.sig
-00644 0 751 9707040 /usr/lib/ostree-boot/vmlinuz-5.10.0-6-rt-amd64
-00644 0 751 589 /usr/lib/ostree-boot/vmlinuz-5.10.0-6-rt-amd64.sig
-00644 0 751 11035264 /usr/lib/ostree-boot/vmlinuz-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a
-00644 0 751 589 /usr/lib/ostree-boot/vmlinuz.sig
d00755 0 0 0 /usr/lib/ostree-boot/efi
[yow-wrcp-lx:2023-07-18_15-57-53]$files="/usr/lib/ostree-boot/initramfs-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a /usr/lib/ostree-boot/vmlinuz-5.10.0-6-amd64 /usr/lib/ostree-boot/vmlinuz-5.10.0-6-rt-amd64 /usr/lib/ostree-boot/vmlinuz-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a"
[yow-wrcp-lx:2023-07-18_15-57-53]$for f in $files; do ostree --repo=/localdisk/deploy/ostree_repo cat starlingx $f > `basename $f`; done
[yow-wrcp-lx:2023-07-18_15-57-53]$ls -l
total 206032
rw-rr- 1 xzhang1 users 179190353 Nov 29 03:48 initramfs-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a
rw-rr- 1 xzhang1 users 11035264 Nov 29 03:48 vmlinuz-5.10.0-6-amd64
rw-rr- 1 xzhang1 users 9707040 Nov 29 03:48 vmlinuz-5.10.0-6-rt-amd64
rw-rr- 1 xzhang1 users 11035264 Nov 29 03:48 vmlinuz-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a
[yow-wrcp-lx:2023-07-18_15-57-53]$cat vmlinuz-5.10.0-6-amd64 vmlinuz-5.10.0-6-rt-amd64 vmlinuz-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a initramfs-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a | sha256sum
fc48becbf32bca385d60301d0eff4be3714b9ae08233817e8ceae9726fb22f60 -
[yow-wrcp-lx:2023-07-18_15-57-53]$cat vmlinuz-5.10.0-6-rt-amd64 vmlinuz-5.10.0-6-amd64 vmlinuz-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a initramfs-b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a | sha256sum
b4aba956ef0d78b5fa1777d215df37fdf8b2418cd8405edcb5ff88e51190e21a -

Compare the sha256sum value and the suffix of the initramfs file. For the example above, we can see the order is rt kernel-> standard kernel -> vmlinuz -> initrd

Step2)
A: If the order is: standard kernel-> rt kernel -> vmlinuz -> initrd.
Just make patch as usual.

B: If the order is: rt kernel-> standard kernel -> vmlinuz -> initrd
Modify make_patch.py to fit for the ostree repo above:
$stx shell --container lat
root@stx-stx-lat-tool-ffb668489-7d2sj:/# cd $PATCH_TOOLS
root@stx-stx-lat-tool-ffb668489-7d2sj:/localdisk/designer/xzhang1/stx/cgcs-root/stx/update/sw-patch/cgcs-patch/cgcs_make_patch# vim make_patch.py
Here below is piece of "make_patch.py"

417 # Order: std, rt, vmlinuz, initramfs
418 cmd = " ".join(["cat", kernel_file, kernel_rt_file, vmlinuz_file, initramfs_file, "| sha256sum | cut -d' ' -f 1"])

We can see the order is stable as std->rt->vmlinuz->initrd. To align with original ISO, we have to change it to rt->std->vmlinuz->initrd. So modify line 418 as below:

418 cmd = " ".join(["cat", kernel_rt_file, kernel_file, vmlinuz_file, initramfs_file, "| sha256sum | cut -d' ' -f 1"])

Then move on to build Debian patch.