You are not logged in.

#1 2019-11-13 19:34:36

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 116

[SOLVED] Custom mkinitcpio image

Hello, before the recent changes to mkinitcpio I was able to easily build a custom initramfs image during pacman kernel update by just adding a custom hook into the /usr/share/libalpm/hooks/ path. It kept using a custom /etc/mkinitcpio-custom.conf with a radeon module included into the image. After last update things seem to get more complicated and I can't figure out what kind of hook should be used to make pacman build a custom image. Modifing /usr/share/mkinitcpio/hook.preset doesnt work:

# mkinitcpio preset file for the '%PKGBASE%' package

ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-%PKGBASE%"

PRESETS=('default' 'fallback' 'radeon')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-%PKGBASE%.img"
#default_options=""

radeon_config="/etc/mkinitcpio-custom.conf"
radeon_image="/boot/radeon-%PKGBASE%-custom.img"
fallback_image="/boot/initramfs-%PKGBASE%-fallback.img"
fallback_options="-S autodetect"

I'm kinda newbie in scripting and still learn. Could anybody point me how to resolve this issue? Thanks.

Last edited by Al.Piotrowicz (2020-02-26 17:20:52)

Offline

#2 2019-11-13 22:05:21

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Custom mkinitcpio image

The hook you are using no longer works and as you have not posted it should I assume you have abandoned it?
You modified /usr/share/mkinitcpio/hook.preset (which will be overwritten by the next update to mkinitcpio)
then how did you trigger 90-mkinitcpio-install.hook to install / update that as /etc/mkinitcpio.d/${pkgbase}.preset ?

Offline

#3 2019-11-13 22:13:57

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 116

Re: [SOLVED] Custom mkinitcpio image

Not quite sure what you mean, but my /etc/mkinitcpio.d/ path has the required presets:

-rw-r--r--   1 root root  380 2019-03-30  linux-initramfs-radeon.preset
-rw-r--r--   1 root root  391 11-11 22:23 linux-lts.preset
-rw-r--r--   1 root root  375 11-11 22:23 linux.preset

Yes I abandoned it and I know it will be overwritten by the next update, but it doesn't work as intended so I don't care about it. It was just a copy of the regular 90-linux.hook with modified mkinitcpio.conf and /boot/%custom%.img, nothing fancy was there at all. During pacman kernel update 90-mkinitcpio-install.hook worked well for both kernels (mainline and lts), but it didn't build my custom (radeon within) image.

Offline

#4 2019-11-13 22:38:58

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Custom mkinitcpio image

The system has two kernels linux and linux-lts and you want each kernel to have three initrds default,  fallback and  radeon.

For the above if you add your changes back to linux-lts.preset and linux.preset then update one of the kernel packages are the changes preserved?

Offline

#5 2019-11-13 22:44:49

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 116

Re: [SOLVED] Custom mkinitcpio image

The system has two kernels linux and linux-lts and you want each kernel to have three initrds default,  fallback and  radeon.

No, I want only one (radeon-built-in) initrd built from the mainline. That's all.

For the above if you add your changes back to linux-lts.preset and linux.preset then update one of the kernel packages are the changes preserved?

Yes, it will preserve but that's not my purpose. I just want to "force" mkinitcpio to build one additional initrd from the mainline linux containing a radeon module.

Offline

#6 2019-11-13 22:52:32

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Custom mkinitcpio image

If you do not need the initrd generated by the custom preset to be updated on package update could you not keep linux-initramfs-radeon.preset ?
Otherwise I believe you will need a custom hook for the custom preset.

Offline

#7 2019-11-13 22:55:47

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 116

Re: [SOLVED] Custom mkinitcpio image

Yes, its pointless having it in the /etc/mkinitcpio.d/ path. It's not being parsed by the 90-mkinitcpio-install.hook. Could you narrow me how to create the custom preset to be updated on package update? I'd appreciate it.

Last edited by Al.Piotrowicz (2019-11-13 22:57:32)

Offline

#8 2019-11-13 23:53:09

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Custom mkinitcpio image

I can try and write a hook just need some more information first:
The current /usr/share/libalpm/hooks/90-mkinitcpio-install.hook using /usr/share/libalpm/scripts/mkinitcpio-install will call mkinitcpio -P when the update is called because of usr/lib/initcpio/*
Is that behavior what you want?
If so  the custom hook just needs to cover the update of usr/lib/modules/$pkgbase/vmlinuz where $pkgbase would be the kernel name you want the preset to trigger on.
By mainline do you mean the linux-mainline from AUR which tracks Linus's tree linux or the linux package from from core that tracks stable or something else?
For the custom case it would be simpler to not use a template then copy it into /etc/mkinitcpio.d/ just have the hook call mkinitcpio for that hook on match.
Does the above describe your needs?

Offline

#9 2019-11-13 23:59:44

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 116

Re: [SOLVED] Custom mkinitcpio image

Yes, that's correct @loqs. I used a "mainline" for mistake, cause I messed with it in the past. I meant the stable linux-core package in this topic. Sorry for the confusion.

Offline

#10 2019-11-14 00:11:25

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [SOLVED] Custom mkinitcpio image

I wonder, why don't you just add your additional configuration to linux.preset? This file is not modified automatically if it exists.

Last edited by progandy (2019-11-14 00:12:36)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#11 2019-11-14 00:23:56

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 116

Re: [SOLVED] Custom mkinitcpio image

I need to have both @progandy (with and without the radeon module) due to some testing I perform with my buggy mobo bios issue posted here

Offline

#12 2019-11-14 07:30:51

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [SOLVED] Custom mkinitcpio image

Yes? Doesn't this work as linux.preset?

# mkinitcpio preset file for the 'linux' package
  
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"

PRESETS=('default' 'fallback' 'radeon')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux.img"
#default_options=""

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-linux-fallback.img"
fallback_options="-S autodetect"


radeon_config="/etc/mkinitcpio-custom.conf"
radeon_image="/boot/radeon-linux-custom.img"

Last edited by progandy (2019-11-14 07:31:17)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#13 2020-02-02 21:48:06

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 116

Re: [SOLVED] Custom mkinitcpio image

Yes, work as intended, thank you.

Offline

#14 2020-02-03 09:57:29

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,657

Re: [SOLVED] Custom mkinitcpio image

Please mark as [SOLVED] by editing the title in your first post.

Offline

Board footer

Powered by FluxBB