From ab3d78860e1dc4cd157e455a7071cc9e8a99a772 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sun, 29 Jan 2023 11:11:38 +0200 Subject: Update URLs * Update mkinitcpio-archiso project link, * Update code of conduct link, * Update arch-releng mailing list link, * Use HTTPS where possible, * Replace dead link. --- CHANGELOG.rst | 2 +- README.rst | 4 ++-- configs/releng/syslinux/archiso_head.cfg | 2 +- configs/releng/syslinux/archiso_tail.cfg | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f4ad972..66ffe75 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -241,7 +241,7 @@ Removed ------- - Remove all files related to ``mkinitcpio`` integration, as they now live in - https://gitlab.archlinux.org/mkinitcpio/mkinitcpio-archiso + https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio-archiso [57] - 2021-07-30 ================= diff --git a/README.rst b/README.rst index d1aa233..51cb600 100644 --- a/README.rst +++ b/README.rst @@ -139,14 +139,14 @@ Contribute Development of archiso takes place on Arch Linux' Gitlab: https://gitlab.archlinux.org/archlinux/archiso. -Please read our distribution-wide `Code of Conduct `_ before +Please read our distribution-wide `Code of Conduct `_ before contributing, to understand what actions will and will not be tolerated. Read our `contributing guide `_ to learn more about how to provide fixes or improvements for the code base. Discussion around archiso takes place on the `arch-releng mailing list -`_ and in `#archlinux-releng +`_ and in `#archlinux-releng `_ on `Libera Chat `_. All past and present authors of archiso are listed in `AUTHORS `_. diff --git a/configs/releng/syslinux/archiso_head.cfg b/configs/releng/syslinux/archiso_head.cfg index 1154f78..671ab4e 100644 --- a/configs/releng/syslinux/archiso_head.cfg +++ b/configs/releng/syslinux/archiso_head.cfg @@ -12,7 +12,7 @@ MENU CMDLINEROW 14 MENU HELPMSGROW 16 MENU HELPMSGENDROW 29 -# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu +# Refer to https://wiki.syslinux.org/wiki/index.php/Comboot/menu.c32 MENU COLOR border 30;44 #40ffffff #a0000000 std MENU COLOR title 1;36;44 #9033ccff #a0000000 std diff --git a/configs/releng/syslinux/archiso_tail.cfg b/configs/releng/syslinux/archiso_tail.cfg index e5339a2..dcbb413 100644 --- a/configs/releng/syslinux/archiso_tail.cfg +++ b/configs/releng/syslinux/archiso_tail.cfg @@ -7,12 +7,12 @@ MENU LABEL Boot existing OS COM32 chain.c32 APPEND hd0 0 -# http://www.memtest.org/ +# https://www.memtest.org/ LABEL memtest MENU LABEL Run Memtest86+ (RAM test) LINUX /%INSTALL_DIR%/boot/memtest -# http://hdt-project.org/ +# https://wiki.syslinux.org/wiki/index.php/Hdt_(Hardware_Detection_Tool) LABEL hdt MENU LABEL Hardware Information (HDT) COM32 hdt.c32 -- cgit v1.2.3-54-g00ecf From 8d7ad3c629e1a2d0cb2f2008e62ea979639230e7 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sun, 22 Jan 2023 12:02:35 +0200 Subject: mkarchiso: write a .uuid file to /.disk/ on ISO 9660 to allow GRUB to search for it Create a `/.disk/INSERT_UUID_HERE.uuid` file to implement something called "file system transposition". See https://www.mail-archive.com/grub-devel@gnu.org/msg34346.html for the proposal of it for grub-mkrescue. This will allow GRUB to search for the volume containing the file instead of hardcoding the ISO volume label or another file system or partition attribute in GRUB configuration. By only relying on the directory structure simplifies supporting medium preparation methods with manual partitioning such as https://wiki.archlinux.org/title/USB_flash_installation_medium#In_GNU/Linux_4 --- archiso/mkarchiso | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 7331bb0..f8a3df1 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -569,7 +569,13 @@ _make_common_bootmode_grub_copy_to_isofs() { # Prepare GRUB configuration files _make_common_bootmode_grub_cfg(){ - local _cfg + local _cfg uuid_search_filename + + # Create a .uuid file and place it in /.disk/ on ISO 9660 to provide a way for GRUB to search for the volume + uuid_search_filename="$(uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 \ + --name "${SOURCE_DATE_EPOCH} disk search UUID")" + install -d -m 0755 -- "${isofs_dir}/.disk" + : > "${isofs_dir}/.disk/${uuid_search_filename}.uuid" install -d -- "${work_dir}/grub" @@ -577,7 +583,8 @@ _make_common_bootmode_grub_cfg(){ for _cfg in "${profile}/grub/"*'.cfg'; do sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g; - s|%ARCH%|${arch}|g" \ + s|%ARCH%|${arch}|g; + s|%UUID_SEARCH_FILENAME%|${uuid_search_filename}|g" \ "${_cfg}" > "${work_dir}/grub/${_cfg##*/}" done # Add all GRUB files to the list of files used to calculate the required FAT image size. -- cgit v1.2.3-54-g00ecf From 3f95d391eff6145e0546b8c0b69bd2851fc3c400 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sun, 22 Jan 2023 12:17:51 +0200 Subject: configs/*/grub/grub.cfg: search for a .uuid file in /.disk/ and use the volume it's on Search for `/.disk/%UUID_SEARCH_FILENAME%.uuid` and pass the UUID of the volume it's on as `archisodevice`. mkarchiso will replace `%UUID_SEARCH_FILENAME%` with a hardcoded value generated using `SOURCE_DATE_EPOCH` durring ISO build. This allows to prepare an UEFI bootable installation medium by simply copying the directory structure without having to touch `grub.cfg`. Relying on the volume UUID instead of its LABEL also avoids collisions of multiple ISOs created in the same month. Fixes #202 --- CHANGELOG.rst | 7 +++++++ configs/baseline/grub/grub.cfg | 8 ++++++-- configs/releng/grub/grub.cfg | 14 +++++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 66ffe75..f6a6f25 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,9 +8,16 @@ Changelog Added ----- +- Support *file system transposition* to simplify boot medium preparation for UEFI boot via extracting the ISO image + contents to a drive. ``grub.cfg`` does not hardcode the ISO volume label anymore, instead GRUB will search for volume + with a ``/.disk/%UUID_SEARCH_FILENAME%.uuid`` file on it. + Changed ------- +- Identify the ISO volume via a UUID instead of a file system label to avoid collisions of multiple ISOs created in the + same month. + Removed ------- diff --git a/configs/baseline/grub/grub.cfg b/configs/baseline/grub/grub.cfg index d2aa4ab..7d73fe6 100644 --- a/configs/baseline/grub/grub.cfg +++ b/configs/baseline/grub/grub.cfg @@ -20,6 +20,11 @@ if serial --unit=0 --speed=115200; then terminal_output --append serial fi +# Search for the ISO volume +regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" +search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" +probe --set ARCHISO_UUID --fs-uuid "${root}" + # Set default menu entry default=archlinux timeout=15 @@ -30,7 +35,6 @@ timeout_style=menu menuentry "Arch Linux (x86_64, UEFI)" --class arch --class gnu-linux --class gnu --class os --id 'archlinux' { set gfxpayload=keep - search --no-floppy --set=root --label %ARCHISO_LABEL% - linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% + linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=/dev/disk/by-uuid/${ARCHISO_UUID} initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img } diff --git a/configs/releng/grub/grub.cfg b/configs/releng/grub/grub.cfg index 79ea2d2..ddd8af2 100644 --- a/configs/releng/grub/grub.cfg +++ b/configs/releng/grub/grub.cfg @@ -20,6 +20,11 @@ if serial --unit=0 --speed=115200; then terminal_output --append serial fi +# Search for the ISO volume +regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" +search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" +probe --set ARCHISO_UUID --fs-uuid "${root}" + # Set default menu entry default=archlinux timeout=15 @@ -32,15 +37,13 @@ play 600 988 1 1319 4 menuentry "Arch Linux install medium (x86_64, UEFI)" --class arch --class gnu-linux --class gnu --class os --id 'archlinux' { set gfxpayload=keep - search --no-floppy --set=root --label %ARCHISO_LABEL% - linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% + linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=/dev/disk/by-uuid/${ARCHISO_UUID} initrd /%INSTALL_DIR%/boot/intel-ucode.img /%INSTALL_DIR%/boot/amd-ucode.img /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img } menuentry "Arch Linux install medium with speakup screen reader (x86_64, UEFI)" --hotkey s --class arch --class gnu-linux --class gnu --class os --id 'archlinux-accessibility' { set gfxpayload=keep - search --no-floppy --set=root --label %ARCHISO_LABEL% - linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% accessibility=on + linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=/dev/disk/by-uuid/${ARCHISO_UUID} accessibility=on initrd /%INSTALL_DIR%/boot/intel-ucode.img /%INSTALL_DIR%/boot/amd-ucode.img /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img } @@ -48,18 +51,15 @@ if [ "${grub_platform}" == "efi" ]; then if [ "${grub_cpu}" == "x86_64" ]; then menuentry "Run Memtest86+ (RAM test)" --class memtest86 --class gnu --class tool { set gfxpayload=800x600,1024x768 - search --fs-uuid --no-floppy --set=root --label %ARCHISO_LABEL% linux /%INSTALL_DIR%/boot/memtest.efi } menuentry "UEFI Shell" { insmod chain - search --no-floppy --set=root --label %ARCHISO_LABEL% chainloader /shellx64.efi } elif [ "${grub_cpu}" == "i386" ]; then menuentry "UEFI Shell" { insmod chain - search --no-floppy --set=root --label %ARCHISO_LABEL% chainloader /shellia32.efi } fi -- cgit v1.2.3-54-g00ecf From 5587e031f34d7cd1828012596453bc9b2c8be26b Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sun, 22 Jan 2023 13:32:54 +0200 Subject: Preload GRUB's NTFS, exFAT and UDF modules There are claims that some UEFI allegedly natively support NTFS. Preload the required GRUB modules to support booting from NTFS on such systems. Additionally preload the exFAT and UEF modules, because, why not? --- CHANGELOG.rst | 2 ++ archiso/mkarchiso | 16 ++++++++-------- configs/baseline/grub/grub.cfg | 4 ++++ configs/releng/grub/grub.cfg | 4 ++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f6a6f25..e2dfa9e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,8 @@ Added - Support *file system transposition* to simplify boot medium preparation for UEFI boot via extracting the ISO image contents to a drive. ``grub.cfg`` does not hardcode the ISO volume label anymore, instead GRUB will search for volume with a ``/.disk/%UUID_SEARCH_FILENAME%.uuid`` file on it. +- Preload GRUB's NTFS modules for UEFI that allegedly have native NTFS support. GRUB's exFAT and UDF modules are also + preloaded in case someone finds them useful. Changed ------- diff --git a/archiso/mkarchiso b/archiso/mkarchiso index f8a3df1..c1a8c22 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -612,11 +612,11 @@ _make_bootmode_uefi-ia32.grub.esp() { # Create EFI binary # Module list from https://bugs.archlinux.org/task/71382#comment202911 - grubmodules=(all_video at_keyboard boot btrfs cat chain configfile echo efifwsetup efinet ext2 f2fs fat font \ + grubmodules=(all_video at_keyboard boot btrfs cat chain configfile echo efifwsetup efinet exfat ext2 f2fs fat font \ gfxmenu gfxterm gzio halt hfsplus iso9660 jpeg keylayouts linux loadenv loopback lsefi lsefimmap \ - minicmd normal part_apple part_gpt part_msdos png read reboot regexp search search_fs_file \ - search_fs_uuid search_label serial sleep tpm usb usbserial_common usbserial_ftdi usbserial_pl2303 \ - usbserial_usbdebug video xfs zstd) + minicmd normal ntfs ntfscomp part_apple part_gpt part_msdos png read reboot regexp search \ + search_fs_file search_fs_uuid search_label serial sleep tpm udf usb usbserial_common usbserial_ftdi \ + usbserial_pl2303 usbserial_usbdebug video xfs zstd) grub-mkstandalone -O i386-efi \ --modules="${grubmodules[*]}" \ --locales="en@quot" \ @@ -689,11 +689,11 @@ _make_bootmode_uefi-x64.grub.esp() { # Create EFI binary # Module list from https://bugs.archlinux.org/task/71382#comment202911 - grubmodules=(all_video at_keyboard boot btrfs cat chain configfile echo efifwsetup efinet ext2 f2fs fat font \ + grubmodules=(all_video at_keyboard boot btrfs cat chain configfile echo efifwsetup efinet exfat ext2 f2fs fat font \ gfxmenu gfxterm gzio halt hfsplus iso9660 jpeg keylayouts linux loadenv loopback lsefi lsefimmap \ - minicmd normal part_apple part_gpt part_msdos png read reboot regexp search search_fs_file \ - search_fs_uuid search_label serial sleep tpm usb usbserial_common usbserial_ftdi usbserial_pl2303 \ - usbserial_usbdebug video xfs zstd) + minicmd normal ntfs ntfscomp part_apple part_gpt part_msdos png read reboot regexp search \ + search_fs_file search_fs_uuid search_label serial sleep tpm udf usb usbserial_common usbserial_ftdi \ + usbserial_pl2303 usbserial_usbdebug video xfs zstd) grub-mkstandalone -O x86_64-efi \ --modules="${grubmodules[*]}" \ --locales="en@quot" \ diff --git a/configs/baseline/grub/grub.cfg b/configs/baseline/grub/grub.cfg index 7d73fe6..d606b10 100644 --- a/configs/baseline/grub/grub.cfg +++ b/configs/baseline/grub/grub.cfg @@ -3,6 +3,10 @@ insmod part_gpt insmod part_msdos insmod fat insmod iso9660 +insmod ntfs +insmod ntfscomp +insmod exfat +insmod udf # Use graphics-mode output insmod all_video diff --git a/configs/releng/grub/grub.cfg b/configs/releng/grub/grub.cfg index ddd8af2..ddf71e7 100644 --- a/configs/releng/grub/grub.cfg +++ b/configs/releng/grub/grub.cfg @@ -3,6 +3,10 @@ insmod part_gpt insmod part_msdos insmod fat insmod iso9660 +insmod ntfs +insmod ntfscomp +insmod exfat +insmod udf # Use graphics-mode output insmod all_video -- cgit v1.2.3-54-g00ecf From 0f34e4429a6d16d201c2568417cdc5ff79dd68dd Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 18 Jun 2022 11:01:49 +0300 Subject: configs/*/airootfs/etc/ssh/sshd_config: update to match 9.2p1-1 Update /etc/ssh/sshd_config to match changes made in https://github.com/archlinux/svntogit-packages/commit/42aa04744e96c5805b7aa3904636f8cbd781f682 and https://github.com/archlinux/svntogit-packages/commit/7166713c55002dac3c2b306fdc63e89a412083a6 The only modification remains `PermitRootLogin yes`. --- configs/baseline/airootfs/etc/ssh/sshd_config | 6 +++--- configs/releng/airootfs/etc/ssh/sshd_config | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configs/baseline/airootfs/etc/ssh/sshd_config b/configs/baseline/airootfs/etc/ssh/sshd_config index 93f7d63..dc22c11 100644 --- a/configs/baseline/airootfs/etc/ssh/sshd_config +++ b/configs/baseline/airootfs/etc/ssh/sshd_config @@ -58,7 +58,7 @@ AuthorizedKeysFile .ssh/authorized_keys #PermitEmptyPasswords no # Change to no to disable s/key passwords -#KbdInteractiveAuthentication yes +KbdInteractiveAuthentication no # Kerberos options #KerberosAuthentication no @@ -75,7 +75,7 @@ AuthorizedKeysFile .ssh/authorized_keys # be allowed through the KbdInteractiveAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via KbdInteractiveAuthentication may bypass -# the setting of "PermitRootLogin without-password". +# the setting of "PermitRootLogin prohibit-password". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and KbdInteractiveAuthentication to 'no'. @@ -88,7 +88,7 @@ UsePAM yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes -PrintMotd no # pam does that +PrintMotd no #PrintLastLog yes #TCPKeepAlive yes #PermitUserEnvironment no diff --git a/configs/releng/airootfs/etc/ssh/sshd_config b/configs/releng/airootfs/etc/ssh/sshd_config index 93f7d63..dc22c11 100644 --- a/configs/releng/airootfs/etc/ssh/sshd_config +++ b/configs/releng/airootfs/etc/ssh/sshd_config @@ -58,7 +58,7 @@ AuthorizedKeysFile .ssh/authorized_keys #PermitEmptyPasswords no # Change to no to disable s/key passwords -#KbdInteractiveAuthentication yes +KbdInteractiveAuthentication no # Kerberos options #KerberosAuthentication no @@ -75,7 +75,7 @@ AuthorizedKeysFile .ssh/authorized_keys # be allowed through the KbdInteractiveAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via KbdInteractiveAuthentication may bypass -# the setting of "PermitRootLogin without-password". +# the setting of "PermitRootLogin prohibit-password". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and KbdInteractiveAuthentication to 'no'. @@ -88,7 +88,7 @@ UsePAM yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes -PrintMotd no # pam does that +PrintMotd no #PrintLastLog yes #TCPKeepAlive yes #PermitUserEnvironment no -- cgit v1.2.3-54-g00ecf From 28d2bc11e3dc4a86667a8f5f379d8ac9c18c0a03 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Thu, 27 Oct 2022 11:04:42 +0300 Subject: mkarchiso: do not place memtest86+ in netboot artifacts Move memtest86+ to `/boot/memtest86+/` on ISO 9660. That directory is not copied to netboot artifact output. Netboot boot menu https://ipxe.archlinux.org/releng/netboot/archlinux.ipxe does not have entries for memtest and archiso-manager removes these files (not the EFI one, though) before uploading the release files anyway. --- CHANGELOG.rst | 2 ++ archiso/mkarchiso | 14 ++++++-------- configs/releng/grub/grub.cfg | 2 +- configs/releng/syslinux/archiso_tail.cfg | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e2dfa9e..2b0d90f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -23,6 +23,8 @@ Changed Removed ------- +- Do not place memtest86+ in netboot artifacts. + [69] - 2022-12-24 ================= diff --git a/archiso/mkarchiso b/archiso/mkarchiso index c1a8c22..ce89642 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -471,11 +471,10 @@ _make_bootmode_bios.syslinux.mbr() { # Add other aditional/extra files to ${install_dir}/boot/ if [[ -e "${pacstrap_dir}/boot/memtest86+/memtest.bin" ]]; then + install -d -m 0755 -- "${isofs_dir}/boot/memtest86+/" # rename for PXE: https://wiki.archlinux.org/title/Syslinux#Using_memtest - install -m 0644 -- "${pacstrap_dir}/boot/memtest86+/memtest.bin" "${isofs_dir}/${install_dir}/boot/memtest" - install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/licenses/memtest86+/" - install -m 0644 -- "${pacstrap_dir}/usr/share/licenses/common/GPL2/license.txt" \ - "${isofs_dir}/${install_dir}/boot/licenses/memtest86+/" + install -m 0644 -- "${pacstrap_dir}/boot/memtest86+/memtest.bin" "${isofs_dir}/boot/memtest86+/memtest" + install -m 0644 -- "${pacstrap_dir}/usr/share/licenses/common/GPL2/license.txt" "${isofs_dir}/boot/memtest86+/" fi _msg_info "Done! SYSLINUX set up for BIOS booting from a disk successfully." } @@ -722,10 +721,9 @@ _make_bootmode_uefi-x64.grub.esp() { # Add other aditional/extra files to ${install_dir}/boot/ if [[ -e "${pacstrap_dir}/boot/memtest86+/memtest.efi" ]]; then - install -m 0644 -- "${pacstrap_dir}/boot/memtest86+/memtest.efi" "${isofs_dir}/${install_dir}/boot/memtest.efi" - install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/licenses/memtest86+/" - install -m 0644 -- "${pacstrap_dir}/usr/share/licenses/common/GPL2/license.txt" \ - "${isofs_dir}/${install_dir}/boot/licenses/memtest86+/" + install -d -m 0755 -- "${isofs_dir}/boot/memtest86+/" + install -m 0644 -- "${pacstrap_dir}/boot/memtest86+/memtest.efi" "${isofs_dir}/boot/memtest86+/memtest.efi" + install -m 0644 -- "${pacstrap_dir}/usr/share/licenses/common/GPL2/license.txt" "${isofs_dir}/boot/memtest86+/" fi _msg_info "Done! GRUB set up for UEFI booting successfully." diff --git a/configs/releng/grub/grub.cfg b/configs/releng/grub/grub.cfg index ddf71e7..eb45a00 100644 --- a/configs/releng/grub/grub.cfg +++ b/configs/releng/grub/grub.cfg @@ -55,7 +55,7 @@ if [ "${grub_platform}" == "efi" ]; then if [ "${grub_cpu}" == "x86_64" ]; then menuentry "Run Memtest86+ (RAM test)" --class memtest86 --class gnu --class tool { set gfxpayload=800x600,1024x768 - linux /%INSTALL_DIR%/boot/memtest.efi + linux /boot/memtest86+/memtest.efi } menuentry "UEFI Shell" { insmod chain diff --git a/configs/releng/syslinux/archiso_tail.cfg b/configs/releng/syslinux/archiso_tail.cfg index dcbb413..e84897c 100644 --- a/configs/releng/syslinux/archiso_tail.cfg +++ b/configs/releng/syslinux/archiso_tail.cfg @@ -10,7 +10,7 @@ APPEND hd0 0 # https://www.memtest.org/ LABEL memtest MENU LABEL Run Memtest86+ (RAM test) -LINUX /%INSTALL_DIR%/boot/memtest +LINUX /boot/memtest86+/memtest # https://wiki.syslinux.org/wiki/index.php/Hdt_(Hardware_Detection_Tool) LABEL hdt -- cgit v1.2.3-54-g00ecf From 7c6f266ec94e3eff23466ed8d0c45e4bee0ddae4 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 28 Jan 2023 20:54:32 +0200 Subject: configs/*/profiledef.sh: honor SOURCE_DATE_EPOCH Ensure the **correct** date is used in `iso_label` and `iso_version`. --- CHANGELOG.rst | 1 + configs/baseline/profiledef.sh | 4 ++-- configs/releng/profiledef.sh | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2b0d90f..d55c15d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,7 @@ Changed - Identify the ISO volume via a UUID instead of a file system label to avoid collisions of multiple ISOs created in the same month. +- Honor ``SOURCE_DATE_EPOCH`` in the ``date`` command used by ``profiledef.sh`` of the shipped profiles. Removed ------- diff --git a/configs/baseline/profiledef.sh b/configs/baseline/profiledef.sh index ed486ca..63acce1 100644 --- a/configs/baseline/profiledef.sh +++ b/configs/baseline/profiledef.sh @@ -2,10 +2,10 @@ # shellcheck disable=SC2034 iso_name="archlinux-baseline" -iso_label="ARCH_$(date +%Y%m)" +iso_label="ARCH_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)" iso_publisher="Arch Linux " iso_application="Arch Linux baseline" -iso_version="$(date +%Y.%m.%d)" +iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)" install_dir="arch" buildmodes=('iso') bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' diff --git a/configs/releng/profiledef.sh b/configs/releng/profiledef.sh index 4b4e68c..4154816 100644 --- a/configs/releng/profiledef.sh +++ b/configs/releng/profiledef.sh @@ -2,10 +2,10 @@ # shellcheck disable=SC2034 iso_name="archlinux" -iso_label="ARCH_$(date +%Y%m)" +iso_label="ARCH_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)" iso_publisher="Arch Linux " iso_application="Arch Linux Live/Rescue CD" -iso_version="$(date +%Y.%m.%d)" +iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)" install_dir="arch" buildmodes=('iso') bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' -- cgit v1.2.3-54-g00ecf From 40e09767f0cea7c4a94af98504e9c936f1dd7720 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Wed, 25 Jan 2023 23:05:48 +0200 Subject: mkarchiso: add more details to the comment in grub-embed.cfg Link to the upstream issue report. --- archiso/mkarchiso | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index ce89642..c116a27 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -590,10 +590,13 @@ _make_common_bootmode_grub_cfg(){ efiboot_files+=("${work_dir}/grub/" "${profile}/grub/"!(*.cfg)) + # Prepare grub.cfg that will be embedded inside the GRUB binaries IFS='' read -r -d '' grubembedcfg <<'EOF' || true if ! [ -d "$cmdpath" ]; then - # On some firmware, GRUB has a wrong cmdpath when booted from an optical disc. - # https://gitlab.archlinux.org/archlinux/archiso/-/issues/183 + # On some firmware, GRUB has a wrong cmdpath when booted from an optical disc. During El Torito boot, GRUB is + # launched from a case-insensitive FAT-formatted EFI system partition, but it seemingly cannot access that partition + # and sets cmdpath to the whole cd# device which has case-sensitive ISO 9660 + Rock Ridge + Joliet file systems. + # See https://gitlab.archlinux.org/archlinux/archiso/-/issues/183 and https://savannah.gnu.org/bugs/?62886 if regexp --set=1:isodevice '^(\([^)]+\))\/?[Ee][Ff][Ii]\/[Bb][Oo][Oo][Tt]\/?$' "$cmdpath"; then cmdpath="${isodevice}/EFI/BOOT" fi -- cgit v1.2.3-54-g00ecf From f5ade898f9cb0de1f6fb01fcef088d8a6b56de7d Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 28 Jan 2023 13:08:49 +0200 Subject: Do not duplicate grub.cfg in efiboot.img Instruct the embeded grub.cfg to search for a volume with a `/.disk/%UUID_SEARCH_FILENAME%.uuid` file and load `/EFI/BOOT/grub.cfg` from it. This avoid duplicating GRUB configuration files in two places (ISO 9660 and FAT) and ensures there is no confusion about which is the _correct_ configuration file. Since nothing besides EFI binaries is copied to `efibootimg`, the `_make_common_bootmode_grub_copy_to_efibootimg` function is removed. Fixes #208 --- CHANGELOG.rst | 2 ++ archiso/mkarchiso | 54 ++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d55c15d..e00ebcb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,8 @@ Changed - Identify the ISO volume via a UUID instead of a file system label to avoid collisions of multiple ISOs created in the same month. - Honor ``SOURCE_DATE_EPOCH`` in the ``date`` command used by ``profiledef.sh`` of the shipped profiles. +- Do not duplicate ``grub.cfg`` in both ISO 9660 and the EFI system partition / El Torito image. GRUB will search for + the ISO volume and load the ``grub.cfg`` from there. Removed ------- diff --git a/archiso/mkarchiso b/archiso/mkarchiso index c116a27..00c974e 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -544,18 +544,7 @@ _make_efibootimg() { mmd -i "${efibootimg}" ::/EFI ::/EFI/BOOT } -# Copy GRUB files to efiboot.img which is used by both IA32 UEFI and x64 UEFI. -_make_common_bootmode_grub_copy_to_efibootimg() { - local files_to_copy=() - - files_to_copy+=("${work_dir}/grub/"*) - if compgen -G "${profile}/grub/!(*.cfg)" &> /dev/null; then - files_to_copy+=("${profile}/grub/"!(*.cfg)) - fi - mcopy -i "${efibootimg}" "${files_to_copy[@]}" ::/EFI/BOOT/ -} - -# Copy GRUB files to efiboot.img which is used by both IA32 UEFI and x64 UEFI. +# Copy GRUB files to ISO 9660 which is used by both IA32 UEFI and x64 UEFI _make_common_bootmode_grub_copy_to_isofs() { local files_to_copy=() @@ -563,6 +552,7 @@ _make_common_bootmode_grub_copy_to_isofs() { if compgen -G "${profile}/grub/!(*.cfg)" &> /dev/null; then files_to_copy+=("${profile}/grub/"!(*.cfg)) fi + install -d -m 0755 -- "${isofs_dir}/EFI/BOOT" install -m 0644 -- "${files_to_copy[@]}" "${isofs_dir}/EFI/BOOT/" } @@ -586,9 +576,6 @@ _make_common_bootmode_grub_cfg(){ s|%UUID_SEARCH_FILENAME%|${uuid_search_filename}|g" \ "${_cfg}" > "${work_dir}/grub/${_cfg##*/}" done - # Add all GRUB files to the list of files used to calculate the required FAT image size. - efiboot_files+=("${work_dir}/grub/" - "${profile}/grub/"!(*.cfg)) # Prepare grub.cfg that will be embedded inside the GRUB binaries IFS='' read -r -d '' grubembedcfg <<'EOF' || true @@ -597,12 +584,39 @@ if ! [ -d "$cmdpath" ]; then # launched from a case-insensitive FAT-formatted EFI system partition, but it seemingly cannot access that partition # and sets cmdpath to the whole cd# device which has case-sensitive ISO 9660 + Rock Ridge + Joliet file systems. # See https://gitlab.archlinux.org/archlinux/archiso/-/issues/183 and https://savannah.gnu.org/bugs/?62886 - if regexp --set=1:isodevice '^(\([^)]+\))\/?[Ee][Ff][Ii]\/[Bb][Oo][Oo][Tt]\/?$' "$cmdpath"; then - cmdpath="${isodevice}/EFI/BOOT" + if regexp --set=1:archiso_bootdevice '^\(([^)]+)\)\/?[Ee][Ff][Ii]\/[Bb][Oo][Oo][Tt]\/?$' "${cmdpath}"; then + set cmdpath="(${archiso_bootdevice})/EFI/BOOT" + set ARCHISO_HINT="${archiso_bootdevice}" fi fi -configfile "${cmdpath}/grub.cfg" + +# Prepare a hint for the search command using the device in cmdpath +if [ -z "${ARCHISO_HINT}" ]; then + regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" +fi + +# Search for the ISO volume +if search --no-floppy --set=archiso_device --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}"; then + set ARCHISO_HINT="${archiso_device}" + if probe --set ARCHISO_UUID --fs-uuid "${ARCHISO_HINT}"; then + export ARCHISO_UUID + fi +else + echo "Could not find a volume with a '/.disk/%UUID_SEARCH_FILENAME%.uuid' file on it!" +fi + +# Load grub.cfg +if [ "${ARCHISO_HINT}" == 'memdisk' -o -z "${ARCHISO_HINT}" ]; then + echo 'Could not find the ISO volume!' +elif [ -e "(${ARCHISO_HINT})/EFI/BOOT/grub.cfg" ]; then + export ARCHISO_HINT + set root="${ARCHISO_HINT}" + configfile "(${ARCHISO_HINT})/EFI/BOOT/grub.cfg" +else + echo "File '(${ARCHISO_HINT})/EFI/BOOT/grub.cfg' not found!" +fi EOF + grubembedcfg="${grubembedcfg//'%UUID_SEARCH_FILENAME%'/"${uuid_search_filename}"}" printf '%s\n' "$grubembedcfg" > "${work_dir}/grub-embed.cfg" } @@ -645,7 +659,7 @@ _make_bootmode_uefi-ia32.grub.esp() { mcopy -i "${efibootimg}" "${work_dir}/BOOTIA32.EFI" ::/EFI/BOOT/BOOTIA32.EFI # Copy GRUB files - _run_once _make_common_bootmode_grub_copy_to_efibootimg + _run_once _make_common_bootmode_grub_copy_to_isofs if [[ -e "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi" ]]; then mcopy -i "${efibootimg}" "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi" ::/shellia32.efi @@ -716,7 +730,7 @@ _make_bootmode_uefi-x64.grub.esp() { mcopy -i "${efibootimg}" "${work_dir}/BOOTx64.EFI" ::/EFI/BOOT/BOOTx64.EFI # Copy GRUB files - _run_once _make_common_bootmode_grub_copy_to_efibootimg + _run_once _make_common_bootmode_grub_copy_to_isofs if [[ -e "${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" ]]; then mcopy -i "${efibootimg}" "${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" ::/shellx64.efi -- cgit v1.2.3-54-g00ecf From b94d7c4ce5afdec032835378a7f6c564aecb05ed Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 28 Jan 2023 13:22:42 +0200 Subject: Move grub files from /EFI/BOOT/ to /boot/grub/ on ISO 9660 Move the location of GRUB files so that there is boot-platform (BIOS vs EFI) neutral place for GRUB-specific files (e.g. configuration files, background images, etc.). The EFI binaries are obviosly staying in the default/fallback boot path `/EFI/BOOT/BOOT*.EFI`, otherwise there will be no UEFI booting. The /boot/grub/ directory will be used to store BIOS (i386-pc) GRUB bootsector images, if we get to that. It is also a requirement for implementing `loopback.cfg` support, since the file's path must be `/boot/grub/loopback.cfg`. Implements #206 --- CHANGELOG.rst | 2 ++ archiso/mkarchiso | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e00ebcb..da1c9ea 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -22,6 +22,8 @@ Changed - Honor ``SOURCE_DATE_EPOCH`` in the ``date`` command used by ``profiledef.sh`` of the shipped profiles. - Do not duplicate ``grub.cfg`` in both ISO 9660 and the EFI system partition / El Torito image. GRUB will search for the ISO volume and load the ``grub.cfg`` from there. +- Moved GRUB files on ISO 9660 from ``/EFI/BOOT/`` to a boot-platform neutral place ``/boot/grub/``. This does not apply + to the EFI binaries that remain in the default/fallback boot path. Removed ------- diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 00c974e..9acba1a 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -552,8 +552,8 @@ _make_common_bootmode_grub_copy_to_isofs() { if compgen -G "${profile}/grub/!(*.cfg)" &> /dev/null; then files_to_copy+=("${profile}/grub/"!(*.cfg)) fi - install -d -m 0755 -- "${isofs_dir}/EFI/BOOT" - install -m 0644 -- "${files_to_copy[@]}" "${isofs_dir}/EFI/BOOT/" + install -d -m 0755 -- "${isofs_dir}/boot/grub" + install -m 0644 -- "${files_to_copy[@]}" "${isofs_dir}/boot/grub/" } # Prepare GRUB configuration files @@ -608,12 +608,12 @@ fi # Load grub.cfg if [ "${ARCHISO_HINT}" == 'memdisk' -o -z "${ARCHISO_HINT}" ]; then echo 'Could not find the ISO volume!' -elif [ -e "(${ARCHISO_HINT})/EFI/BOOT/grub.cfg" ]; then +elif [ -e "(${ARCHISO_HINT})/boot/grub/grub.cfg" ]; then export ARCHISO_HINT set root="${ARCHISO_HINT}" - configfile "(${ARCHISO_HINT})/EFI/BOOT/grub.cfg" + configfile "(${ARCHISO_HINT})/boot/grub/grub.cfg" else - echo "File '(${ARCHISO_HINT})/EFI/BOOT/grub.cfg' not found!" + echo "File '(${ARCHISO_HINT})/boot/grub/grub.cfg' not found!" fi EOF grubembedcfg="${grubembedcfg//'%UUID_SEARCH_FILENAME%'/"${uuid_search_filename}"}" -- cgit v1.2.3-54-g00ecf From f7502001b0e538bd443cb7ab82539f5aaa7afddb Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 28 Jan 2023 14:04:15 +0200 Subject: configs/*/grub/grub.cfg: reuse ARCHISO_HINT and ARCHISO_UUID passed from the embedded grub.cfg The `grub.cfg` embedded in the GRUB binaries already sets `ARCHISO_HINT` and `ARCHISO_UUID` in most cases. To avoid performing the same searches multiple times, use the existing variables. --- configs/baseline/grub/grub.cfg | 10 +++++++--- configs/releng/grub/grub.cfg | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/configs/baseline/grub/grub.cfg b/configs/baseline/grub/grub.cfg index d606b10..e855ea9 100644 --- a/configs/baseline/grub/grub.cfg +++ b/configs/baseline/grub/grub.cfg @@ -25,9 +25,13 @@ if serial --unit=0 --speed=115200; then fi # Search for the ISO volume -regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" -search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" -probe --set ARCHISO_UUID --fs-uuid "${root}" +if [ -z "${ARCHISO_UUID}" ]; then + if [ -z "${ARCHISO_HINT}" ]; then + regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" + fi + search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" + probe --set ARCHISO_UUID --fs-uuid "${root}" +fi # Set default menu entry default=archlinux diff --git a/configs/releng/grub/grub.cfg b/configs/releng/grub/grub.cfg index eb45a00..88a5d60 100644 --- a/configs/releng/grub/grub.cfg +++ b/configs/releng/grub/grub.cfg @@ -25,9 +25,13 @@ if serial --unit=0 --speed=115200; then fi # Search for the ISO volume -regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" -search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" -probe --set ARCHISO_UUID --fs-uuid "${root}" +if [ -z "${ARCHISO_UUID}" ]; then + if [ -z "${ARCHISO_HINT}" ]; then + regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" + fi + search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" + probe --set ARCHISO_UUID --fs-uuid "${root}" +fi # Set default menu entry default=archlinux -- cgit v1.2.3-54-g00ecf From d96a3569957906eb95a76e302cf75da250cd8337 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 28 Jan 2023 13:57:36 +0200 Subject: mkarchiso: write grubenv in _make_common_bootmode_grub_cfg Add all variables that we replace with values in configuration files. Keep `${isofs_dir}/${install_dir}/grubenv` with fewer variables for backwards compatibility. It will be removed in the future. --- CHANGELOG.rst | 3 +++ README.rst | 2 +- archiso/mkarchiso | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index da1c9ea..0196770 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -24,6 +24,9 @@ Changed the ISO volume and load the ``grub.cfg`` from there. - Moved GRUB files on ISO 9660 from ``/EFI/BOOT/`` to a boot-platform neutral place ``/boot/grub/``. This does not apply to the EFI binaries that remain in the default/fallback boot path. +- Move ``grubenv`` to ``/boot/grub/grubenv`` on ISO 9660 so that it is together with the rest of GRUB-specific files. + Additionally write more variables in it. The previous ``/${install_dir}/grubenv`` (``/arch/grubenv`` for releng) + is deprecated and a future archiso release will not create this file anymore. Removed ------- diff --git a/README.rst b/README.rst index 51cb600..5a544c5 100644 --- a/README.rst +++ b/README.rst @@ -129,7 +129,7 @@ boot the iso image from GRUB with a version specific cow directory to mitigate o .. code:: sh loopback loop archlinux.iso - load_env -f (loop)/arch/grubenv + load_env -f (loop)/boot/grub/grubenv linux (loop)/arch/boot/x86_64/vmlinuz-linux ... \ cow_directory=${NAME}/${VERSION} ... initrd (loop)/arch/boot/x86_64/initramfs-linux-lts.img diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 9acba1a..0ffe0ca 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -618,6 +618,18 @@ fi EOF grubembedcfg="${grubembedcfg//'%UUID_SEARCH_FILENAME%'/"${uuid_search_filename}"}" printf '%s\n' "$grubembedcfg" > "${work_dir}/grub-embed.cfg" + + # Write grubenv + printf '%.1024s' \ + "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\nARCHISO_LABEL=%s\nINSTALL_DIR=%s\nARCH=%s\nUUID_SEARCH_FILENAME=%s\n%s' \ + "${iso_name}" \ + "${iso_version}" \ + "${iso_label}" \ + "${install_dir}" \ + "${arch}" \ + "${uuid_search_filename}" \ + "$(printf '%0.1s' "#"{1..1024})")" \ + > "${work_dir}/grub/grubenv" } _make_bootmode_uefi-ia32.grub.esp() { @@ -1067,6 +1079,10 @@ _export_netboot_artifacts() { _msg_info "Exporting netboot artifacts..." install -d -m 0755 "${out_dir}" cp -a -- "${isofs_dir}/${install_dir}/" "${out_dir}/" + + # Remove grubenv since it serves no purpose in netboot artifacts + rm -f -- "${out_dir}/${install_dir}/grubenv" + _msg_info "Done!" du -hs -- "${out_dir}/${install_dir}" } @@ -1663,7 +1679,13 @@ _make_version() { install -d -m 0755 -- "${isofs_dir}/${install_dir}" # Write version file to ISO 9660 printf '%s\n' "${iso_version}" > "${isofs_dir}/${install_dir}/version" + + fi + if [[ "${buildmode}" == "iso" ]]; then # Write grubenv with version information to ISO 9660 + # TODO: after sufficient time has passed, do not create this file anymore when GRUB boot modes are used. + # _make_common_bootmode_grub_cfg already creates ${isofs_dir}/boot/grub/grubenv + rm -f -- "${isofs_dir}/${install_dir}/grubenv" printf '%.1024s' "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\n%s' \ "${iso_name}" "${iso_version}" "$(printf '%0.1s' "#"{1..1024})")" \ > "${isofs_dir}/${install_dir}/grubenv" -- cgit v1.2.3-54-g00ecf From c8474f8dbe2df8fa9af11e4b3d0bde24bb8b54f9 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Thu, 9 Feb 2023 11:16:52 +0200 Subject: Move the .uuid file to /boot/grub/YYYY-mm-dd-HH-MM-SS-00.uuid To prevent the file from being accidentally missed when someone copies the ISO's contents, let's not place it in a directory that starts with a dot. Since all GRUB related files are in /boot/grub/, put it there too. Instead of using a more unique UUID for the file name, use `YYYY-mm-dd-HH-MM-SS-00.uuid` which matches the ISO's modification date in UTC,i.e. its "UUID". If multiple ISOs would be generated in the exact same second, the ISO 9660 modification date (i.e. its "UUID") would be the same, so there would be not way to distinguish between the volumes anyway. This also makes the file look less suspicious to the casual glance. --- CHANGELOG.rst | 2 +- archiso/mkarchiso | 28 +++++++++++++++------------- configs/baseline/grub/grub.cfg | 2 +- configs/releng/grub/grub.cfg | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0196770..7a83622 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,7 +10,7 @@ Added - Support *file system transposition* to simplify boot medium preparation for UEFI boot via extracting the ISO image contents to a drive. ``grub.cfg`` does not hardcode the ISO volume label anymore, instead GRUB will search for volume - with a ``/.disk/%UUID_SEARCH_FILENAME%.uuid`` file on it. + with a ``/boot/grub/YYYY-mm-dd-HH-MM-SS-00.uuid`` file on it. - Preload GRUB's NTFS modules for UEFI that allegedly have native NTFS support. GRUB's exFAT and UDF modules are also preloaded in case someone finds them useful. diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 0ffe0ca..a543280 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -558,22 +558,24 @@ _make_common_bootmode_grub_copy_to_isofs() { # Prepare GRUB configuration files _make_common_bootmode_grub_cfg(){ - local _cfg uuid_search_filename - - # Create a .uuid file and place it in /.disk/ on ISO 9660 to provide a way for GRUB to search for the volume - uuid_search_filename="$(uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 \ - --name "${SOURCE_DATE_EPOCH} disk search UUID")" - install -d -m 0755 -- "${isofs_dir}/.disk" - : > "${isofs_dir}/.disk/${uuid_search_filename}.uuid" + local _cfg archiso_uuid search_filename install -d -- "${work_dir}/grub" + # Precalculate the ISO's modification date in UTC, i.e. its "UUID" + TZ=UTC printf -v archiso_uuid '%(%F-%H-%M-%S-00)T' "$SOURCE_DATE_EPOCH" + # Create a /boot/grub/YYYY-mm-dd-HH-MM-SS-00.uuid file on ISO 9660. GRUB will search for it to find the ISO + # volume. This is similar to what grub-mkrescue does, except it places the file in /.disk/, but we opt to use a + # directory that does not start with a dot to avoid it being accidentally missed when copying the ISO's contents. + : > "${work_dir}/grub/${archiso_uuid}.uuid" + search_filename="/boot/grub/${archiso_uuid}.uuid" + # Fill GRUB configuration files for _cfg in "${profile}/grub/"*'.cfg'; do sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g; s|%ARCH%|${arch}|g; - s|%UUID_SEARCH_FILENAME%|${uuid_search_filename}|g" \ + s|%ARCHISO_SEARCH_FILENAME%|${search_filename}|g" \ "${_cfg}" > "${work_dir}/grub/${_cfg##*/}" done @@ -596,13 +598,13 @@ if [ -z "${ARCHISO_HINT}" ]; then fi # Search for the ISO volume -if search --no-floppy --set=archiso_device --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}"; then +if search --no-floppy --set=archiso_device --file '%ARCHISO_SEARCH_FILENAME%' --hint "${ARCHISO_HINT}"; then set ARCHISO_HINT="${archiso_device}" if probe --set ARCHISO_UUID --fs-uuid "${ARCHISO_HINT}"; then export ARCHISO_UUID fi else - echo "Could not find a volume with a '/.disk/%UUID_SEARCH_FILENAME%.uuid' file on it!" + echo "Could not find a volume with a '%ARCHISO_SEARCH_FILENAME%' file on it!" fi # Load grub.cfg @@ -616,18 +618,18 @@ else echo "File '(${ARCHISO_HINT})/boot/grub/grub.cfg' not found!" fi EOF - grubembedcfg="${grubembedcfg//'%UUID_SEARCH_FILENAME%'/"${uuid_search_filename}"}" + grubembedcfg="${grubembedcfg//'%ARCHISO_SEARCH_FILENAME%'/"${search_filename}"}" printf '%s\n' "$grubembedcfg" > "${work_dir}/grub-embed.cfg" # Write grubenv printf '%.1024s' \ - "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\nARCHISO_LABEL=%s\nINSTALL_DIR=%s\nARCH=%s\nUUID_SEARCH_FILENAME=%s\n%s' \ + "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\nARCHISO_LABEL=%s\nINSTALL_DIR=%s\nARCH=%s\nARCHISO_SEARCH_FILENAME=%s\n%s' \ "${iso_name}" \ "${iso_version}" \ "${iso_label}" \ "${install_dir}" \ "${arch}" \ - "${uuid_search_filename}" \ + "${search_filename}" \ "$(printf '%0.1s' "#"{1..1024})")" \ > "${work_dir}/grub/grubenv" } diff --git a/configs/baseline/grub/grub.cfg b/configs/baseline/grub/grub.cfg index e855ea9..13043b3 100644 --- a/configs/baseline/grub/grub.cfg +++ b/configs/baseline/grub/grub.cfg @@ -29,7 +29,7 @@ if [ -z "${ARCHISO_UUID}" ]; then if [ -z "${ARCHISO_HINT}" ]; then regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" fi - search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" + search --no-floppy --set=root --file '%ARCHISO_SEARCH_FILENAME%' --hint "${ARCHISO_HINT}" probe --set ARCHISO_UUID --fs-uuid "${root}" fi diff --git a/configs/releng/grub/grub.cfg b/configs/releng/grub/grub.cfg index 88a5d60..c4478e8 100644 --- a/configs/releng/grub/grub.cfg +++ b/configs/releng/grub/grub.cfg @@ -29,7 +29,7 @@ if [ -z "${ARCHISO_UUID}" ]; then if [ -z "${ARCHISO_HINT}" ]; then regexp --set=1:ARCHISO_HINT '^\(([^)]+)\)' "${cmdpath}" fi - search --no-floppy --set=root --file '/.disk/%UUID_SEARCH_FILENAME%.uuid' --hint "${ARCHISO_HINT}" + search --no-floppy --set=root --file '%ARCHISO_SEARCH_FILENAME%' --hint "${ARCHISO_HINT}" probe --set ARCHISO_UUID --fs-uuid "${root}" fi -- cgit v1.2.3-54-g00ecf From a0941539c01951031ac199413d7107d942200b23 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Thu, 26 Jan 2023 16:21:24 +0200 Subject: Move SYSLINUX directory from /syslinux/ to /boot/syslinux/ This allows to reduce the number of top-level directories by one and matches with the GRUB directory move. Most boot loader related things will now be in the /boot/ directory. Fixes #207 --- CHANGELOG.rst | 1 + archiso/mkarchiso | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7a83622..2b58b21 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -27,6 +27,7 @@ Changed - Move ``grubenv`` to ``/boot/grub/grubenv`` on ISO 9660 so that it is together with the rest of GRUB-specific files. Additionally write more variables in it. The previous ``/${install_dir}/grubenv`` (``/arch/grubenv`` for releng) is deprecated and a future archiso release will not create this file anymore. +- Moved syslinux directory from ``/syslinux/`` to ``/boot/syslinux/`` to keep most boot loader files in ``/boot/``. Removed ------- diff --git a/archiso/mkarchiso b/archiso/mkarchiso index a543280..e0806bd 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -443,30 +443,30 @@ _make_boot_on_iso9660() { # Prepare syslinux for booting from MBR (isohybrid) _make_bootmode_bios.syslinux.mbr() { _msg_info "Setting up SYSLINUX for BIOS booting from a disk..." - install -d -m 0755 -- "${isofs_dir}/syslinux" + install -d -m 0755 -- "${isofs_dir}/boot/syslinux" for _cfg in "${profile}/syslinux/"*.cfg; do sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g; s|%ARCH%|${arch}|g" \ - "${_cfg}" > "${isofs_dir}/syslinux/${_cfg##*/}" + "${_cfg}" > "${isofs_dir}/boot/syslinux/${_cfg##*/}" done if [[ -e "${profile}/syslinux/splash.png" ]]; then - install -m 0644 -- "${profile}/syslinux/splash.png" "${isofs_dir}/syslinux/" + install -m 0644 -- "${profile}/syslinux/splash.png" "${isofs_dir}/boot/syslinux/" fi - install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/"*.c32 "${isofs_dir}/syslinux/" - install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/lpxelinux.0" "${isofs_dir}/syslinux/" - install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/memdisk" "${isofs_dir}/syslinux/" + install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/"*.c32 "${isofs_dir}/boot/syslinux/" + install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/lpxelinux.0" "${isofs_dir}/boot/syslinux/" + install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/memdisk" "${isofs_dir}/boot/syslinux/" _run_once _make_boot_on_iso9660 - if [[ -e "${isofs_dir}/syslinux/hdt.c32" ]]; then - install -d -m 0755 -- "${isofs_dir}/syslinux/hdt" + if [[ -e "${isofs_dir}/boot/syslinux/hdt.c32" ]]; then + install -d -m 0755 -- "${isofs_dir}/boot/syslinux/hdt" if [[ -e "${pacstrap_dir}/usr/share/hwdata/pci.ids" ]]; then gzip -cn9 "${pacstrap_dir}/usr/share/hwdata/pci.ids" > \ - "${isofs_dir}/syslinux/hdt/pciids.gz" + "${isofs_dir}/boot/syslinux/hdt/pciids.gz" fi find "${pacstrap_dir}/usr/lib/modules" -name 'modules.alias' -print -exec gzip -cn9 '{}' ';' -quit > \ - "${isofs_dir}/syslinux/hdt/modalias.gz" + "${isofs_dir}/boot/syslinux/hdt/modalias.gz" fi # Add other aditional/extra files to ${install_dir}/boot/ @@ -482,9 +482,9 @@ _make_bootmode_bios.syslinux.mbr() { # Prepare syslinux for El-Torito booting _make_bootmode_bios.syslinux.eltorito() { _msg_info "Setting up SYSLINUX for BIOS booting from an optical disc..." - install -d -m 0755 -- "${isofs_dir}/syslinux" - install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/isolinux.bin" "${isofs_dir}/syslinux/" - install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/isohdpfx.bin" "${isofs_dir}/syslinux/" + install -d -m 0755 -- "${isofs_dir}/boot/syslinux" + install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/isolinux.bin" "${isofs_dir}/boot/syslinux/" + install -m 0644 -- "${pacstrap_dir}/usr/lib/syslinux/bios/isohdpfx.bin" "${isofs_dir}/boot/syslinux/" # ISOLINUX and SYSLINUX installation is shared _run_once _make_bootmode_bios.syslinux.mbr @@ -1288,9 +1288,9 @@ _validate_requirements_buildmode_netboot() { _add_xorrisofs_options_bios.syslinux.eltorito() { xorrisofs_options+=( # El Torito boot image for x86 BIOS - '-eltorito-boot' 'syslinux/isolinux.bin' + '-eltorito-boot' 'boot/syslinux/isolinux.bin' # El Torito boot catalog file - '-eltorito-catalog' 'syslinux/boot.cat' + '-eltorito-catalog' 'boot/syslinux/boot.cat' # Required options to boot with ISOLINUX '-no-emul-boot' '-boot-load-size' '4' '-boot-info-table' ) @@ -1300,7 +1300,7 @@ _add_xorrisofs_options_bios.syslinux.eltorito() { _add_xorrisofs_options_bios.syslinux.mbr() { xorrisofs_options+=( # SYSLINUX MBR bootstrap code; does not work without "-eltorito-boot syslinux/isolinux.bin" - '-isohybrid-mbr' "${isofs_dir}/syslinux/isohdpfx.bin" + '-isohybrid-mbr' "${isofs_dir}/boot/syslinux/isohdpfx.bin" # When GPT is used, create an additional partition in the MBR (besides 0xEE) for sectors 0–1 (MBR # bootstrap code area) and mark it as bootable # May allow booting on some systems -- cgit v1.2.3-54-g00ecf From 04d439d1b74b03880fda807246aa147ec71791c7 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 18 Feb 2023 10:52:08 +0200 Subject: Rename docs/README.transfer to docs/README.transfer.rst --- docs/README.transfer | 133 ----------------------------------------------- docs/README.transfer.rst | 133 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 133 deletions(-) delete mode 100644 docs/README.transfer create mode 100644 docs/README.transfer.rst diff --git a/docs/README.transfer b/docs/README.transfer deleted file mode 100644 index f366061..0000000 --- a/docs/README.transfer +++ /dev/null @@ -1,133 +0,0 @@ -INDEX ------ - -* Transfer ISO file to target medium (configs/releng) - * To -> CD / DVD / BD - * To -> USB-key / SD / HDD / SSD - * PC-BIOS (MBR) - * PC-BIOS (ISOHYBRID-MBR) - * PC-EFI (GPT) [x86_64 only] - * PC-EFI (ISOHYBRID-GPT) [x86_64 only] - - - -*** Transfer ISO image to target medium (configs/releng) - -ISO images names consist of: archlinux-..
-x86_64.iso - -Where: - Year - Month -
Day - - -** To -> CD / DVD / BD - -Note: All ISO images are booteable on a PC-BIOS via "El Torito" in no-emulation mode, - All x86_64 ISO images are booteable on a PC-EFI via "El Torito" in no-emulation mode. - -Nomeclature: - scsibus number - target number - lun number - (Note: see cdrecord -scanbus, for these numbers) - - -1) Write it directly using your favorite recording program. -# cdrecord dev=,, -dao archlinux-..
-x86_64.iso - - -** To -> USB Flash Drive (USB-key) / Memory card (SD) / - Hard-Disk Drive (HDD) / Solid-State Drive (SSD) - -Note: These steps are the general workflow, you can skip some of them, - using another filesystem if your bootloader supports it, - installing to another directory than "arch/" or using more than - one partition. Just ensure that main boot params options - (archisolabel= and archisobasedir=) are set correctly according to your setup. - -Nomeclature: -: Device node of the drive where ISO contents should be copied - (example: /dev/sdx) -: Device node of the partition on - (example: /dev/sdx1) -: Mount point path where is mounted - (example: /mnt/sdx/1) -: Path to the ISO file archlinux-..
-x86_64.iso - (example: ~/archlinux-2017.03.01-x86_64.iso) -: Represents the filesystem label of the - (example: ARCH_201703) - - -* PC-BIOS (MBR): - -Note: Using here a MBR partition mode as example, but GPT should also works - if machine firmware is not broken. - Just ensure that partition is set with attribute "2: legacy BIOS bootable" - and use gptmbr.bin instead of mbr.bin for syslinux. - -1) Create one partition entry in MBR and mark it as "active" (booteable). -Note: Type "b" for FAT32, "83" for EXTFS or "7" for NTFS. -# fdisk - -2) Create a FAT32, EXTFS or NTFS filesystem on such partition and setup a label. -Note: COW is not supported on NTFS. -# mkfs.fat -F 32 -n -# mkfs.ext4 -L -# mkfs.ntfs -L - -3) Mount target filesystem. -# mount - -4) Extract ISO image on target filesystem. -# bsdtar -x --exclude=isolinux/ --exclude=EFI/ --exclude=loader/ -f -C - -5) Install syslinux bootloader on target filesystem. -# extlinux -i /arch/boot/syslinux - -6) Unmount target filesystem. -# umount - -7) Install syslinux MBR boot code on target drive. -# dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/mbr.bin of= - - -* PC-BIOS (ISOHYBRID-MBR): - -Note: This method is the most easily, quick and dirty, but is the most limited - if you want to use your target medium for other purposes. - If using this does not work, use PC-BIOS (MBR) method instead. - -1) Dump ISO file to target medium. -# dd if= of= - - -* PC-EFI (GPT) [x86_64 only] - -Note: Using here a GPT partition mode as example, but MBR should also works - if machine firmware is not broken. - -1) Create one partition entry in GPT (of type "ef00") -# gdisk - -2) Create a FAT32 filesystem on such partition and setup a label. -# mkfs.fat -F 32 -n - -3) Mount target filesystem. -# mount - -4) Extract ISO image on target filesystem. -# bsdtar -x --exclude=isolinux/ --exclude=EFI/archiso/ --exclude=arch/boot/syslinux/ -f -C - -5) Unmount target filesystem. -# umount - - -* PC-EFI (ISOHYBRID-GPT) [x86_64 only] - -Note: This method is the most easily, quick and dirty, but is the most limited - if you want to use your target medium for other purposes. - If using this does not work, use PC-EFI (GPT) method instead. - -1) Dump ISO file to target medium. -# dd if= of= diff --git a/docs/README.transfer.rst b/docs/README.transfer.rst new file mode 100644 index 0000000..f366061 --- /dev/null +++ b/docs/README.transfer.rst @@ -0,0 +1,133 @@ +INDEX +----- + +* Transfer ISO file to target medium (configs/releng) + * To -> CD / DVD / BD + * To -> USB-key / SD / HDD / SSD + * PC-BIOS (MBR) + * PC-BIOS (ISOHYBRID-MBR) + * PC-EFI (GPT) [x86_64 only] + * PC-EFI (ISOHYBRID-GPT) [x86_64 only] + + + +*** Transfer ISO image to target medium (configs/releng) + +ISO images names consist of: archlinux-..
-x86_64.iso + +Where: + Year + Month +
Day + + +** To -> CD / DVD / BD + +Note: All ISO images are booteable on a PC-BIOS via "El Torito" in no-emulation mode, + All x86_64 ISO images are booteable on a PC-EFI via "El Torito" in no-emulation mode. + +Nomeclature: + scsibus number + target number + lun number + (Note: see cdrecord -scanbus, for these numbers) + + +1) Write it directly using your favorite recording program. +# cdrecord dev=,, -dao archlinux-..
-x86_64.iso + + +** To -> USB Flash Drive (USB-key) / Memory card (SD) / + Hard-Disk Drive (HDD) / Solid-State Drive (SSD) + +Note: These steps are the general workflow, you can skip some of them, + using another filesystem if your bootloader supports it, + installing to another directory than "arch/" or using more than + one partition. Just ensure that main boot params options + (archisolabel= and archisobasedir=) are set correctly according to your setup. + +Nomeclature: +: Device node of the drive where ISO contents should be copied + (example: /dev/sdx) +: Device node of the partition on + (example: /dev/sdx1) +: Mount point path where is mounted + (example: /mnt/sdx/1) +: Path to the ISO file archlinux-..
-x86_64.iso + (example: ~/archlinux-2017.03.01-x86_64.iso) +: Represents the filesystem label of the + (example: ARCH_201703) + + +* PC-BIOS (MBR): + +Note: Using here a MBR partition mode as example, but GPT should also works + if machine firmware is not broken. + Just ensure that partition is set with attribute "2: legacy BIOS bootable" + and use gptmbr.bin instead of mbr.bin for syslinux. + +1) Create one partition entry in MBR and mark it as "active" (booteable). +Note: Type "b" for FAT32, "83" for EXTFS or "7" for NTFS. +# fdisk + +2) Create a FAT32, EXTFS or NTFS filesystem on such partition and setup a label. +Note: COW is not supported on NTFS. +# mkfs.fat -F 32 -n +# mkfs.ext4 -L +# mkfs.ntfs -L + +3) Mount target filesystem. +# mount + +4) Extract ISO image on target filesystem. +# bsdtar -x --exclude=isolinux/ --exclude=EFI/ --exclude=loader/ -f -C + +5) Install syslinux bootloader on target filesystem. +# extlinux -i /arch/boot/syslinux + +6) Unmount target filesystem. +# umount + +7) Install syslinux MBR boot code on target drive. +# dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/mbr.bin of= + + +* PC-BIOS (ISOHYBRID-MBR): + +Note: This method is the most easily, quick and dirty, but is the most limited + if you want to use your target medium for other purposes. + If using this does not work, use PC-BIOS (MBR) method instead. + +1) Dump ISO file to target medium. +# dd if= of= + + +* PC-EFI (GPT) [x86_64 only] + +Note: Using here a GPT partition mode as example, but MBR should also works + if machine firmware is not broken. + +1) Create one partition entry in GPT (of type "ef00") +# gdisk + +2) Create a FAT32 filesystem on such partition and setup a label. +# mkfs.fat -F 32 -n + +3) Mount target filesystem. +# mount + +4) Extract ISO image on target filesystem. +# bsdtar -x --exclude=isolinux/ --exclude=EFI/archiso/ --exclude=arch/boot/syslinux/ -f -C + +5) Unmount target filesystem. +# umount + + +* PC-EFI (ISOHYBRID-GPT) [x86_64 only] + +Note: This method is the most easily, quick and dirty, but is the most limited + if you want to use your target medium for other purposes. + If using this does not work, use PC-EFI (GPT) method instead. + +1) Dump ISO file to target medium. +# dd if= of= -- cgit v1.2.3-54-g00ecf From 1da743cc4ea0dc344e46d3f760ccdfec5c9baecf Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 18 Feb 2023 12:39:27 +0200 Subject: README.transfer.rst: update instructions Convert the file to reStructuredText markup. Fixes #39. Rewrite the instructions where possible or otherwise update them. E.g. fix the changed boot loader paths, etc. The "Manual formatting (BIOS only)", previosly "PC-BIOS (ISOHYBRID-MBR)", method is not tested and it is not clear if it still even works. --- CHANGELOG.rst | 1 + docs/README.transfer.rst | 212 +++++++++++++++++++++++++++-------------------- 2 files changed, 123 insertions(+), 90 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2b58b21..d6bca3a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -28,6 +28,7 @@ Changed Additionally write more variables in it. The previous ``/${install_dir}/grubenv`` (``/arch/grubenv`` for releng) is deprecated and a future archiso release will not create this file anymore. - Moved syslinux directory from ``/syslinux/`` to ``/boot/syslinux/`` to keep most boot loader files in ``/boot/``. +- Update ``README.transfer`` documentation and convert it to reStructuredText. Removed ------- diff --git a/docs/README.transfer.rst b/docs/README.transfer.rst index f366061..ab99b10 100644 --- a/docs/README.transfer.rst +++ b/docs/README.transfer.rst @@ -1,133 +1,165 @@ -INDEX ------ +============================================== +Transfer ISO to target medium (configs/releng) +============================================== -* Transfer ISO file to target medium (configs/releng) - * To -> CD / DVD / BD - * To -> USB-key / SD / HDD / SSD - * PC-BIOS (MBR) - * PC-BIOS (ISOHYBRID-MBR) - * PC-EFI (GPT) [x86_64 only] - * PC-EFI (ISOHYBRID-GPT) [x86_64 only] +ISO images names consist of: ``archlinux-YYYY.MM.DD-x86_64.iso``. +Where: ``YYYY`` is the year, ``MM`` the month and ``DD`` the day. +.. contents:: -*** Transfer ISO image to target medium (configs/releng) +Burn to an optical disc +======================= -ISO images names consist of: archlinux-..
-x86_64.iso + .. note:: + All ISO images are BIOS and UEFI bootable via "El Torito" in no-emulation mode. -Where: - Year - Month -
Day +Burn the ISO using your favorite disc burning program. +For example: -** To -> CD / DVD / BD +.. code:: sh -Note: All ISO images are booteable on a PC-BIOS via "El Torito" in no-emulation mode, - All x86_64 ISO images are booteable on a PC-EFI via "El Torito" in no-emulation mode. + xorriso -as cdrecord -v -sao dev=/dev/sr0 archlinux-YYYY.MM.DD-x86_64.iso + +Write to an USB flash drive / memory card / hard disk drive / solid state drive / etc. +====================================================================================== + + .. tip:: + See https://wiki.archlinux.org/title/USB_flash_installation_medium for more detailed instructions. Nomeclature: - scsibus number - target number - lun number - (Note: see cdrecord -scanbus, for these numbers) +```` + Device node of the drive where ISO contents should be copied (example: ``/dev/sdx``). +```` + Device node of the partition on ```` (example: ``/dev/sdx1``). +```` + Represents the file system label of the ``archlinux-YYYY.MM.DD-x86_64.iso`` (example: ``ARCH_201703``). -1) Write it directly using your favorite recording program. -# cdrecord dev=,, -dao archlinux-..
-x86_64.iso +ISOHYBRID (BIOS and UEFI) +------------------------- + .. note:: + This method is the most easily, quick and dirty, but is the most limited if you want to use your target medium + for other purposes. If using this does not work, use the `File system transposition (UEFI only)`_ method instead. -** To -> USB Flash Drive (USB-key) / Memory card (SD) / - Hard-Disk Drive (HDD) / Solid-State Drive (SSD) +Directly write the ISO file to the target medium: -Note: These steps are the general workflow, you can skip some of them, - using another filesystem if your bootloader supports it, - installing to another directory than "arch/" or using more than - one partition. Just ensure that main boot params options - (archisolabel= and archisobasedir=) are set correctly according to your setup. +.. code:: sh -Nomeclature: -: Device node of the drive where ISO contents should be copied - (example: /dev/sdx) -: Device node of the partition on - (example: /dev/sdx1) -: Mount point path where is mounted - (example: /mnt/sdx/1) -: Path to the ISO file archlinux-..
-x86_64.iso - (example: ~/archlinux-2017.03.01-x86_64.iso) -: Represents the filesystem label of the - (example: ARCH_201703) + dd bs=4M if=archlinux-YYYY.MM.DD-x86_64.iso of= conv=fsync oflag=direct status=progress + +File system transposition (UEFI only) +-------------------------------- + +This method extracts the contents of the ISO onto a prepared UEFI-bootable volume. + +If your drive is already partitioned and formatted, skip to the "Mount the target file system" step. + + .. note:: + Using MBR with one FAT formatted active partition is the most compatible method. + +1. Partition the drive with *fdisk*. + + .. code:: sh + + fdisk + + 1) Create a new MBR partition table with command ``o``. + + .. warning:: + This will destroy all data on the drive. + + 2) Create a new primary partition with command ``n`` and set its type code to ``0c`` with command ``t``. + + 3) Mark the partition as bootable with the ``a`` command. + + 4) Write the changes and exit with ``w``. + +2. Format the newly created partition to FAT32 + + .. code:: sh + + mkfs.fat -F 32 /dev/disk/by-id/-part1 + +3. Mount the target file system + + .. code:: sh + + mount /mnt + +4. Extract the ISO image on the target file system. + + .. code:: sh + + bsdtar -x --exclude=boot/syslinux/ -f archlinux-YYYY.MM.DD-x86_64.iso -C /mnt + +5. Unmount the target file system. + + .. code:: sh + + umount /mnt + +Manual formatting (BIOS only) +----------------------------- + .. note:: + These steps are the general workflow, you can skip some of them, using another file system if your boot loader + supports it, installing to another directory than ``arch/`` or using more than one partition. Just ensure that + main boot parameters (``archisolabel=`` and ``archisobasedir=``) are set correctly according to your setup. -* PC-BIOS (MBR): + Using here a MBR partition mode as example, but GPT should also work if the machine firmware is not broken. Just + ensure that partition is set with attribute ``2: legacy BIOS bootable`` and use ``gptmbr.bin`` instead of + ``mbr.bin`` for syslinux. -Note: Using here a MBR partition mode as example, but GPT should also works - if machine firmware is not broken. - Just ensure that partition is set with attribute "2: legacy BIOS bootable" - and use gptmbr.bin instead of mbr.bin for syslinux. +1) Create one partition entry in MBR and mark it as "active" (bootable). -1) Create one partition entry in MBR and mark it as "active" (booteable). -Note: Type "b" for FAT32, "83" for EXTFS or "7" for NTFS. -# fdisk + .. note:: + Type ``b`` for FAT32, ``83`` for EXTFS or ``7`` for NTFS. -2) Create a FAT32, EXTFS or NTFS filesystem on such partition and setup a label. -Note: COW is not supported on NTFS. -# mkfs.fat -F 32 -n -# mkfs.ext4 -L -# mkfs.ntfs -L + .. code:: sh -3) Mount target filesystem. -# mount + fdisk -4) Extract ISO image on target filesystem. -# bsdtar -x --exclude=isolinux/ --exclude=EFI/ --exclude=loader/ -f -C +2) Create a FAT32, EXTFS or NTFS file system on such partition and setup a label. -5) Install syslinux bootloader on target filesystem. -# extlinux -i /arch/boot/syslinux + .. note:: + COW is not supported on NTFS. -6) Unmount target filesystem. -# umount + .. code:: sh -7) Install syslinux MBR boot code on target drive. -# dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/mbr.bin of= + mkfs.fat -F 32 -n + mkfs.ext4 -L + mkfs.ntfs -L +3) Mount the target file system. -* PC-BIOS (ISOHYBRID-MBR): + .. code:: sh -Note: This method is the most easily, quick and dirty, but is the most limited - if you want to use your target medium for other purposes. - If using this does not work, use PC-BIOS (MBR) method instead. + mount /mnt -1) Dump ISO file to target medium. -# dd if= of= +4) Extract the ISO image on the target file system. + .. code:: sh -* PC-EFI (GPT) [x86_64 only] + bsdtar -x --exclude=boot/grub/ --exclude=EFI/ -f archlinux-YYYY.MM.DD-x86_64.iso -C /mnt -Note: Using here a GPT partition mode as example, but MBR should also works - if machine firmware is not broken. +5) Install the syslinux boot loader on the target file system. -1) Create one partition entry in GPT (of type "ef00") -# gdisk + .. code:: sh -2) Create a FAT32 filesystem on such partition and setup a label. -# mkfs.fat -F 32 -n + extlinux -i /mnt/boot/syslinux -3) Mount target filesystem. -# mount +6) Unmount the target file system. -4) Extract ISO image on target filesystem. -# bsdtar -x --exclude=isolinux/ --exclude=EFI/archiso/ --exclude=arch/boot/syslinux/ -f -C + .. code:: sh -5) Unmount target filesystem. -# umount + umount /mnt +7) Install syslinux MBR boot code on the target drive. -* PC-EFI (ISOHYBRID-GPT) [x86_64 only] + .. code:: sh -Note: This method is the most easily, quick and dirty, but is the most limited - if you want to use your target medium for other purposes. - If using this does not work, use PC-EFI (GPT) method instead. + dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/mbr.bin of= -1) Dump ISO file to target medium. -# dd if= of= -- cgit v1.2.3-54-g00ecf From cedb3d142c470511ba1bb86fa987fd9bb39501d2 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Wed, 22 Feb 2023 10:57:27 +0200 Subject: configs/*/grub/grub.cfg: replace /dev/disk/by-uuid/ with UUID= Use the shorter and more nicer looking `UUID=` *tags* instead of the `/dev/disk/by-uuid/` paths. This requires mkinitcpio-archiso v68. Related to #202 --- configs/baseline/grub/grub.cfg | 2 +- configs/releng/grub/grub.cfg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/baseline/grub/grub.cfg b/configs/baseline/grub/grub.cfg index 13043b3..ed56578 100644 --- a/configs/baseline/grub/grub.cfg +++ b/configs/baseline/grub/grub.cfg @@ -43,6 +43,6 @@ timeout_style=menu menuentry "Arch Linux (x86_64, UEFI)" --class arch --class gnu-linux --class gnu --class os --id 'archlinux' { set gfxpayload=keep - linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=/dev/disk/by-uuid/${ARCHISO_UUID} + linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=UUID=${ARCHISO_UUID} initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img } diff --git a/configs/releng/grub/grub.cfg b/configs/releng/grub/grub.cfg index c4478e8..1882e49 100644 --- a/configs/releng/grub/grub.cfg +++ b/configs/releng/grub/grub.cfg @@ -45,13 +45,13 @@ play 600 988 1 1319 4 menuentry "Arch Linux install medium (x86_64, UEFI)" --class arch --class gnu-linux --class gnu --class os --id 'archlinux' { set gfxpayload=keep - linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=/dev/disk/by-uuid/${ARCHISO_UUID} + linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=UUID=${ARCHISO_UUID} initrd /%INSTALL_DIR%/boot/intel-ucode.img /%INSTALL_DIR%/boot/amd-ucode.img /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img } menuentry "Arch Linux install medium with speakup screen reader (x86_64, UEFI)" --hotkey s --class arch --class gnu-linux --class gnu --class os --id 'archlinux-accessibility' { set gfxpayload=keep - linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=/dev/disk/by-uuid/${ARCHISO_UUID} accessibility=on + linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux archisobasedir=%INSTALL_DIR% archisodevice=UUID=${ARCHISO_UUID} accessibility=on initrd /%INSTALL_DIR%/boot/intel-ucode.img /%INSTALL_DIR%/boot/amd-ucode.img /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img } -- cgit v1.2.3-54-g00ecf