Fix building EFI ISO

This commit is contained in:
themylogin
2021-02-22 21:18:00 +01:00
parent 9276b8106a
commit e7e1e4231c
4 changed files with 6 additions and 11 deletions

View File

@@ -16,15 +16,10 @@ In addition to the host, you will want to pre-install the following packages:
* debootstrap
* jq
* git
* xorriso
* grub-common
* grub-efi-amd64-bin
* grub-pc-bin
* mtools
* squashfs-tools
* unzip
``` % sudo apt install build-essential debootstrap jq git xorriso grub-common grub-efi-amd64-bin grub-pc-bin mtools squashfs-tools unzip```
``` % sudo apt install build-essential debootstrap jq git squashfs-tools unzip```
## Usage

View File

@@ -60,9 +60,7 @@
"firmware-netronome",
"firmware-netxen",
"firmware-realtek",
"grub-pc",
"grub-pc-bin",
"grub-efi-amd64",
"grub-efi-amd64-bin",
"htop",
"ifstat",

View File

@@ -83,7 +83,7 @@ make_bootstrapdir() {
case $1 in
cd|CD)
CDBUILD=1
DEOPTS="--components=main,contrib,nonfree --variant=minbase --include=systemd-sysv,gnupg,grub-pc,grub-efi-amd64-signed"
DEOPTS="--components=main,contrib,nonfree --variant=minbase --include=systemd-sysv,gnupg"
CACHENAME="cdrom"
;;
package|packages)
@@ -638,14 +638,14 @@ make_iso_file() {
cp -L ${CHROOT_BASEDIR}/vmlinuz ${CD_DIR}/ || exit_err "Failed to copy vmlinuz"
rm ${CD_DIR}/boot/initrd.img-* || exit_err "Failed to remove /boot/initrd.img-*"
rm ${CD_DIR}/boot/vmlinuz-* || exit_err "Failed to remove /boot/vmlinuz-*"
cp ${RELEASE_DIR}/TrueNAS-SCALE.update ${CD_DIR}/TrueNAS-SCALE.update || exit_err "Faile copy .update"
cp ${RELEASE_DIR}/TrueNAS-SCALE.update ${CD_DIR}/TrueNAS-SCALE.update || exit_err "Failed to copy .update"
mkdir -p ${CHROOT_BASEDIR}/${RELEASE_DIR}
mkdir -p ${CHROOT_BASEDIR}/${CD_DIR}
mount --bind ${RELEASE_DIR} ${CHROOT_BASEDIR}/${RELEASE_DIR} || exit_err "Failed mount --bind ${RELEASE_DIR}"
mount --bind ${CD_DIR} ${CHROOT_BASEDIR}/${CD_DIR} || exit_err "Failed mount --bind ${CD_DIR}"
chroot ${CHROOT_BASEDIR} apt-get update
chroot ${CHROOT_BASEDIR} apt-get install -y xorriso
chroot ${CHROOT_BASEDIR} apt-get install -y grub-efi mtools xorriso
chroot ${CHROOT_BASEDIR} grub-mkrescue -o ${RELEASE_DIR}/TrueNAS-SCALE-${VERSION}.iso ${CD_DIR} \
|| exit_err "Failed grub-mkrescue"
umount -f ${CHROOT_BASEDIR}/${CD_DIR}

View File

@@ -293,6 +293,8 @@ def main():
run_command(["mount", "-t", "sysfs", "none", f"{root}/sys"])
undo.append(["umount", f"{root}/sys"])
os.makedirs(f"{root}/boot/grub", exist_ok=True)
run_command(["mount", "-t", "zfs", f"{pool_name}/grub", f"{root}/boot/grub"])
undo.append(["umount", f"{root}/boot/grub"])