diff --git a/.gitignore b/.gitignore index 2113d9e..af17990 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +edit-*.sh out +rebuild-*.sh +transfer-*.sh work diff --git a/README.md b/README.md index d07ddf6..c7db59d 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,56 @@ -# SystemRescue +# SystemRescue+ZFS -## Project website -Homepage: https://www.system-rescue.org/ +**SystemRescue+ZFS** is a fork of the [SystemRescue](http://www.system-rescue.org/) Linux distribution (based on [Arch Linux](https://www.archlinux.org)) with improvements such as: -## Project sources -This git repository contains SystemRescue sources files. This is based on -https://gitlab.archlinux.org/archlinux/archiso/ +* [ZFS](https://github.com/archzfs/archzfs/) support built-in +* [Serial console](#serial-console) enabled at the bootloader stage +* Shortened automatic boot timeout of 30 seconds +* Build process improvements +* Extra polish -## Building SystemRescue -SystemRescue can be built for x86_64 or i686 architectures. It must be built -on archlinux if you want to build a 64bit edition, or archlinux32 if you want -to create a 32bit edition. The following packages must be installed on the -build system: archiso, grub, mtools, edk2-shell. You need to use a modified -version of archiso for the build to work and for additional fixes and features -to be present. You can find the required archiso version and patches in the -"patches" folder in this git repository. +## Serial Console -The package list contains packages which are not part of the official binary -package repositories. These packages need to be built from sources from the AUR -website. These sources are made of at least a PKGBUILD file and quite often -other related files, such as patches. These can be built using the makepkg -command which generates binary packages. These binary packages must be copied to -a custom package repository which can be hosted locally using httpd or nginx. -The repo-add command must be used to generate the repository package index. -The pacman.conf file must be updated with the address of this repository so -custom packages can be accessed. +Serial I/O is enabled by default on `COM1`/`ttyS0` at 115,200 baud. If your serial console is on another port or requires a different speed, make adjustments in the following places and [rebuild](#build) the image. -The build process can be started by running the build.sh script. It will create -a large "work" sub-directory and the ISO file will be written in the "out" -sub-directory. +1. [GRUB](https://www.gnu.org/software/grub/manual/grub/grub.html) (**UEFI boot**): `serial --speed=115200 efi0` in `./efiboot/grub/grubsrcd.cfg` +2. [SYSLINUX](https://wiki.syslinux.org/wiki/index.php?title=SYSLINUX) (**BIOS boot**): `SERIAL 0 115200` in `./syslinux/sysresccd_head.cfg` +3. [Kernel](https://www.kernel.org/doc/html/latest/admin-guide/serial-console.html) (**post-boot**): `console=ttyS0,115200` in `./build.sh` + +## Building + +`$ sudo ./build.sh -v` + +### Dependencies + +* [Arch Linux](https://www.archlinux.org) with the following packages installed: + * `arch-install-scripts` + * `archiso` (in a version matching [these patches](patches/)) + * `base-devel` + * `grub` + * `mkinitcpio-archiso` (for `archiso` versions ≥ 45) + * `mtools` +* `archiso` with [these patches](patches/) applied. +* [This key](https://github.com/archzfs/archzfs/wiki#using-the-archzfs-repository) (to avoid an _"unknown trust"_ error during building of the `archzfs` package). + +### Rebuilds + +The state of successfully completed [build steps](#steps) is persisted in `./work/build.make_*` files. If such a file is present for a given build step, `./build.sh` will skip that step indefinitely going forward. Before a rebuild, you must remove these state files to ensure that the appropriate build steps are re-executed and any customizations actually take effect. + +* **Full rebuild (recommended):** `# rm ./work/build.make_*` +* **Partial rebuild:** Delete the state file for the **earliest** affected step and **all steps that come after it**. For example, if you have customized the GRUB (UEFI boot) configuration, you must remove `build.make_efi` and its successors `build.make_efiboot`, `build.make_prepare` and `build.make_iso`. + +### Steps + +1. `make_pacman_conf` +2. `make_basefs` +3. `make_packages` +4. `make_customize_airootfs` +5. `make_setup_mkinitcpio` +6. `make_boot` +7. `make_boot_extra` +8. `make_syslinux` +9. `make_isolinux` +10. `make_efi` +11. `make_efiboot` +12. `make_prepare` +13. `make_iso` diff --git a/VERSION b/VERSION index 321f3da..3b86a9b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.01 +7.01+2.0.0 diff --git a/airootfs/etc/issue b/airootfs/etc/issue index 7782b7c..c88ab0e 100644 --- a/airootfs/etc/issue +++ b/airootfs/etc/issue @@ -1,12 +1,13 @@ -\e[01;31m ========= \e[01;37mSystemRescue %ISO_VERSION% (%ISO_ARCH%)\e[01;31m ======== \e[01;37m\l\e[00;37m/6\e[01;31m ========= - \e[00;31mhttps://www.system-rescue.org/ +\e[01;31m============== \e[01;37m%ISO_APPLICATION% %ISO_VERSION%\e[01;31m --- \e[01;37m\l \e[01;31m============== + \e[00;31mhttp://www.system-rescue.org/ + \e[00;37m%ISO_PUBLISHER% -\e[00;31m*\e[01;31m Console environment\e[00;37m : - Run \e[01;37msetkmap\e[00;37m to choose the keyboard layout +\e[00;31m*\e[01;31m Console environment: + Run \e[01;37msetkmap\e[00;37m to choose the keyboard layout. -\e[00;31m*\e[01;31m Graphical environment\e[00;37m : - Type \e[01;37mstartx\e[00;37m to run the graphical environment - X.Org comes with the XFCE environment and several graphical tools: - \e[00;31m-\e[00;37m Partition manager: .. \e[01;37mgparted\e[00;37m - \e[00;31m-\e[00;37m Web browser: ........ \e[01;37mfirefox\e[00;37m - \e[00;31m-\e[00;37m Text editor: ........ \e[01;37mfeatherpad\e[00;37m +\e[00;31m*\e[01;31m Graphical environment: + Type \e[01;37mstartx\e[00;37m to run the graphical environment. + X.Org comes with the XFCE environment and several graphical tools: + \e[00;31m-\e[00;37m Partition manager: \e[01;37mgparted\e[00;37m + \e[00;31m-\e[00;37m Web browser: \e[01;37mfirefox\e[00;37m + \e[00;31m-\e[00;37m Text editor: \e[01;37mfeatherpad\e[00;37m diff --git a/airootfs/root/customize_airootfs.sh b/airootfs/root/customize_airootfs.sh index d546d64..f87d426 100755 --- a/airootfs/root/customize_airootfs.sh +++ b/airootfs/root/customize_airootfs.sh @@ -82,6 +82,11 @@ sed -i -e '/# ==== BEGIN sysrescuerepo ====/,/# ==== END sysrescuerepo ====/d' / # Customizations /usr/bin/updatedb +# Trust archzfs key +pacman-key --init +pacman-key -r DDF7DB817396A49B2A2723F7403BD972F75D9D76 +pacman-key --lsign-key DDF7DB817396A49B2A2723F7403BD972F75D9D76 + # Packages pacman -Q > /root/packages-list.txt expac -H M -s "%-30n %m" | sort -rhk 2 > /root/packages-size.txt diff --git a/build.sh b/build.sh index 96d8af4..2b1b930 100755 --- a/build.sh +++ b/build.sh @@ -5,12 +5,11 @@ set -e -u script_path=$(readlink -f ${0%/*}) version_file="${script_path}/VERSION" -iso_name=systemrescue +iso_application="SystemRescue+ZFS" iso_version="$(<${version_file})" -iso_mainver="${iso_version%-*}" -iso_label="RESCUE${iso_mainver//.}" -iso_publisher="SystemRescue " -iso_application="SystemRescue" +iso_name=$(echo "$iso_application" | tr '[:upper:]' '[:lower:]') +iso_label="${iso_application}_${iso_version}" +iso_publisher='Blazis Technologies ' install_dir=sysresccd work_dir=work out_dir=out @@ -19,6 +18,7 @@ arch="$(uname -m)" sfs_comp="xz" sfs_opts="-Xbcj x86 -b 512k -Xdict-size 512k" +consoles='console=ttyS0,115200 console=tty0' verbose="" umask 0022 @@ -69,8 +69,14 @@ _usage () # Helper function to run make_*() only one time per architecture. run_once() { if [[ ! -e ${work_dir}/build.${1} ]]; then + echo -e '\n================================================================================' + echo "$1" + echo '================================================================================' $1 touch ${work_dir}/build.${1} + echo -e '\nDone.' + else + echo -e "\nSkipping $1." fi } @@ -88,7 +94,7 @@ make_basefs() { # Additional packages (airootfs) make_packages() { - setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -p "$(grep -h -v '^#' ${script_path}/packages)" install + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -p "$(echo $(grep -h -v '^#' ${script_path}/packages))" install } # Customize installation (airootfs) @@ -99,7 +105,8 @@ make_customize_airootfs() { cp ${version_file} ${work_dir}/${arch}/airootfs/root/version - sed "s|%ARCHISO_LABEL%|${iso_label}|g; + sed "s|%ISO_APPLICATION%|${iso_application}|g; + s|%ISO_PUBLISHER%|$(echo "$iso_publisher" | sed -r 's/<(.+)>/<\\\\e[01;37m\1\\\\e[00;37m>/')|g; s|%ISO_VERSION%|${iso_version}|g; s|%ISO_ARCH%|${arch}|g; s|%INSTALL_DIR%|${install_dir}|g" \ @@ -159,6 +166,9 @@ make_syslinux() { mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux for _cfg in ${script_path}/syslinux/*.cfg; do sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%CONSOLES%|${consoles}|g; + s|%ISO_APPLICATION%|${iso_application}|g; + s|%ISO_URL%|$(echo $iso_publisher | sed -r 's/.*<.+\/\/(.+)>.*/\1/')|g; s|%ISO_VERSION%|${iso_version}|g; s|%ISO_ARCH%|${arch}|g; s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/iso/${install_dir}/boot/syslinux/${_cfg##*/} @@ -187,8 +197,9 @@ make_efi() { mkdir -p ${work_dir}/iso/EFI/boot mkdir -p ${work_dir}/iso/boot/grub cp -a /usr/lib/grub/${efiarch} ${work_dir}/iso/boot/grub/ - cp ${script_path}/efiboot/grub/font.pf2 ${work_dir}/iso/boot/grub/ sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%CONSOLES%|${consoles}|g; + s|%ISO_APPLICATION%|${iso_application}|g; s|%ISO_VERSION%|${iso_version}|g; s|%ISO_ARCH%|${arch}|g; s|%INSTALL_DIR%|${install_dir}|g" \ @@ -262,6 +273,14 @@ while getopts 'N:V:L:P:A:D:w:o:g:vh' arg; do esac done +if [ "$verbose" = '-v' ]; then + echo -e "\nVolume label:\t$iso_label" + echo -e "Publisher:\t$iso_publisher" + echo -e "ISO file:\t$out_dir/$iso_name-${iso_version}.iso" + echo -e "Install path:\t$install_dir" + echo -e "Work path:\t$work_dir" +fi + mkdir -p ${work_dir} run_once make_pacman_conf diff --git a/efiboot/grub/grubsrcd.cfg b/efiboot/grub/grubsrcd.cfg index c513d83..385c13a 100644 --- a/efiboot/grub/grubsrcd.cfg +++ b/efiboot/grub/grubsrcd.cfg @@ -1,52 +1,46 @@ # Global options -set timeout=90 +set timeout=30 set default=0 set fallback=1 set pager=1 -# Display settings -if loadfont /boot/grub/font.pf2 ; then - set gfxmode=640x480 - set color_normal=black/cyan - set color_highlight=black/light-gray - set menu_color_normal=black/cyan - set menu_color_highlight=black/light-gray - insmod efi_gop - insmod efi_uga - insmod gfxterm - insmod all_video - insmod videotest - insmod videoinfo - terminal_output gfxterm -fi +serial --speed=115200 efi0 -menuentry "Boot SystemRescue using default options" { - set gfxpayload=keep - linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% +insmod efi_gop +insmod efi_uga + +menuentry "Boot %ISO_APPLICATION% v%ISO_VERSION% using default options" { + echo 'Loading kernel...' + linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% + echo 'Loading initrd...' initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img } -menuentry "Boot SystemRescue and copy system to RAM (copytoram)" { - set gfxpayload=keep - linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram +menuentry "Boot %ISO_APPLICATION% v%ISO_VERSION% and copy system to RAM (copytoram)" { + echo 'Loading kernel...' + linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% copytoram + echo 'Loading initrd...' initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img } -menuentry "Boot SystemRescue and verify integrity of the medium (checksum)" { - set gfxpayload=keep - linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% checksum +menuentry "Boot %ISO_APPLICATION% v%ISO_VERSION% and verify integrity of the medium (checksum)" { + echo 'Loading kernel...' + linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% checksum + echo 'Loading initrd...' initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img } -menuentry "Boot SystemRescue using basic display drivers (nomodeset)" { - set gfxpayload=keep - linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% nomodeset +menuentry "Boot %ISO_APPLICATION% v%ISO_VERSION% using basic display drivers (nomodeset)" { + echo 'Loading kernel...' + linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% nomodeset + echo 'Loading initrd...' initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img } menuentry "Boot a Linux operating system installed on the disk (findroot)" { - set gfxpayload=keep - linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% findroot + echo 'Loading kernel...' + linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% findroot + echo 'Loading initrd...' initrd /%INSTALL_DIR%/boot/intel_ucode.img /%INSTALL_DIR%/boot/amd_ucode.img /%INSTALL_DIR%/boot/%ISO_ARCH%/sysresccd.img } diff --git a/packages b/packages index d154b9e..b71d13c 100644 --- a/packages +++ b/packages @@ -76,6 +76,7 @@ libvncserver linux-atm linux-firmware linux-lts +linux-lts-headers localepurge lshw lsof @@ -186,6 +187,7 @@ xorg-xinit yubikey-manager yubikey-personalization-gui zerofree +zfs-dkms zile zip zsh diff --git a/pacman.conf b/pacman.conf index 2d0490d..c7e1abb 100644 --- a/pacman.conf +++ b/pacman.conf @@ -76,6 +76,13 @@ Server = http://sysrescuerepo.system-rescue.org/$arch SigLevel = Optional TrustAll # ==== END sysrescuerepo ==== +[archzfs] +Server = https://archzfs.com/$repo/$arch + +[aur] +Server = http://oss.blazis.com/pacman/$repo/$arch +SigLevel = Optional + [core] Include = /etc/pacman.d/mirrorlist diff --git a/syslinux/sysresccd_head.cfg b/syslinux/sysresccd_head.cfg index 73263fd..c2d13cc 100644 --- a/syslinux/sysresccd_head.cfg +++ b/syslinux/sysresccd_head.cfg @@ -1,8 +1,8 @@ -SERIAL 0 38400 +SERIAL 0 115200 UI boot/syslinux/vesamenu.c32 -MENU TITLE SYSTEM-RESCUE %ISO_VERSION% %ISO_ARCH% (www.system-rescue.org) +MENU TITLE %ISO_APPLICATION% %ISO_VERSION% (%ISO_URL%) MENU BACKGROUND #c000a8a8 -TIMEOUT 900 +TIMEOUT 300 MENU WIDTH 78 MENU MARGIN 4 diff --git a/syslinux/sysresccd_pxe.cfg b/syslinux/sysresccd_pxe.cfg index 6215d9d..76f3319 100644 --- a/syslinux/sysresccd_pxe.cfg +++ b/syslinux/sysresccd_pxe.cfg @@ -8,7 +8,7 @@ ENDTEXT MENU LABEL Boot SystemRescue (NBD) LINUX boot/%ISO_ARCH%/vmlinuz INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/%ISO_ARCH%/sysresccd.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} %CONSOLES% SYSAPPEND 3 LABEL sysresccd_nfs @@ -19,7 +19,7 @@ ENDTEXT MENU LABEL Boot SystemRescue (NFS) LINUX boot/%ISO_ARCH%/vmlinuz INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/%ISO_ARCH%/sysresccd.img -APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/sysresccd/bootmnt +APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/sysresccd/bootmnt %CONSOLES% SYSAPPEND 3 LABEL sysresccd_http @@ -30,7 +30,7 @@ ENDTEXT MENU LABEL Boot SystemRescue (HTTP) LINUX boot/%ISO_ARCH%/vmlinuz INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/%ISO_ARCH%/sysresccd.img -APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ +APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ %CONSOLES% SYSAPPEND 3 INCLUDE boot/syslinux/sysresccd_tail.cfg diff --git a/syslinux/sysresccd_sys.cfg b/syslinux/sysresccd_sys.cfg index d38ddac..9bb0f3b 100644 --- a/syslinux/sysresccd_sys.cfg +++ b/syslinux/sysresccd_sys.cfg @@ -7,7 +7,7 @@ ENDTEXT MENU LABEL Boot SystemRescue using default options LINUX boot/%ISO_ARCH%/vmlinuz INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/%ISO_ARCH%/sysresccd.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% LABEL sysresccd_copytoram TEXT HELP @@ -16,7 +16,7 @@ ENDTEXT MENU LABEL Boot SystemRescue and copy system to RAM (copytoram) LINUX boot/%ISO_ARCH%/vmlinuz INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/%ISO_ARCH%/sysresccd.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% copytoram LABEL sysresccd_checksum TEXT HELP diff --git a/syslinux/sysresccd_tail.cfg b/syslinux/sysresccd_tail.cfg index 605c2e6..844a3b9 100644 --- a/syslinux/sysresccd_tail.cfg +++ b/syslinux/sysresccd_tail.cfg @@ -23,5 +23,5 @@ MENU LABEL Reboot COM32 boot/syslinux/reboot.c32 LABEL poweroff -MENU LABEL Power Off +MENU LABEL Power off COM32 boot/syslinux/poweroff.c32