[Fedora-livecd-list] Custom initrd

Mads Kiilerich mads at kiilerich.com
Wed Aug 19 23:29:51 UTC 2009


Jeremy Katz wrote, On 08/16/2009 11:25 PM:
> On Sunday, August 16 2009, Mads Kiilerich said:
>    
>> Jeremy Katz wrote, On 08/16/2009 02:14 AM:
>>      
>>>>> So if you want to do this, you have to
>>>>> do something like we did for Fedora 8 on the initial move of initramfs
>>>>> stuff into mkinitrd proper.  See commit
>>>>> 11dbd0bb5ba4b845e80109e990e4e780ca402218
>>>>>
>>>>>            
>>>> Oh yeah. livecd-creator thinks (knows) that it is creating a CD, and
>>>> thus the initrd is (has to be) in $LIVE_ROOT/isolinux/initrd0.img.
>>>>
>>>> So
>>>>       /sbin/mkinitrd -f $LIVE_ROOT/isolinux/initrd0.img $(rpm -q kernel
>>>> --qf "%{version}-%{release}.%{arch}")
>>>> in %post should do the trick? I will try that.
>>>>
>>>>          
>>> Nope -- really, look at the commit[1].  You need the two separate %post
>>> sections as it shows you; you can't do just one
>>>        
>> Ok, thanks. I'm trying to understand which parts of that commit is
>> essential to me.
>>      
> Basically all of it :)  eg, when testing mkliveinitrd changes (*sigh*),
> I use roughly that snippet plus something which grabs my hacked up
> mkliveinitrd
>    

Thanks, it works fine now. But I don't see why "all of it" should be used.

I am using something like a normal %post with

/sbin/mkinitrd -f /initrd0.img $(rpm -q kernel --qf "%{version}-%{release}.%{arch}")

and a %post --nochroot with
mv $INSTALL_ROOT/initrd0.img $LIVE_ROOT/isolinux/

- with the initrd location chosen so that no "rm -f /boot/initrd*" 
interferes.

>> Is there any particular reason why LIVE_ROOT isn't available in chroots?
>> Couldn't the image always mounted under $INSTALL_ROOT/mnt/live? Or
>> bind-mounted?
>>      
> As much as possible, we try to keep the environment consistent for %post
> scripts so they can be transferred between real system kickstarts and
> live image kickstarts.  Having things mounted differently like that
> would impact that
>    

Now I know how it works and how to work around it, so I have no problem. 
But in order to improve the system further and help the next newbie I 
will argue for some changes:

Making scripts for real installation and for live building as similar as 
possible is a fine goal. And obviously, when live image kickstarts in 
some cases needs special %post scripts then it can't be reached completely.

I think that an even more important goal is "%post environment is as 
close to runtime environment as possible". For real kickstarts "all" 
file systems mounted on runtime are mounted when %post is run too, so it 
would be consistent if the same was the case for live kickstarts. I 
realize that the runtime mount point for /dev/only (currently) only (?) 
is defined in the %post script in fedora-live-base.ks, so imgcreate 
wouldn't know where to mount it.

Another fine goal is " '%post' and '%post --nochroot' should be as 
similar as possible - except for the chroot".

In any case: Having the live root mounted somewhere specified by 
$LIVE_ROOT in all %post scripts (chroot or not) would make script 
contexts more consistent and make some things simpler (such as building 
custom initrd for F11...), and I don't see how it could have any 
negative impact on the goal of %post scripts being the same for real 
kickstart and for live image composition.

/Mads




More information about the Fedora-livecd-list mailing list