diff --git a/create_pxeinitrd.sh b/create_pxeinitrd.sh index eb8354a..bdd71ae 100755 --- a/create_pxeinitrd.sh +++ b/create_pxeinitrd.sh @@ -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/ diff --git a/debian/wit-pxeboot.install b/debian/wit-pxeboot.install index 0fb286d..fefa07c 100644 --- a/debian/wit-pxeboot.install +++ b/debian/wit-pxeboot.install @@ -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/ diff --git a/files/debcore b/files/debcore deleted file mode 100644 index 0983a7e..0000000 --- a/files/debcore +++ /dev/null @@ -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 --- diff --git a/files/grub.cfg b/files/grub.cfg new file mode 100644 index 0000000..e758406 --- /dev/null +++ b/files/grub.cfg @@ -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' --- +# diff --git a/files/install b/files/install deleted file mode 100644 index 19b2778..0000000 --- a/files/install +++ /dev/null @@ -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' --- diff --git a/files/installbastion b/files/installbastion deleted file mode 100644 index f9f1c7d..0000000 --- a/files/installbastion +++ /dev/null @@ -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' --- diff --git a/files/localboot b/files/localboot deleted file mode 100644 index 2f42b2b..0000000 --- a/files/localboot +++ /dev/null @@ -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 --- -