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 ab229a0..b95112f 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,55 @@ -# SystemRescueCd +# SystemRescueCd+ZFS -## Project website -Homepage: http://www.system-rescue-cd.org/ +**SystemRescueCd+ZFS** is a fork of the [SystemRescueCd](http://www.system-rescue-cd.org/) Linux distribution by [Francois Dupoux](https://gitlab.com/fdupoux) (based on [Arch Linux](https://www.archlinux.org)) with improvements such as: -## Project sources -This git repository contains SystemRescueCd sources files. This is based on -https://git.archlinux.org/archiso.git +* [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 SystemRescueCd -SystemRescueCd 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. The archiso package must be modified to -add support for an option which allows to optimize the squashfs compression. -The patch can be found 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` + * `base-devel` + * `grub` + * `mkinitcpio-archiso` + * `mtools` +* Manually import [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_setup_mkinitcpio` +5. `make_customize_airootfs` +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 186d9d5..6efa73e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.1.7 +6.1.7+0.8.4 diff --git a/airootfs/etc/issue b/airootfs/etc/issue index cf7ce87..ecc7ae3 100644 --- a/airootfs/etc/issue +++ b/airootfs/etc/issue @@ -1,13 +1,14 @@ -\e[01;31m ======== \e[01;37mSystemRescueCd \m\e[01;31m ---- \e[01;37m%ISO_VERSION%\e[01;31m ======== \e[01;37m\l\e[00;37m/6\e[01;31m ======== - \e[00;31mhttp://www.system-rescue-cd.org/ +\e[01;31m============= \e[01;37m%ISO_APPLICATION% \m\e[01;31m --- \e[01;37mv%ISO_VERSION%\e[01;31m --- \e[01;37m\l \e[01;31m============= + \e[00;31mhttp://www.system-rescue-cd.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/build.sh b/build.sh index 480d0e6..bf42414 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=systemrescuecd +iso_application="SystemRescueCd+ZFS" iso_version="$(<${version_file})" -iso_mainver="${iso_version%-*}" -iso_label="SYSRCD${iso_mainver//.}" -iso_publisher="SystemRescueCd " -iso_application="SystemRescueCd" +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 @@ -67,8 +67,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 } @@ -86,7 +92,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) @@ -97,7 +103,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" \ @@ -157,6 +164,8 @@ 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_VERSION%|${iso_version}|g; s|%ISO_ARCH%|${arch}|g; s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/iso/${install_dir}/boot/syslinux/${_cfg##*/} @@ -185,8 +194,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" \ @@ -259,6 +269,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/font.pf2 b/efiboot/grub/font.pf2 deleted file mode 100644 index 1eb3edc..0000000 Binary files a/efiboot/grub/font.pf2 and /dev/null differ diff --git a/efiboot/grub/grubsrcd.cfg b/efiboot/grub/grubsrcd.cfg index 35dcb5b..4b4122a 100644 --- a/efiboot/grub/grubsrcd.cfg +++ b/efiboot/grub/grubsrcd.cfg @@ -1,47 +1,45 @@ # 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=auto - 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 SystemRescueCd 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 SystemRescueCd and copy system to RAM" { - 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" { + 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 the SystemRescueCd live medium and verify integrity" { - set gfxpayload=keep - linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% checksum +menuentry "Boot the %ISO_APPLICATION% v%ISO_VERSION% live medium and verify integrity" { + 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 from a Linux operating system installed on the disk" { - 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 } menuentry "Stop during the boot process before mounting the root filesystem" { - set gfxpayload=keep - linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% break + echo 'Loading kernel...' + linux /%INSTALL_DIR%/boot/%ISO_ARCH%/vmlinuz archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% %CONSOLES% break + 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 57e5c8d..77572f2 100644 --- a/packages +++ b/packages @@ -71,6 +71,7 @@ libvncserver linux-atm linux-firmware linux-lts +linux-lts-headers localepurge lshw lsof @@ -176,6 +177,7 @@ xorg-xinit yubikey-manager yubikey-personalization-gui zerofree +zfs-dkms zile zip zsh diff --git a/pacman.conf b/pacman.conf index 3feaf33..64d05e9 100644 --- a/pacman.conf +++ b/pacman.conf @@ -71,9 +71,12 @@ LocalFileSigLevel = Optional # after the header, and they will be used before the default mirrors. # ==== BEGIN customrepos ==== -[custompkgs] -Server = http://archrepo.system-rescue-cd.org/$arch -SigLevel = Optional TrustAll +[archzfs] +Server = https://archzfs.com/$repo/$arch + +[aur] +Server = http://oss.blazis.com/pacman/$repo/$arch +SigLevel = Optional # ==== END customrepos ==== [core] diff --git a/syslinux/sysresccd_head.cfg b/syslinux/sysresccd_head.cfg index 1c7a368..1719fdd 100644 --- a/syslinux/sysresccd_head.cfg +++ b/syslinux/sysresccd_head.cfg @@ -1,6 +1,7 @@ -SERIAL 0 38400 +SERIAL 0 115200 +TIMEOUT 300 UI boot/syslinux/vesamenu.c32 -MENU TITLE SYSTEM-RESCUE-CD %ISO_ARCH% %ISO_VERSION% (www.system-rescue-cd.org) +MENU TITLE %ISO_APPLICATION% %ISO_VERSION% MENU BACKGROUND #c00090f0 MENU WIDTH 78 diff --git a/syslinux/sysresccd_pxe.cfg b/syslinux/sysresccd_pxe.cfg index 9994b90..5c32237 100644 --- a/syslinux/sysresccd_pxe.cfg +++ b/syslinux/sysresccd_pxe.cfg @@ -8,7 +8,7 @@ ENDTEXT MENU LABEL Boot SystemRescueCd (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 SystemRescueCd (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 SystemRescueCd (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 afe575f..87c50a9 100644 --- a/syslinux/sysresccd_sys.cfg +++ b/syslinux/sysresccd_sys.cfg @@ -7,7 +7,7 @@ ENDTEXT MENU LABEL Boot SystemRescueCd 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 SystemRescueCd and copy system to RAM 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