<div dir="auto">Unfortunately there's no ready made answer yet here. We're busy designing and implementing a solution for these problems. <a href="https://github.com/systemd/systemd/pull/27792">https://github.com/systemd/systemd/pull/27792</a> has more details.<div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto"><br></div><div dir="auto">Daan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 18 Aug 2023, 19:44 Nils Kattenbeck, <<a href="mailto:nilskemail@gmail.com">nilskemail@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
currently I am building a minimalistic Linux image using mkosi which<br>
should be installed on bare-metal hardware.<br>
For the installation I am trying to create a USB-stick installer which<br>
simply installs the resulting image on the hardware.<br>
<br>
First and foremost:<br>
Does someone maybe know of an existing tool which generates such a USB<br>
installer?<br>
For now I have found the installer script[1] from Yocto, and FAI<br>
(Fully automatic installation)[2].<br>
I would like to avoid using Yocto and the script seems to also perform<br>
partitioning etc. which I do not need as mkosi already generates a<br>
ready-to-use raw disk image with partitions set up.<br>
FAI on the other hand seems to focus on network installs and prefers<br>
to build its own images instead of using an arbitrary .raw/ISOs.<br>
<br>
So I fear that I will have to write my own installer...<br>
I do not require fancy GUI shenanigans; a simple CLI application<br>
prompting for the destination disk should suffice.<br>
<br>
Based on my understanding the primary steps are `cp /dev/usb-stick<br>
/dev/target-disk` (or dd for the old fashioned), followed by a `parted<br>
--script --fix /dev/target-disk print` to resolve GPT warnings due to<br>
the header not being at the end when the disk is larger than the USB<br>
stick.<br>
Is it possible to replace the second step with `systemd-parted`.<br>
Especially given that mkosi v15 now uses it for itself, this would<br>
likely be a lot cleaner than invoking parted.<br>
<br>
The major problem I am facing with that approach is how do I know<br>
whether I am booting from a USB stick or already from the final disk<br>
drive.<br>
One technique which comes to mind would be to create two images, one<br>
of which will be placed into the mkosi.extra/ directory of the other.<br>
This way I could have one auto-start the install script whereas the<br>
other image would be completely free of that logic.<br>
Am I missing a more obvious way to perform this?<br>
<br>
Any help would be greatly appreciated!<br>
Kind regard, Nils<br>
<br>
[1] <a href="https://github.com/yoctoproject/poky/blob/13734bb520732882a95da7ee6efe1e5b98568acc/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb" rel="noreferrer noreferrer" target="_blank">https://github.com/yoctoproject/poky/blob/13734bb520732882a95da7ee6efe1e5b98568acc/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb</a><br>
[2] <a href="https://fai-project.org/" rel="noreferrer noreferrer" target="_blank">https://fai-project.org/</a><br>
</blockquote></div>