Skip to content

Commit

Permalink
Initial arm64 / aarch64 support
Browse files Browse the repository at this point in the history
Relevant changes:

* arm64 (ARM64 in terms of FAI class) is considered a valid and
  supported architecture within grml-live now; updated documentation,
  configuration files and zsh completion accordingly

* arm64 was enabled as supported architecture in grml repositories

* the architecture specific grml-scripts + grml-scripts-core packages
  got built for arm64 and uploaded to the grml-testing repository

* memtest86+ + syslinux aren't available on arm64, therefore move
  memtest86+ to Recommends to avoid ending up with an `Arch: any`
  package, also depend on either syslinux or syslinux-efi

* Software related changes in GRML* (other than the obvious
  linux-image-arm64 and further arm64 specific packages):

  * GRMLBASE:

    - grml2usb is I386 + AMD64 specific for now (if we want to use
      grml2usb on arm64 as well, we'd need to port it)

    - grub-efi-amd64-bin, grub-efi-ia32-bin + grub-pc as well as
      syslinux, syslinux-common + syslinux-utils all are also
      I386 + AMD64 specific

  * GRML_FULL:

    - cciss-vol-status, cmospwd, cpuid, grub-pc-bin + ltrace all
      are I386 + AMD64 specific (so not available for arm64)

    - grml-terminalserver is I386 + AMD64 specific for now (at least
      until we ported grml2usb for arm64)

* /etc/grml/fai/config/scripts/GRMLBASE/44-grub: invocation of
  grub-mkimage is I386 + AMD64 specific (at least until we identify
  whether there's an actual use-case for our generated
  /boot/grub/core.img)

* /etc/grml/fai/config/scripts/GRMLBASE/45-grub-images: we use
  /boot/bootaa64.efi for the EFI boot image name for arm64, though need
  to skip the unavailable efi_uga module and also skipt the i386-pc
  architecture, since grub on arm64 doesn't provide /usr/lib/grub/i386-efi

Known TODOs:

* decide official naming for Grml on arm64 (also keep e.g.
  `update-grml-rescueboot -t small -a 64` in mind!)

* grml2usb isn't available for arm64 yet, and therefore also
  grml-terminalserver isn't available for arm64

* when booting the resulting ISO inside an arm64 / aarch64, the default
  terminal seems to start up as /dev/ttyAMA0 (instead of /dev/tty1, as
  expected and handled via our getty@tty1.service)

* look into SecureBoot support

Development sponsored by netcup GmbH
  • Loading branch information
mika committed Sep 8, 2023
1 parent e530f07 commit e1a5504
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 75 deletions.
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ Depends:
fai-client (>= 3.4.0),
isolinux (>= 3:6.03+dfsg-5+deb8u1~),
jo,
memtest86+,
mksh,
moreutils,
mtools,
pciutils,
rsync,
squashfs-tools (>= 1:4.2-0~bpo60),
syslinux,
syslinux | syslinux-efi,
xorriso,
${misc:Depends},
Recommends:
grml-live-db,
grub-pc-bin,
imagemagick,
ipxe,
memtest86+,
syslinux-utils,
Suggests:
fai-doc,
Expand Down
30 changes: 16 additions & 14 deletions docs/grml-live.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ Use the specified architecture instead of the currently running one. This
allows building a 32bit system on a 64bit host (though you can't build a 64bit
system on a 32bit system/kernel of course). Please notice that real
crosscompiling (like building a ppc system on x86) isn't possible due to the
nature and the need of working in a chroot. Currently supported values: i386
and amd64.
nature and the need of working in a chroot. Currently supported values: i386,
amd64 and arm64.

-b::

Expand All @@ -82,7 +82,7 @@ really know that you do not want to update the chroot.
-c **CLASSES**::

Specify the CLASSES to be used for building the ISO via FAI. By default only
the classes GRMLBASE, GRML_FULL and I386/AMD64 (depending on system
the classes GRMLBASE, GRML_FULL and I386/AMD64/ARM64 (depending on system
architecture) are assumed. Additionally you can specify a class providing a
(grml-)kernel (see <<classes,the 'CLASSES' section in this document>> for
details about available classes). So instead of GRML_FULL you can also use e.g.
Expand Down Expand Up @@ -297,9 +297,9 @@ losing the simplicity in the build process.
The main and base class provided by grml-live is named GRMLBASE. It's strongly
recommended to **always** use the class GRMLBASE when building an ISO using
grml-live, as well as the architecture dependent class which provides the kernel
(being 'I386' for x86_32 and 'AMD64' for x86_64) and a GRML_* class (like
GRML_SMALL or GRML_FULL). The following files and directories are
relevant for class GRMLBASE by default:
(being 'I386' for x86_32, 'AMD64' for x86_64 and 'ARM64' for arm64) and a GRML_*
class (like GRML_SMALL or GRML_FULL).
The following files and directories are relevant for class GRMLBASE by default:
${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/
${GRML_FAI_CONFIG}/config/debconf/GRMLBASE
Expand All @@ -312,10 +312,10 @@ files/directories.
If you want to use your own configuration, extend an existing configuration
and/or add additional packages to your ISO just invent a new class (or extend an
existing one). For example if you want to use your own class named "FOOBAR" just
set CLASSES="GRMLBASE,GRML_SMALL,AMD64,FOOBAR" inside /etc/grml/grml-live.local
or invoke grml-live using the classes option: "grml-live -c
GRMLBASE,GRML_SMALL,AMD64,FOOBAR ...".
existing one). For example if you want to use your own class named "FOOBAR" on
your amd64 build, et CLASSES="GRMLBASE,GRML_SMALL,AMD64,FOOBAR" inside
/etc/grml/grml-live.local or invoke grml-live using the classes option:
"grml-live -c GRMLBASE,GRML_SMALL,AMD64,FOOBAR ...".
More details regarding the class concept can be found in the documentation of
FAI itself (being available at /usr/share/doc/fai-doc/).
Expand Down Expand Up @@ -544,6 +544,7 @@ Instructions
# mkdir -p /etc/grml/fai/config/basefiles/
# mv I386.tar.gz /etc/grml/fai/config/basefiles/
# mv AMD64.tar.gz /etc/grml/fai/config/basefiles/
# mv ARM64.tar.gz /etc/grml/fai/config/basefiles/

# install relevant tools
apt-get --no-install-recommends install grml-live
Expand Down Expand Up @@ -705,26 +706,27 @@ syslinux, used by default for official Grml images) then just execute:
% isohybrid grml.iso

[[create-a-base-tgz]]
How do I create a base tar.gz (I386.tar.gz or AMD64.tar.gz)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How do I create a base tar.gz (I386.tar.gz or AMD64.tar.gz or ARM64.tar.gz)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[[basetgz]]

First of all create the chroot using debootstrap (requires root):

BASECHROOT='/tmp/basefile' # path where the chroot gets generated
SUITE='bookworm' # using the current stable release should always work
debootstrap --exclude=info,tasksel,tasksel-data "$SUITE" "$BASECHROOT" http://ftp.debian.org/debian
debootstrap --exclude=info,tasksel,tasksel-data,isc-dhcp-client,isc-dhcp-common "$SUITE" "$BASECHROOT" http://deb.debian.org/debian
tar -C "$BASECHROOT" --exclude='var/cache/apt/archives/*.deb' -zcf "${SUITE}".tar.gz ./

[TIP]
By default debootstrap builds a chroot matching the architecture of the running
host system. If you're using an amd64 system and want to build an i386 base.tgz
then invoke debootstrap using the '--arch i386' option. Disclaimer: building an
AMD64 base.tgz won't work if you are using a 32bit kernel system of course.
Also building an ARM64 base.tgz requires an arm64 system.

Finally place the generated tarball in /etc/grml/fai/config/basefiles/ (note
that it needs to be uppercase letters matching the class names, so: e.g.
AMD64.tar.gz for amd64 and I386.tar.gz for i386).
AMD64.tar.gz for amd64, I386.tar.gz for i386 or ARM64.tar.gz for arm64).

