Copy vmlinuz and friends

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

Copy vmlinuz and friends

Postby xerxes2 » Nov 20th, '23, 21:27

So I finally got around to write my own installer for Cauldron, been thinking about doing it for years. I have a perfectly working basesystem-minimal now but there is one problem I can't really figure out. I'm only using systemd-boot as bootloader and it only supports fat32 so I mount a fat32 boot partition right onto /boot. I found out that the kernel wants to make symlinks to vmlinuz and its friends in /boot but afaik fat32 doesn't support symlinks. What I want is that /boot/vmlinuz should always load the latest installed kernel. Looking at the kernel builsdscripts gives clues atleast. It first runs the (old) script installkernel and after that tries to make symlinks. But this must be fixable somehow??

https://svnweb.mageia.org/packages/caul ... 8102#l1714
xerxes2
 
Posts: 62
Joined: Jul 18th, '18, 15:53
Location: Sweden

Re: Copy vmlinuz and friends

Postby doktor5000 » Nov 21st, '23, 00:26

systemd-boot is a UEFI bootmanager so this is basically only for /boot/EFI which must be a FAT filesystem.
But kernel and initrd are not located in /boot/EFI so I don't really understand your question.

It might help if you would add some context information what your installer should actually do, or what your use case is.

If you really want to write your own installer it would probably be a good idea to base it on some versatile framework, as e.g. https://calamares.io/
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18054
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Copy vmlinuz and friends

Postby xerxes2 » Nov 21st, '23, 00:44

Systemd-boot only supports fat32 that is why I mount the boot partition at /boot. But fat32 does not support symlinks so Mageias default kernel install doesn't work.

Installer works fine, except for that the symlink to /boot/vmlinuz dosn't work because it's fat32. This is a kernel package problem which I haven't figured out how to solve yet. Now the installer just makes a copy of the vmlinuz but it should not be needed if the kernel package supported this or if there exist some other setting that fixes the problem. Look at /usr/sbin/installkernel but I don't think the kernel package supports it anyway because the symlinks are hardcoded in the kernel buildscript.
Last edited by xerxes2 on Nov 22nd, '23, 19:22, edited 1 time in total.
xerxes2
 
Posts: 62
Joined: Jul 18th, '18, 15:53
Location: Sweden

Re: Copy vmlinuz and friends

Postby xerxes2 » Nov 22nd, '23, 19:09

Ok so I managed to somehow solve this problem but it's ugly. By appending this line to /etc/sysconfig/installkernel , /boot/vmlinuz is a copy of the latest installed kernel.

Code: Select all
cp "/boot/vmlinuz-${1}" /boot/vmlinuz


But that is ugly and I would like to have something like this instead in /etc/sysconfig/installkernel .

Code: Select all
# 0 for no copies/symlinks, 1 for copies, 2 for symlinks
USECOPY=1


And then add something like this in /sbin/installkernel.

Code: Select all
if [ $USECOPY = 1 ]; then
  echo "Make copies in /boot"
  cp vmlinuz-${1} vmlinuz-${2}
  cp vmlinuz-${1} vmlinuz
  if [ -e initrd-${1}.img ]; then
    cp initrd-${1}.img initrd-${2}.img
    cp initrd-${1}.img initrd.img
  fi
elif [ $USECOPY = 2 ]; then
  echo "Make symlinks in /boot"
  ln -sf vmlinuz-${1} vmlinuz-${2}
  ln -sf vmlinuz-${1} vmlinuz
  if [ -e initrd-${1}.img ]; then
    ln -sf initrd-${1}.img initrd-${2}.img
    ln -sf initrd-${1}.img initrd.img
  fi
fi


And force the kernel to actually use that script for all symlinking and copying in /boot.
xerxes2
 
Posts: 62
Joined: Jul 18th, '18, 15:53
Location: Sweden

Re: Copy vmlinuz and friends

Postby xerxes2 » Nov 25th, '23, 00:43

Was it a good idea? Yesterday I was going to suggest an option for choosing to use initrd or not like this.

Code: Select all
# 0 for no initrd, 1 for generating initrd
USEINITRD=1


But today I found out that it already exists. It's just a bit hidden. But it's possible to use NOINITRD option in /etc/sysconfig/installkernel already. Tried it and it works.
xerxes2
 
Posts: 62
Joined: Jul 18th, '18, 15:53
Location: Sweden


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest

cron