Re: dracut - help!

Thanos Baloukas <[email protected]> Fri, 24 Feb 2017 21:20:41 +0200
Newsgroups gmane.linux.lfs.general
Message-ID <[email protected]>
On 24/02/2017 08:51 πμ, Linuxero wrote:
> On 2017-02-23 20:08, Thanos Baloukas wrote:
>> On 23/02/2017 07:25 μμ, Thanos Baloukas wrote:
>>> On 23/02/2017 02:59 μμ, Linuxero wrote:
>>>> Hi everybody;
>>>>
>>>> I have finished the latest development systemd LFS book. I have NVME
>>>> disks in my machine and the LFS partition is a GUID one. I
>>>> configured my
>>>> kernel and it boot well if I compile the NVME drivers built-in.
>>>> However,
>>>> I wanted to compile NVME as loadable modules. I installed dracut and
>>>> tried to create an initrd. Actually, the initrd is well, but for some
>>>> strange reason I am always dropped to dracut emergency shell as the
>>>> partition can not be found.
>>>>
>>>> Dracut version is 044. The emergency shell is unusable, as if the
>>>> system
>>>> were halted.
>>>>
>>>> Any suggestion about dracut with LFS/BLFS?
>>>>
>>>> Thanks in advance,
>>>>
>>> Are there any messages? Are the 'linux' and 'root=UUID='
>>> entries in grub.cfg correct? Could it be that there is not
>>> /etc/os-release? I recall that it would not switch root
>>> if it did not exist.
>>>
>> You said you are using GUID (I'm getting that as GPT partition table).
>> I have no experience with GPT, sorry, the required root= entry
>> may differ. UUIDs may not be required, I mentioned that because
>> I'm using them in /etc/fstab and grub.cfg when booting with
>> an initramfs built with dracut.
>>
>> --
>> Thanos
>
> Thanks for your answers. It is GPT scheme that I am using. UUIDs, Labels
> and everything is correct.
>
> BTW; UUIDs work the same on GPT.
>
> I guess that my problem is the following:
>
> NVME modules are not loaded in initrd. Because; when I compile the
> kernel with NVME built-in, I can boot without any problem. So it should
> be something with initrd. I am new to dracut. I could write a hook or a
> module, but I don't think that is necessary for my scenario. Am I right?
>
> If someone has more experience with dracut and how to build initrd for
> LFS using it; I'd appreciate any hint.
>
> Thanks again
>
This is what I do when I want to boot LFS on other machines.
I get the kernel config from
https://www.archlinux.org/packages/core/x86_64/linux/
or
https://www.archlinux.org/packages/core/x86_64/linux-lts/

On these pages click 'Source Files'

The last kernel I built was 4.4.7-lts-x86_64 on lfs-7.9-rc2-systemd.
They are on 4.4.51 now.

pkgver=4.4.7
pkgtar=linux-${pkgver}.tar.xz
extraver="-lts-x86_64"
make mrproper
set EXTRAVERSION to $extraver in Makefile
cp -v /path/to/config_file .config
make oldconfig
Set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set

make LANG=$LANG LC_ALL= menuconfig
make bzImage modules
make LOCALVERSION= INSTALL_MOD_PATH=${fakeroot} modules_install

# remove build and source links
rm -v ${fakeroot}/lib/modules/${pkgver}${extraver}/{source,build}

cp -v arch/x86/boot/bzImage /boot/vmlinuz-${pkgver}${extraver}
cp -v .config /boot/config-${pkgver}${extraver}

# remove the firmware and get the latest
rm -rf ${fakeroot}/lib/firmware
cd ${fakeroot}/lib
git clone 
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
mv -v linux-firmware firmware
rm -rf firmware/.git
# backup existing firmware
mkdir -pv /path/to/backup/firmware
mv -v /lib/firmware /path/to/backup/firmware
Place installation on /

I tried dracut-044 but did not manage to create a working initramfs.
Did not look for the cause. No time, other priorities.
Tried dracut-041 that had worked in the past and succeeded. Built with

make prefix=/usr \
sysconfdir=/etc  \
bindir=/usr/bin  \
sbindir=/usr/bin \
libdir=/usr/lib  \
loginstall=/var/log/dracut

make DESTDIR=${fakeroot} \
prefix=/usr      \
sysconfdir=/etc  \
bindir=/usr/bin  \
sbindir=/usr/bin \
libdir=/usr/lib  \
loginstall=/var/log/dracut \
install

install -Dm0644 dracut.html ${_fake_doc_dir}/dracut.html

Command used to create the initramfs:

dracut -o "dm i18n lvm" --tmpdir ./initramfs-<kernel_version>.tmp \
        --keep --kver <kernel_version> -v \
        ./initramfs-<kernel_version>.img  \
        2>&1 | tee initramfs-<kernel_version>-build.log

kernel_version is the directory name under /lib/modules/ where the
kernel modules reside. Though the included files are listed in
build.log and the lsinitrd tool can be used to list them too,
I find it convenient to save the tmpdir, (--keep) so that I can
inspect it's contents more effectively.

See DRACUT(8) for the used options. The kernel module
/lib/modules/4.4.7-lts-x86_64/kernel/drivers/nvme/host/nvme.ko.gz
is in the created initramfs. There is a --add-drivers option
you might need.

Of course, all this is far from our usual from scratch procedure.

This is what I did. Please adjust at will.

HTH. Good luck.

-- 
Thanos
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page