Quantcast
Channel: Fedora People
Viewing all articles
Browse latest Browse all 29899

bodhi.zazen: initramfs

$
0
0

I have used gentoo on my netbook mainly to test the gma500 staging driver with a custom kernel. I have used gentoo-hardened sources with LUKS and LVM as well as fbcondecor.

In order to get the system to boot I have written a custom initramfs. In case it helps others I am posting some information on the contents.

The files included are listed here:

initramfs tree

biraries in /bin or /sbin are either static, or libs identified with ldd are included in /lib

The init script is sort of adapted from several sources and is as follows

#!/bin/busybox ash
# Modified from http://lunaryorn.de/articles/initramfs_gentoo.html

# Report errors / print messages
err () { echo "ERROR: $@"; }
msg () { [ "${quiet}" != 'y' ] && echo $@; }

# Global variables
export ROOT="/dev/mapper/lotus-root"
export PATH="/bin:/sbin"
export CRYPTROOT="/dev/sda10"
export CRYPTNAME="gentoo"
export CONSOLEFONT="ter-v16n"

# Mount proc and sys
mount -t proc none /proc
mount -t sysfs none /sys

# Silence kernel messages
msg "Silencing procfs …"
echo 0 > /proc/sys/kernel/printk

# Read kernel command line options
read CMDLINE </proc/cmdline
export CMDLINE
for x in ${CMDLINE}
do
  case "${x}" in
    quiet)
      quiet='y'
      export quiet
      ;;
  esac
done

# Create devices
echo "/sbin/modprobe" > /proc/sys/kernel/modprobe

msg "Creating device nodes …"
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s

# set keymap
#kbd_mode -u /dev/tty1
printf "\033%%G" >> /dev/console
msg "Loading keymap …"
loadkmap < /etc/kmap-us

# set console font
msg "Setting font …"
setfont /usr/share/consolefonts/${CONSOLEFONT}.psf.gz -C /dev/tty
printf "\033(K" >> /dev/console

# Open LUKS Crypt
msg "Open LUKS Crypt …"
while ! cryptsetup luksOpen -T 3 $CRYPTROOT $CRYPTNAME >/dev/null ; do
  sleep 2;
done

# setup splash screen
. /etc/initrd.splash
msg "Setting up splashscreen …"
splash init

# LVM
lvm vgscan --ignorelockingfailure > /dev/null
lvm vgchange --ignorelockingfailure -ay >/dev/null

# Mount root fs ro for fsck
mount -o ro /dev/mapper/lotus-root /newroot

# Clean up and exit to rootfs
umount /sys
umount /proc
exec switch_root /newroot /sbin/init ${CMDLINE}

The only problem is that the boot splash does not display any area to enter the LUKS password. Hit alt-F1 and enter the password on the console.

The only other thing I think I need to address is running fsck, but I will leave that for another day.

thumb


Viewing all articles
Browse latest Browse all 29899

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>