Skip to content

Commit

Permalink
SystemRescue 7.01 + ZFS 2.0.0
Browse files Browse the repository at this point in the history
* Add ZFS 2.0.0
* Import archzfs key into live system's pacman keyring
* GRUB (UEFI boot) improvements:
  * Enable serial console
  * Reduce automatic boot timeout (90 sec => 30 sec)
* SYSLINUX (BIOS boot) improvements:
  * Increase serial console baud rate (38400 => 115200)
  * Reduce automatic boot timeout (90 sec => 30 sec)
* Build script improvements:
  * Print argument summary when building with `-v`
  * Print header for each build step
  • Loading branch information
nchevsky committed Dec 15, 2020
1 parent 9ce1cee commit 9b6827d
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 89 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
edit-*.sh
out
rebuild-*.sh
transfer-*.sh
work
87 changes: 56 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
# SystemRescue

## Project website
Homepage: https://www.system-rescue.org/

## Project sources
This git repository contains SystemRescue sources files. This is based on
https://gitlab.archlinux.org/archlinux/archiso/

## 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.

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.

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.
# SystemRescue+ZFS

**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:

* [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

## Serial Console

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.

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`
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.01
7.01+2.0.0
21 changes: 11 additions & 10 deletions airootfs/etc/issue
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions airootfs/root/customize_airootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 27 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://www.system-rescue.org>"
iso_application="SystemRescue"
iso_name=$(echo "$iso_application" | tr '[:upper:]' '[:lower:]')
iso_label="${iso_application}_${iso_version}"
iso_publisher='Blazis Technologies <http://oss.blazis.com/systemrescue+zfs>'
install_dir=sysresccd
work_dir=work
out_dir=out
Expand All @@ -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
Expand Down Expand Up @@ -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
}

Expand All @@ -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)
Expand All @@ -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" \
Expand Down Expand Up @@ -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##*/}
Expand Down Expand Up @@ -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" \
Expand Down Expand Up @@ -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
Expand Down
54 changes: 24 additions & 30 deletions efiboot/grub/grubsrcd.cfg
Original file line number Diff line number Diff line change
@@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions packages
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ libvncserver
linux-atm
linux-firmware
linux-lts
linux-lts-headers
localepurge
lshw
lsof
Expand Down Expand Up @@ -186,6 +187,7 @@ xorg-xinit
yubikey-manager
yubikey-personalization-gui
zerofree
zfs-dkms
zile
zip
zsh
7 changes: 7 additions & 0 deletions pacman.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions syslinux/sysresccd_head.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions syslinux/sysresccd_pxe.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions syslinux/sysresccd_sys.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion syslinux/sysresccd_tail.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9b6827d

Please sign in to comment.