more work on new grub multi-arch support

This commit is contained in:
toby 2019-01-08 21:39:49 +00:00
parent 7e17557dff
commit 31f88c1254
7 changed files with 52 additions and 48 deletions

View File

@ -5,10 +5,12 @@ TMP_DIR=${TMP_DIR:=$PWD}
MNT_DIR=$TMP_DIR/newroot
INITRD_DIR=$TMP_DIR/initramfs
RESULT_DIR=$TMP_DIR/files
KERNEL_DIR=$RESULT_DIR/kernel
[[ -d $MNT_DIR ]] || mkdir -p $MNT_DIR
[[ -d $INITRD_DIR ]] || mkdir -p $INITRD_DIR
[[ -d $RESULT_DIR ]] || mkdir -p $RESULT_DIR
[[ -d $KERNEL_DIR ]] || mkdir -p $KERNEL_DIR
HOSTNAME=localhost
# Configs overwritable via environment variables
@ -199,16 +201,25 @@ chmod +x $INITRD_DIR/init
tar -cJf $INITRD_DIR/rootfs.tar.xz -C $MNT_DIR .
[ -d /usr/lib/linux-image-* ] && cp -r newroot/usr/lib/linux-image-* $RESULT_DIR/dtbs
#[ -d /usr/lib/linux-image-* ] && cp -r $MNT_DIR/usr/lib/linux-image-* $RESULT_DIR/dtbs
rm $MNT_DIR/boot/initrd.img-*
mv $MNT_DIR/boot/vmlinuz-* $RESULT_DIR/
cp -r newroot/usr/lib/linux-image-* $RESULT_DIR/dtbs
ln -s $RESULT_DIR/vmlinuz-* $RESULT_DIR/vmlinuz
mv $MNT_DIR/boot/vmlinuz-* $KERNEL_DIR/vmlinuz-$ARCH
cd $INITRD_DIR
find . -print0 | cpio --null -ov --format=newc | gzip -9 > $RESULT_DIR/initramfs.gz
find . -print0 | cpio --null -ov --format=newc | gzip -9 > $KERNEL_DIR/initramfs-$ARCH.gz
cd -
apt-get update
if [[ $ARCH = amd64 ]]
then
apt-get -y install grub-common grub-efi-$ARCH-bin grub-pc-bin
grub-mknetdir --directory=/usr/lib/grub/i386-pc/ --net-directory=$RESULT_DIR/
grub-mknetdir --directory=/usr/lib/grub/x86_64-efi/ --net-directory=$RESULT_DIR/
else
apt-get -y install grub-common grub-efi-$ARCH-bin
grub-mknetdir --net-directory=$RESULT_DIR/
fi
ls -la $RESULT_DIR/

View File

@ -1 +1,3 @@
files/* /srv/tftp/wit-pxeboot/
files/wit-pxeboot/* /srv/tftp/wit-pxeboot/
files/boot/* /srv/tftp/boot/
files/grub.cfg /srv/tftp/boot/grub/

View File

@ -1,9 +0,0 @@
serial 1 115200
prompt 1
timeout 100
default debcore
label debcore
kernel wit-pxeboot/vmlinuz
append initrd=wit-pxeboot/initramfs.gz console=tty0 console=ttyS1,115200n8 size=5000 ---

32
files/grub.cfg Normal file
View File

@ -0,0 +1,32 @@
set timeout=10
source /boot/nodes/${net_default_ip}
menuentry "localboot" {
exit
}
menuentry "debcore-x86_64" {
linux /wit-pxeboot/vmlinuz console=tty0 console=ttyS1,115200n8 size=5000
initrd /wit-pxeboot/initramfs.gz
}
menuentry "debcore-arm64" {
linux /wit-pxeboot-arm/vmlinuz console=tty0 console=ttyAMA0,115200n8 size=5000
initrd /wit-pxeboot-arm/initramfs.gz
}
menuentry "install-x86_64" {
linux /wit-pxeboot/vmlinuz console=tty0 console=ttyS1,115200n8 size=5000 execstartup='sleep 60; export LANG=C; export DEBIAN_FRONTEND=noninteractive; export INSTALLEXTRA=wit-config; apt-get update && apt-get install -y wit-localinstaller && /usr/bin/create_local_install.sh || exit 1'
initrd /wit-pxeboot/initramfs.gz
}
menuentry "install-arm64" {
linux /wit-pxeboot-arm/vmlinuz console=tty0 console=ttyAMA0,115200n8 size=5000 execstartup='sleep 60; export LANG=C; export DEBIAN_FRONTEND=noninteractive; export INSTALLEXTRA=wit-config; apt-get update && apt-get install -y wit-localinstaller && /usr/bin/create_local_install.sh || exit 1'
initrd /wit-pxeboot-arm/initramfs.gz
}
#
#label installbastion
# kernel wit-pxeboot/vmlinuz
# append initrd=wit-pxeboot/initramfs.gz acpi=off console=tty0 console=ttyS1,115200n8 size=5000 execstartup='sleep 60; export LANG=C; export DEBIAN_FRONTEND=noninteractive; export ANSIBLEPULL="--extra-vars=bastion_bootstrap=true --accept-host-key --key-file=/tmp/id_rsa --url=git@git.wit.com:netops/ansible.git bastion-usw3-temp.yaml"; export INSTALLEXTRA="git ansible"; apt-get update && apt-get install -y wit-localinstaller && /usr/bin/create_local_install.sh || exit 1' ---
#

View File

@ -1,9 +0,0 @@
serial 1 115200
prompt 1
timeout 100
default install
label install
kernel wit-pxeboot/vmlinuz
append initrd=wit-pxeboot/initramfs.gz console=tty0 console=ttyS1,115200n8 size=5000 execstartup='sleep 60; export LANG=C; export DEBIAN_FRONTEND=noninteractive; export INSTALLEXTRA=wit-config; apt-get update && apt-get install -y wit-localinstaller && /usr/bin/create_local_install.sh || exit 1' ---

View File

@ -1,9 +0,0 @@
serial 1 115200
prompt 1
timeout 100
default installbastion
label installbastion
kernel wit-pxeboot/vmlinuz
append initrd=wit-pxeboot/initramfs.gz acpi=off console=tty0 console=ttyS1,115200n8 size=5000 execstartup='sleep 60; export LANG=C; export DEBIAN_FRONTEND=noninteractive; export ANSIBLEPULL="--extra-vars=bastion_bootstrap=true --accept-host-key --key-file=/tmp/id_rsa --url=git@git.wit.com:netops/ansible.git bastion-usw3-temp.yaml"; export INSTALLEXTRA="git ansible"; apt-get update && apt-get install -y wit-localinstaller && /usr/bin/create_local_install.sh || exit 1' ---

View File

@ -1,14 +0,0 @@
serial 1 115200
prompt 1
timeout 100
default local
label local
LOCALBOOT -1
label debcore
kernel wit-pxeboot/vmlinuz
append initrd=wit-pxeboot/initramfs.gz console=tty0 console=ttyS1,115200n8 size=5000 ---