Project

General

Profile

Building the development system » History » Version 18

« Previous - Version 18/19 (diff) - Next » - Current version
Ron Rechenmacher, 11/28/2019 12:14 PM


Building the development system

Building rootfs system

For SL7:

LANG=en_US
cd /root
rm -fr ramroot-diskReadOnly.*;\
~ron/script/pxesl7_initramfs.sh ramroot-diskReadOnly /root\
  --mount=mu2edaq01.fnal.gov:/home\
  --links=home/mu2e:/mu2e\
  --mount=local:/usr\
  --keytab=/etc/krb5.keytab\
  --ssh-host-keys="/etc/ssh/ssh_host*key*"\
  --hostname=`hostname -s`\
  --user=ron -ukwar -ueflumerf -umu2edaq -umu2edcs -utomonari -uchramowicz -ulukhanin\
  --root-authorize="ron@FNAL.GOV kwar@FNAL.GOV kwar@FERMI.WIN.FNAL.GOV eflumerf@FNAL.GOV"\
  --root-authorize="eflumerf@FERMI.WIN.FNAL.GOV chramowicz@FNAL.GOV chramowicz@FERMI.WIN.FNAL.GOV"\
  --rpm=rsh-server\
  --rpm='cronie expat'\
  --rpm='mailx postfix mysql-libs'\
  --rpm=ethtool\
  --rpm='ganglia-gmond ganglia-gmond-python'

cp -p ramroot-diskReadOnly.{initramfs.img,vmlinuz} /boot

# do the following once:
cat >>/etc/grub.d/40_custom <<EOF
menuentry "ramroot" --class scientific --class gnu-linux --class gnu --class os --unrestricted {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod xfs
    set root='hd0,msdos1'
    linux16 /ramroot-diskReadOnly.vmlinuz rw console=tty0 console=ttyS1,115200 ignore_loglevel rdinit=/usr/lib/systemd/systemd
    initrd16 /ramroot-diskReadOnly.initramfs.img
}
EOF
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-set-default ramroot
#

SLF6

# Example: on daq03 while booted in normal slf6 distro:
cd /boot
rm -fr ramroot-diskReadOnly.*
~ron/script/pxelinux_initramfs.sh ramroot-diskReadOnly /boot\
  --mount=mu2edaq01.dhcp:/home\
  --mount=mu2edaq01.dhcp:/usr\
  --mount=mu2edaq01.dhcp:/mu2e\
  --mount=local:/\
  --keytab=/etc/krb5.keytab\
  --ssh-host-keys="/etc/ssh/ssh_host*key*"\
  --hostname=`hostname -s`\
  --net-interfaces=eth0\
  --user=ron --user=kwar --user=eflumerf\
  --root-authorize="ron@FNAL.GOV kwar@FNAL.GOV kwar@FERMI.WIN.FNAL.GOV eflumerf@FNAL.GOV"\
  --rpm=cronie\
  --rpm=expat\
  --rpm='mailx postfix mysql-libs'\
  --rpm=ethtool\
  --rpm='ganglia-gmond ganglia-gmond-python'

Note: the expat rpm (xml parsing lib) is needed by gdb.
Note: serial console, if needed, is set in bootloader config -- distro, by default, starts getty on consoles specified on
kernel cmd line.

tweaking ramroot-diskReadOnly

First, mount the filesystem where the initramfs is rw:

mount -oremount,rw /mnt/sda1
cd /mnt/sda1/boot/ramroot-diskReadOnly.initramfs.d

OR
mount -oremount,rw /mnt/mapper/scientific_dhcp--131--225--82--248-root/
cd /mnt/mapper/scientific_dhcp--131--225--82--248-root/root/ramroot-diskReadOnly.initramfs.d

Then, make changes
ie. add rpm:

yumdownloader cronie
rpm -i --nodeps --root=$PWD cronie*
rm cronie*

OR create root crontab file:
cat >var/spool/cron/root <<'EOF'
@reboot sh -c 'x=5;while x=`expr $x - 1`;do test -d /mu2e/ups && break || sleep 5; done;/home/eflumerf/updateStable.sh'
0 0 * * * /home/eflumerf/updateStable.sh'
EOF
chmod 600                                         var/spool/cron/root

Then, recreate the initramfs image and install:

imgfile=`basename $PWD .d`.img
find . | cpio -o -H newc | gzip -c >|../$imgfile
cd ../..
ls -h root/$imgfile
mount /dev/sda1 boot
/bin/cp -p root/$imgfile boot
reboot

Adding another kernel + modules

While running the ramroot system:

KDIR=/home/ron/work/WireCapPrj/linux-4.2.5
ramroot_dir=/mnt/sda1/boot/ramroot-diskReadOnly.initramfs.d

mount -oremount,rw /mnt/sda1   # allow rw to (probably) read-only "mount -obind /mnt/sda1/usr /usr" and ramroot initramfs.d dir

cd $KDIR
make install modules_install INSTALL_MOD_PATH=$ramroot_dir INSTALL_PATH=$ramroot_dir/boot
make headers_install INSTALL_HDR_PATH=$ramroot_dir/usr # NOTE: I "mount -obind" /mnt/sda1/usr to /usr

# the following assumes that ramroot-diskReadOnly.vmlinuz is the kernel associated with the
# ramroot-diskReadOnly.initramfs.img (below) in the /mnt/sda1/boot/grub/grub.conf file.
/bin/cp -p arch/x86/boot/bzImage $ramroot_dir/../ramroot-diskReadOnly.vmlinuz

cd $ramroot_dir
/bin/cp -p boot/vmlinuz ../ramroot-diskReadOnly.vmlinuz
# NOTE: you may wish to trim the modules directory before the final cpio...gzip.
find . | cpio -o -H newc | gzip -c >|../ramroot-diskReadOnly.initramfs.img

Adding to the root/.k5login on mu2edaq02 2018-10-10

mount -oremount,rw /mnt/mapper/scientific_dhcp--131--225--82--248-root/
cd /mnt/mapper/scientific_dhcp--131--225--82--248-root/root/ramroot-diskReadOnly.initramfs.d
vi root/.k5login
imgfile=`basename $PWD .d`.img
find . | cpio -o -H newc | gzip -c >|../$imgfile
cd ../..
mount /dev/sda1 boot
cp root/$imgfile boot
reboot