Then executing grml-live should use this file as base system instead of executing
debootstrap. Check out the output for something like:
Expand Down
22 changes: 17 additions & 5 deletions etc/grml/fai/config/package_config/GRMLBASE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ eject
fdisk
file
gpm
grml2usb
grml-autoconfig
grml-crypt
grml-debian-keyring
Expand All @@ -28,9 +27,6 @@ grml-scripts
grml-scripts-core
grml-tips
grml-udev-config
grub-efi-amd64-bin
grub-efi-ia32-bin
grub-pc
haveged
hdparm
hwinfo
Expand All @@ -51,7 +47,6 @@ resolvconf
rsync
rsyslog
strace
syslinux syslinux-common syslinux-utils
udev
usbutils
uuid-runtime
Expand Down Expand Up @@ -83,3 +78,20 @@ firmware-zd1211

libpam-systemd
systemd-container

PACKAGES install I386
grub-pc
grub-efi-amd64-bin
grub-efi-ia32-bin
syslinux syslinux-common syslinux-utils
grml2usb

PACKAGES install AMD64
grub-pc
grub-efi-amd64-bin
grub-efi-ia32-bin
syslinux syslinux-common syslinux-utils
grml2usb

PACKAGES install ARM64
grub-efi-arm64-bin
42 changes: 34 additions & 8 deletions etc/grml/fai/config/package_config/GRML_FULL
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ PACKAGES install
grml-live
grml-paste
grml-quickconfig-standard
grml-terminalserver

# base os
apt
Expand Down Expand Up @@ -41,17 +40,13 @@ brltty
espeak-ng
espeakup

# broken userland debugging
ltrace

# deploy on remote sites
openvpn
ppp
pppoeconf

