[Clfs-dev] Moving to systemd part 1

Martin Ward macros_the_black at ntlworld.com
Tue Jan 7 07:20:23 PST 2014


Hi prompted by William, here is how i did it

Its in two parts really, I'll split them as they are quite long

First one is tidying up the boot method
Second is systemd install itself


Moving to systemd

I cross compile from x86 to x86_64-Pure64 using the boot method

I use a couple of extra packages, like gpm,paco and e3vi but nothing too 
esoteric


1. Cleaning Up the Boot Section

Having thought about it for several months since udev was merged into 
systemd(before eudev),
I finally decided to bite the bullet and try out systemd.

Sources of info were Armin's systemd branch of lfs and arch/gentoo.

But first i realised that if i was changing the pid 1 programme for 
SysVInint to systemd,
probably needed a way of backing up changes quickly if it went wrong.

I decided it wasn't optimal to cross-compile a new init system without 
it working first.

So after looking at the dependency chain for systemd, I decided to keep 
udev(eudev) and sysvinit for initial boot phase.


It has always been a bit of a niggle to see some binaries get installed 
into /{bin,sbin}, when they really should be in /tools/{bin,sbin} along 
with most of the others.

so with a few symlinks in place, got that tidied up.


so onwards

section 7.2 Creating Directories, no changes

Section 7.3 Essential symlinks: prefer to keep the symlink instructions 
in with package sections
so only do
ln -sv /tools/bin/{bash,cat,echo,grep,pwd,sleep,stty} ${CLFS}/bin
ln -sv /tools/bin/file ${CLFS}/usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} ${CLFS}/usr/lib
ln -sv /tools/lib/libstd*so* ${CLFS}/usr/lib
ln -sv bash ${CLFS}/bin/sh
ln -sv ../run ${CLFS}/var/run



Section 7.5 Shadow , i do shadow before util-linux (relic of the login 
progs needing PAM, never changed the order)

i have a patch from arch linux that fixes a possible few errors

configure with CC="${CC} ${BUILD64}" ./configure --prefix=/tools 
--build=${CLFS_HOST} --host=${CLFS_TARGET}
make
make installed
then the following

ln -sv /tools/bin/login ${CLFS}/bin/login
ln -sv /tools/bin/passwd ${CLFS}/bin/passwd
//just in case any hard coded links in the bootscripts
ln -sv /tools/etc/login.access ${CLFS}/etc/login.access
ln -sv /tools/etc/login.defs ${CLFS}/etc/login.defs
// ditto

Section 7.4 Util-linux
configuring add --enable-arch --enable-raw --disable-sulogin 
--disable-nologin // not strictally nessesary
make, make installed
symlinks
ln -sv /tools/bin/mount ${CLFS}/bin //needed because i keep sources in 
my home partition
ln -sv /tools/sbin/{agetty,blkid,swapon,swapoff} ${CLFS}/sbin

Section 7.6 e2fsprogs no changes
Section 7.7 Sysvinit
I remove mountpoint and utmpdump
sed -i -e '/utmpdump/d' \
         -e '/mountpoint/d' src/Makefile
change the install line
to make -C src ROOT=/tools install
and then use these symlinks
ln -sv /tools/sbin/init ${CLFS}/sbin
ln -sv /tools/sbin/shutdown ${CLFS}/sbin
ln -sv /tools/etc/inittab ${CLFS}/etc

cat > /tools/etc/inittab << "EOF"
and only have the --noclear option on tty1

Section 7.8 Kmod
i have no need for compressed modules, so don't link to zlib or lzma
so my configure line is
CC="${CC} ${BUILD64}" ./configure --prefix=/tools --build=${CLFS_HOST} 
--host=${CLFS_TARGET} --disable-manpages
// note removal of --bin option
and make install
so it all goes into /tools
then symlinks
ln -sv /tools/bin/kmod ${CLFS}/sbin/modprobe
ln -sv /tools/bin/kmod 
${CLFS}/bin/{lsmod,depmod,insmod,modprobe,modinfo,rmmod} // if needed

section 7.9 eudev

configure becomes
BLKID_CFLAGS="-I/tools/include/blkid" BLKID_LIBS="-lblkid" 
KMOD_CFLAGS="-I/tools/include" KMOD_LIBS="-lkmod" CC="${CC} ${BUILD64}" 
./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} 
--libexecdir=/tools/lib --enable-libkmod --disable-introspection 
--disable-gtk-doc-html --disable-gudev --disable-keymap 
--with-firmware-path=/lib/firmware
// LDFLAGS shouldn't be needed but probably does no harm
make
make install
install -dv ${CLFS}/lib/firmware // kernel hardcodes this ?
i don't add the dummy rule as i don't need network access at this point

rest of section 7 proceeds as normal


you should now have a / file system with only symlinks pointing to 
binaries in /tools
much easier to fix if you inadvertently overwrite something you 
shouldn't have


cheers Martin



More information about the Clfs-dev mailing list