Preliminary support for systemd-boot bootloader.#23
Preliminary support for systemd-boot bootloader.#23ikelos wants to merge 1 commit intorobbat2:masterfrom
Conversation
This adds preliminary support for systemd-boot using the kernel-install tool. It's dependent upon systemd pull request #11281 (systemd/systemd#11281) to work properly with initrd files. It's a little ugly because it wipes (to avoid double copying files) it wipes out the ones that genkernel has already copied to /boot, since genkernel copies those in multiple different places in the code. Ideally those would be refactored and delayed until everything had built successfully, but that was a large refactoring, so for now this adds support as is. Signed-off-by: Mike Auty <mike.auty@gmail.com>
|
@Whissi do you know if this is still needed? |
|
Well, if we want to support systemd's kernel-install tool, we need this -- at the moment we don't support that tool. But I don't like this patch. Incoming review. |
Whissi
left a comment
There was a problem hiding this comment.
In addition, documentation (longusage and man page) must be updated.
| grub2) | ||
| set_bootloader_grub2 | ||
| ;; | ||
| systemd-boot) |
There was a problem hiding this comment.
Can't we just name it "systemd"?
| } | ||
|
|
||
| set_bootloader_systemd() { | ||
|
|
| fi | ||
|
|
||
| # Clear out the mistakenly installed copies, since kernel-install copies its own versions over | ||
| # We do this first, to prevent people thinking they have enough free space but needing twice the amount |
There was a problem hiding this comment.
compile_kernel() in gen_compile.sh should be modified:
@@ -416,19 +416,24 @@ compile_kernel() {
if isTrue "${CMD_INSTALL}"
then
- copy_image_with_preserve "kernel" \
- "${tmp_kernel_binary}" \
- "kernel-${KNAME}-${ARCH}-${KV}"
+ if [ -n "${BOOTLOADER}" -a "${BOOTLOADER}" = "systemd" ]
+ then
+ print_info 1 "$(getIndent 1)Not installing kernel; systemd's kernel-install will handle installation for us!"
+ else
+ copy_image_with_preserve "kernel" \
+ "${tmp_kernel_binary}" \
+ "kernel-${KNAME}-${ARCH}-${KV}"
- copy_image_with_preserve "System.map" \
- "${systemmap}" \
- "System.map-${KNAME}-${ARCH}-${KV}"
+ copy_image_with_preserve "System.map" \
+ "${systemmap}" \
+ "System.map-${KNAME}-${ARCH}-${KV}"
- if isTrue "${GENZIMAGE}"
- then
- copy_image_with_preserve "kernelz" \
- "${tmp_kernel_binary2}" \
- "kernelz-${KV}"
+ if isTrue "${GENZIMAGE}"
+ then
+ copy_image_with_preserve "kernelz" \
+ "${tmp_kernel_binary2}" \
+ "kernelz-${KV}"
+ fi
fi
else
cp "${tmp_kernel_binary}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||There was a problem hiding this comment.
This feels like it's moving bootloader logic into the compile_kernel logic. I'm happy to do that, I just figured you'd want it all stand-alone in its own little area, so that the it doesn't set a precedent for the next bootloader that comes along to start tinkering with the internals too?
There was a problem hiding this comment.
You are right. The suggestion was based on genkernel-3, before I decided to touch so much code and create genkernel-4. Now I think we can do it correctly: But before we are able to do that we need to tackle https://bugs.gentoo.org/505810 - i.e. I'll remove install logic from compile_* to genkernel main script. In the main script we will keep something like https://github.com/gentoo/genkernel/blob/v4.0.0_beta4/genkernel#L337, adjusted of course, which will call 1set_bootloader1 when genkernel was called with --install. We will use the case statement currently used to display a warning to decide if we have to call copy_image_with_preserve or not... then, when we finally call set_bootloader, which would call kernel-install in systemd-boot case.
You get my idea?
tl;dr
Before we get back to adding systemd-boot support, I'll have to refactor install logic. :)
There was a problem hiding this comment.
Yeah, I think I follow. Just give me a prod on here when it's ready for some reworking. I'm happy to pitch in, but don't want to step on your plans... 5:)
| fi | ||
|
|
||
| # Do the call | ||
| echo "Executing: kernel-install add $KV \"${KERNEL_IMAGE}\" \"${INITRD_FILE}\"" |
There was a problem hiding this comment.
Use
print_info 2 "COMMAND: ${NICEOPTS}${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1like command to show command..
|
|
||
| # Do the call | ||
| echo "Executing: kernel-install add $KV \"${KERNEL_IMAGE}\" \"${INITRD_FILE}\"" | ||
| kernel-install add $KV "${KERNEL_IMAGE}" "${INITRD_FILE}" |
There was a problem hiding this comment.
Add error check, || gen_die "..."
This adds preliminary support for systemd-boot using the kernel-install tool. It's dependent upon systemd pull request #11281 (systemd/systemd#11281) to work properly with
initrd files.
It's a little ugly because it wipes out (to avoid double copying files) the ones that genkernel has already copied to /boot, since genkernel copies those in multiple different places in the code. Ideally those would be refactored and delayed until everything had built successfully, but that was a large refactoring, so for now this adds support as is.