# disk subsystems support/debugging
array-info
cciss-vol-status
cryptsetup
disktype
dmraid
Expand All @@ -76,7 +71,6 @@ stenc
# disk partitioning/boot
boot-info-script
gparted
grub-pc-bin
kpartx
mbr
partclone
Expand Down Expand Up @@ -334,8 +328,6 @@ xterm
# x86 hardware support
acpi
acpi-support
cmospwd
cpuid
irqbalance
lm-sensors
lshw
Expand All @@ -355,19 +347,53 @@ stress
man-db

PACKAGES install I386
# kernel related
linux-image-686
linux-cpupower
# disk subsystems support/debugging, I386/AMD64 specific
cciss-vol-status
# x86 hardware support
cmospwd
cpuid
# broken userland debugging
ltrace
# disk partitioning/boot
grub-pc-bin

# PXE boot
grml-terminalserver

# firmware updates
fwupd-i386-signed

PACKAGES install AMD64
# kernel related
linux-image-amd64
linux-cpupower
# disk subsystems support/debugging
cciss-vol-status
# x86 hardware support
cmospwd
cpuid
# broken userland debugging
ltrace
# disk partitioning/boot
grub-pc-bin

# PXE boot
grml-terminalserver

# EFI PXE boot support in grml-terminalserver
grub-efi-amd64-signed
shim-signed

# firmware updates
fwupd-amd64-signed

PACKAGES install ARM64
# kernel related
linux-image-arm64
linux-cpupower

# firmware updates
fwupd-arm64-signed
3 changes: 3 additions & 0 deletions etc/grml/fai/config/package_config/GRML_SMALL
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,6 @@ linux-image-686

PACKAGES install AMD64
linux-image-amd64

PACKAGES install ARM64
linux-image-arm64
9 changes: 8 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/44-grub
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ set -u

$ROOTCMD mkdir -p /boot/grub

$ROOTCMD grub-mkimage -d /usr/lib/grub/i386-pc \
if ifclass ARM64 ; then
echo "Skipping execution of script on ARM64"
exit 0
fi

# generate /boot/grub/core.img
$ROOTCMD grub-mkimage \
-d /usr/lib/grub/i386-pc \
-p /boot/grub \
-o /boot/grub/core.img \
biosdisk iso9660 \
Expand Down
14 changes: 14 additions & 0 deletions etc/grml/fai/config/scripts/GRMLBASE/45-grub-images
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ ARCHS=(i386-pc)
declare -A ADDITIONAL_MODULES
ADDITIONAL_MODULES[i386-pc]="biosdisk"

# arm64 doesn't provide /usr/lib/grub/i386-efi, so we don't include
# i386-pc in $ARCHS (whereas on AMD64 we have both i386-pc + x86_64-efi)
if ifclass ARM64 ; then
if [ -r "${target}"/usr/lib/grub/arm64-efi/moddep.lst ] ; then
ARCHS=(arm64-efi)
# NOTE: efi_uga (EFI Universal Graphics Adapter) is deprecated + unavailable on arm64
ADDITIONAL_MODULES[arm64-efi]="efi_gop" # no efi_uga available
else
echo "/usr/lib/grub/arm64-efi/moddep.lst.lst could not be found, skipping."
echo "NOTE: grub-efi-arm64-bin not installed?"
fi
fi

if ifclass AMD64 ; then
if [ -r "${target}"/usr/lib/grub/x86_64-efi/moddep.lst ] ; then
ARCHS+=(x86_64-efi)
Expand All @@ -54,6 +67,7 @@ for arch in "${ARCHS[@]}" ; do
i386-pc) filename=/boot/grub/grub.img ;;
x86_64-efi) filename=/boot/bootx64.efi ;;
i386-efi) filename=/boot/bootia32.efi ;;
arm64-efi) filename=/boot/bootaa64.efi ;;
esac

$ROOTCMD grub-mkimage -O $arch -o "$filename" --prefix=/boot/grub/ --config="$TMP_CONFIG" \
Expand Down
2 changes: 1 addition & 1 deletion etc/grml/grml-live.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# Notice: GRMLBASE is recommended in any case unless you *really* know what you
# are doing; make sure to also use a GRML_* class (for example GRML_SMALL
# or GRML_FULL) to get an according kernel and also select the
# architecture (I386 for x86; AMD64 for x86_64)
# architecture (I386 for x86; AMD64 for x86_64, ARM64 for arm64)
# CLASSES="GRMLBASE,GRML_FULL,I386"

# HTTP Proxy to use for APT
Expand Down
2 changes: 1 addition & 1 deletion etc/zsh/completion.d/_grml-live
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _grmllive_classes() { #{{{
DEBORPHAN FRESHCLAM
GRMLBASE GRML_FULL GRML_SMALL
LATEX LATEX_CLEANUP LOCALES NO_ONLINE RELEASE REMOVE_DOCS SOURCES XORG ZFS
I386 AMD64
I386 AMD64 ARM64
)
compset -P '*,'
already=(${(s<,>)IPREFIX})
Expand Down

0 comments on commit e1a5504

Please sign in to comment.