main/postmarketos-mkinitfs: Append extra initfs hash to file contents
Partial revert of 24fa68c9 ("avoid storing initramfs-extra twice").
Some people have (rightfully) complained that including the hash in the filename of the initramfs-extra prevents the device from booting whenever the boot partition gets out of sync with the boot image.
In general we should assume that those two are in sync, but there is no need to unnecessarily break this if previously booting the outdated extra initramfs worked just fine.
At the end, the hash is just an implementation detail for the caching mechanism - we need it when (re-)generating the initramfs, but it does not have to be within the filename. Instead, we can simply append the hash to the file contents. GZIP will simply ignore the trailing garbage.
The boot partition will then look like:
$ cat /boot/initramfs-<flavor>-extra
<GZIP data>d3c7b449c6fc811d97351bbc46852b66 (the hash)
This makes the filename of initramfs-extra nice and stable again. It also fixes a regression where the initramfs-extra would no longer get symlinked by "pmbootstrap export" (I was going to fix that in pmbootstrap but now this solution is more appealing...)
While we're at it: Make the script more resilient again by writing to a temporary file first, then move it (atomically) to the real path.
Cc: @TravMurav @okias @drebrez
Merge request reports
Activity
added initramfs type::feature labels
- Resolved by Administrator
Please, revert all currect hash stuff. This is broken by design.
I propose
- keep initramfs-extra as was originally
- add hash file inside it (so 100% compatibility with anything exist)
- when hash will mismatch, print warning and boot anyway. Also print what is inside and what's expected.
P.S. also commenting because my freshly flashed Nexus 2013 worked with envkernels but when flashing original linux-asus-flo, it dies on it....
By David Heidelberg on 2020-02-25T13:58:29
Edited by Administrator
Tested-by: David Heidelberg david@ixit.cz
By David Heidelberg on 2020-02-26T13:02:12
- Resolved by Administrator
Is there some kind of test scenario to reproduce bug(s)?
whenever the boot partition gets out of sync with the boot image.
Generate new rootfs and flash it, without flashing kernel (boot.img)?
By Alexey Min on 2020-02-27T11:42:48
Edited by Ghost User
added 21 commits
-
f286eaff...23aea773 - 20 commits from branch
postmarketOS:master
- f65e9156 - main/postmarketos-mkinitfs: Append extra initfs hash to file contents
By Minecrell on 2020-02-27T18:08:02
-
f286eaff...23aea773 - 20 commits from branch
added 20 commits
-
f65e9156...820c3a3a - 19 commits from branch
postmarketOS:master
- ed3eeeee - main/postmarketos-mkinitfs: append extra initfs hash to file contents (!983 (merged))
By Oliver Smith on 2020-02-29T23:32:17
-
f65e9156...820c3a3a - 19 commits from branch
enabled an automatic merge when the pipeline for ed3eeeee succeeds
By Oliver Smith on 2020-02-29T23:32:44
mentioned in commit ed3eeeee
By Minecrell on 2020-03-10T14:57:27