#!/usr/bin/bash # # Copyright (C) 2020 Johannes Kepler University Linz, Institute of Networks and Security # Copyright (C) 2020 CDL Digidow # # Licensed under the EUPL, Version 1.2 or – as soon they will be approved by # the European Commission - subsequent versions of the EUPL (the "Licence"). # You may not use this work except in compliance with the Licence. # # You should have received a copy of the European Union Public License along # with this program. If not, you may obtain a copy of the Licence at: # # # Unless required by applicable law or agreed to in writing, software # distributed under the Licence is distributed on an "AS IS" basis, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the Licence for the specific language governing permissions and # limitations under the Licence. # set -e PARTITION_ROOT=/dev/mapper/ubuntu--vg-ubuntu--lv DISK=/dev/nvme0n1 mkdir -p /boot/efi/EFI/Linux update-initramfs -u -k all LATEST=`ls -t /boot/vmlinuz* | head -1` VERSION=`file -bL $LATEST | grep -o 'version [^ ]*' | cut -d ' ' -f 2` objcopy \ --add-section .osrel="/usr/lib/os-release" --change-section-vma .osrel=0x20000 \ --add-section .cmdline="/boot/kernel-command-line.txt" --change-section-vma .cmdline=0x30000 \ --add-section .linux="/boot/vmlinuz-$VERSION" --change-section-vma .linux=0x40000 \ --add-section .initrd="/boot/initrd.img-$VERSION" --change-section-vma .initrd=0x3000000 \ "/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "/boot/efi/EFI/Linux/Linux.efi"