§2023-11-04

Using Deabin Bookworm, I could arch-chroot in terminal mode, but failed with <--- Should say that root could use arch-chroot, wile alexlai cannot. Put alexlai into sudo group the problem is solvede

oot@hc4Bookworm:/home/alexlai# arch-chroot /mnt/gentoo/
unshare: failed to execute chroot: No such file or directory 
root@hc4Bookworm:/home/alexlai# systemd-nspawn -D /mnt/gentoo/
Spawning container gentoo on /mnt/gentoo.
Press ^] three times within 1s to kill container.
(chroot) gentoo ~ # ls /

  1. odroid-hc4, was install as Debain bookworm
sda      8:0    0 298.1G  0 disk 
├─sda1   8:1    0   1.9G  0 part /boot
├─sda2   8:2    0   7.5G  0 part [SWAP]
├─sda3   8:3    0  29.8G  0 part /
└─sda4   8:4    0  89.4G  0 part /mnt/gentoo
  1. Installing the Gentoo base system, stage3
# tar xvf stage3-arm64-systemd-20231105T230202Z.tar.xz --xattrs -C /mnt/gentoo/
# ls /mnt/gentoo/
bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  sys  tmp  usr  var
$ ls /mnt/gentoo/boot/        <--- empty
  1. apt install systemd-container then use systemd-nspawn -D
root@hc4Bookworm:/home/alexlai# systemd-nspawn -D  /mnt/gentoo/ 
Spawning container gentoo on /mnt/gentoo.
Press ^] three times within 1s to kill container.
  1. Configuring compile options
$ gcc -c -Q -march=native --help=target | awk '/^  -march=/ {print $2}'


$ lscpu | awk '/^CPU\(s\):/ {print $2}'
4
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
# COMMON_FLAGS="-O2 -pipe"
COMMON_FLAGS=COMMON_FLAGS="-march=armv8-a+crc -mtune=cortex-a53 -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

# NOTE: This stage was built with the bindist Use flag enabled

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C.utf8


# MAKEOPTS
MAKEOPTS="--jobs 4 --load-average 3"

Load Average Below the Number of CPU Cores: A common rule of thumb is to keep the load average below the number of physical CPU cores or threads available on your system. For example, on a quad-core CPU, a load average of 4 or below is generally considered good.

  1. Configuring the main Gentoo repository
# mkdir -p /etc/portage/repos.conf
# cp -v /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf
'/mnt/gentoo/usr/share/portage/config/repos.conf' -> '/mnt/gentoo/etc/portage/repos.conf/gentoo.conf'
[DEFAULT]
main-repo = gentoo

[gentoo]
location = /var/db/repos/gentoo
sync-type = rsync
sync-uri = rsync://rsync.gentoo.org/gentoo-portage
auto-sync = yes
sync-rsync-verify-jobs = 1
sync-rsync-verify-metamanifest = yes
sync-rsync-verify-max-age = 24
sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
sync-openpgp-keyserver = hkps://keys.gentoo.org
sync-openpgp-key-refresh-retry-count = 40
sync-openpgp-key-refresh-retry-overall-timeout = 1200
sync-openpgp-key-refresh-retry-delay-exp-base = 2
sync-openpgp-key-refresh-retry-delay-max = 60
sync-openpgp-key-refresh-retry-delay-mult = 4
sync-webrsync-verify-signature = yes
  1. Copy DNS info <skip
# ping -c 3 google.com
  1. first sync
(chroot) livecd / # emerge --sync
(chroot) livecd / # ls -l  /var/lib/portage/world 
-rw-r--r-- 1 root portage 0 Oct 22 19:23 /var/lib/portage/world

  1. emerge --search mirrorselect
# emerge app-portage/mirrorselect
  1. Selecting mirrors
# mirrorselect -D -s4 -o >> /etc/portage/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
#COMMON_FLAGS="-O2 -pipe"
COMMON_FLAGS="-march=armv8-a+crc -mtune=cortex-a53 -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
CHOST="aarch64-unknown-linux-gnu"

# NOTE: This stage was built with the bindist Use flag enabled

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C.utf8

# MAKEOPTS
MAKEOPTS="--jobs 4 --load-average 3"

GENTOO_MIRRORS="http://tux.rainside.sk/gentoo/ \
    http://ftp.vectranet.pl/gentoo/ \
    http://gentoo.mirror.root.lu/ \
    ftp://tux.rainside.sk/gentoo/"
  1. Choosing the right profile
(chroot) livecd / # eselect profile list
Available profile symlink targets:
  [1]   default/linux/amd64/17.1 (stable)
  [2]   default/linux/amd64/17.1/selinux (stable)
  [3]   default/linux/amd64/17.1/hardened (stable)
  [4]   default/linux/amd64/17.1/hardened/selinux (stable)
  [5]   default/linux/amd64/17.1/desktop (stable)
  [6]   default/linux/amd64/17.1/desktop/gnome (stable)
  [7]   default/linux/amd64/17.1/desktop/gnome/systemd (stable)
  [8]   default/linux/amd64/17.1/desktop/gnome/systemd/merged-usr (stable)
  [9]   default/linux/amd64/17.1/desktop/plasma (stable)
  [10]  default/linux/amd64/17.1/desktop/plasma/systemd (stable)
  [11]  default/linux/amd64/17.1/desktop/plasma/systemd/merged-usr (stable)
  [12]  default/linux/amd64/17.1/desktop/systemd (stable)
  [13]  default/linux/amd64/17.1/desktop/systemd/merged-usr (stable)
  [14]  default/linux/amd64/17.1/developer (exp)
  [15]  default/linux/amd64/17.1/no-multilib (stable)
  [16]  default/linux/amd64/17.1/no-multilib/hardened (stable)
  [17]  default/linux/amd64/17.1/no-multilib/hardened/selinux (stable)
  [18]  default/linux/amd64/17.1/no-multilib/systemd (dev)
  [19]  default/linux/amd64/17.1/no-multilib/systemd/merged-usr (dev)
  [20]  default/linux/amd64/17.1/no-multilib/systemd/selinux (exp)
  [21]  default/linux/amd64/17.1/no-multilib/systemd/selinux/merged-usr (exp)
  [22]  default/linux/amd64/17.1/systemd (stable) *   <-- * indicate the default
  [23]  default/linux/amd64/17.1/systemd/merged-usr (stable)
  [24]  default/linux/amd64/17.1/systemd/selinux (exp)
  [25]  default/linux/amd64/17.1/systemd/selinux/merged-usr (exp)
  [26]  default/linux/amd64/17.1/clang (exp)
  [27]  default/linux/amd64/17.1/systemd/clang (exp)
  [28]  default/linux/amd64/17.1/systemd/clang/merged-usr (exp)
  [29]  default/linux/amd64/17.0/x32 (dev)
  [30]  default/linux/amd64/17.0/x32/systemd (exp)
  [31]  default/linux/amd64/17.0/x32/systemd/merged-usr (exp)
  [32]  default/linux/amd64/17.0/musl (dev)
  [33]  default/linux/amd64/17.0/musl/clang (exp)
  [34]  default/linux/amd64/17.0/musl/hardened (exp)
  [35]  default/linux/amd64/17.0/musl/hardened/selinux (exp)

if not eselect profile set 22 <-- to set the default

  1. Configuring the USE variable

As we said, USE flags are a core feature of Gentoo. Therefore, a good understanding of how to deal with them is needed to have a customized and healthy Gentoo system.

The USE variables can be defined system-wide or per package domain. You can read more info here:

- System-wide in [/etc/portage/make.conf](https://wiki.gentoo.org/wiki//etc/portage/make.conf#USE)
- Per package in [/etc/portage/package.use](https://wiki.gentoo.org/wiki//etc/portage/package.use)

We can see the list of USE flags that are set up in our system by running:

(chroot) livecd / # emerge --info | grep ^USE

USE="acl amd64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libtirpc multilib ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl systemd test-rust udev unicode xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
USE="acl amd64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libtirpc multilib ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl systemd test-rust udev unicode xattr zlib"

This USE flag information can be broken down as follows:

We can find a description of all USE flags in less /var/db/repos/gentoo/profiles/use.desc.

Additionally, the utility named quse from portage-utils package can tell us which package uses what USE flags.

For example, if you want to know which packages use the systemd flag we simply need to run:

quse systemd --> shows the list of packages affected by systemd.

In your case, since the USE variable is not present in your /etc/portage/make.conf file, your system is likely using the default USE flags provided by the selected profile. This is a common configuration for many Gentoo systems, as it simplifies the management of USE flags by relying on profile defaults.

  1. Configuring the CPU Flags

USE flags that are available for our system. We could use the advantages of some CPU instruction sets using what are called CPU flags. You can read more on the Gentoo CPU_FLAGS_X86 wiki page.

To know what optimizations we can use for our CPU, we're going to use a tool called cpuid2cpuflags: emerge --ask app-portage/cpuid2cpuflags

# emerge app-portage/cpuid2cpuflags
# cpuid2cpuflags
CPU_FLAGS_ARM: edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v4 v5 v6 v7 v8 thumb2

nano /etc/portage/make.conf

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
#COMMON_FLAGS="-O2 -pipe"
COMMON_FLAGS="-march=armv8-a+crc -mtune=cortex-a53 -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
CHOST="aarch64-unknown-linux-gnu"

# NOTE: This stage was built with the bindist Use flag enabled

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C.utf8

# MAKEOPTS
MAKEOPTS="--jobs 4 --load-average 3"

GENTOO_MIRRORS="http://tux.rainside.sk/gentoo/ \
    http://ftp.vectranet.pl/gentoo/ \
    http://gentoo.mirror.root.lu/ \
    ftp://tux.rainside.sk/gentoo/"

# cpuid2cpuflags
CPU_FLAGS_ARM="edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v4 v5 v6 v7 v8 thumb2"
  1. Re-compile and update @world

After setting up the USE and CPU flags, we're ready to re-compile and update all packages that we have installed in our base system before moving forward:

When you select a Gentoo profile during the installation of your Gentoo system, the profile typically includes a set of default USE flags that are already configured for you. These default USE flags are designed to be a good starting point based on the intended purpose of the profile.

  1. Allow licenses for packages

Each package in our Gentoo system defines what kind of license it uses. Setting what licenses we accept in our system is crucial to avoid problems installing free or binary redistributable packages. Also, to get installed automatically without asking us every time they get installed or updated.

You can read more about Gentoo licenses here.

Licenses acceptance is set in our /etc/portage/make.conf in the variable ACCEPT_LICENSE, like:

ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"
  1. Timezone

We can use the tool tzselect to interactively select our country, and it will tell us what the value of /etc/timezone file should be.

(chroot) livecd / # tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", "TZ", or "time".
1) Africa                                                    5) Asia                                             9) Indian Ocean                               13) time - I know local time already.
2) Americas                                                  6) Atlantic Ocean                                          10) Pacific Ocean
3) Antarctica                                                7) Australia                                       11) coord - I want to use geographical coordinates.
4) Arctic Ocean                                              8) Europe                                          12) TZ - I want to specify the timezone using the Posix TZ format.
#? 5
Please select a country whose clocks agree with yours.
1) Afghanistan             6) Bhutan                11) East Timor            16) Indonesia             21) Jordan                26) Kyrgyzstan            31) Mongolia            36) Palestine               41) Saudi Arabia          46) Taiwan                51) United Arab Emirates
2) Armenia                 7) Brunei                12) French S. Terr.       17) Iran                  22) Kazakhstan            27) Laos          32) Myanmar (Burma)       37) Philippines           42) Seychelles            47) Tajikistan      52) Uzbekistan
3) Azerbaijan              8) Cambodia              13) Georgia               18) Iraq                  23) Korea (North)         28) Lebanon       33) Nepal                 38) Qatar                 43) Singapore             48) Thailand        53) Vietnam
4) Bahrain                 9) China                 14) Hong Kong             19) Israel                24) Korea (South)         29) Macau         34) Oman                  39) Russia                44) Sri Lanka             49) Turkey          54) Yemen
5) Bangladesh             10) Cyprus                15) India                 20) Japan                 25) Kuwait                30) Malaysia              35) Pakistan            40) Réunion         45) Syria                 50) Turkmenistan
#? 46

Based on the following information:

        Taiwan

TZ='Asia/Taipei' will be used.
Selected time is now:   Wed Oct 25 05:37:20 CST 2023.
Universal Time is now:  Tue Oct 24 21:37:20 UTC 2023.
Is the above information OK?
1) Yes
2) No
#? 1

You can make this change permanent for yourself by appending the line
        TZ='Asia/Taipei'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Taipei

?? ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime ??

  1. Configure locales
(chroot) livecd / # nano /etc/locale.gen 
(chroot) livecd / # locale-gen 
 * Generating 3 locales (this might take a while) with 4 jobs
 *  (3/3) Generating C.UTF-8 ...                                                                                                                                                                                                                                                         [ ok ]
 *  (2/3) Generating ja_JP.UTF-8 ...                                                                                                                                                                                                                                                     [ ok ]
 *  (1/3) Generating en_US.UTF-8 ...                                                                                                                                                                                                                                                     [ ok ]
 * Generation complete
 * Adding locales to archive ...                                                                                                                                                                                                                                                         [ ok ]
(chroot) livecd / # locale -a
C
C.utf8
POSIX
en_US.utf8
ja_JP.utf8
(chroot) livecd / # eselect locale list
Available targets for the LANG variable:
  [1]   C
  [2]   C.utf8
  [3]   POSIX
  [4]   en_US.utf8
  [5]   ja_JP.utf8
  [6]   C.UTF8 *
  [ ]   (free form)
(chroot) livecd / # eselect locale set 4
Setting LANG to en_US.utf8 ...
Run ". /etc/profile" to update the variable in your shell.

(chroot) livecd / # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...
(chroot) livecd / # echo $LANG
en_US.utf8

(chroot) livecd / # echo $LC_ALL

  1. Installing external firmware

Linux kernel is an open-source project, but some hardware manufacturers don't like the idea of open-source the code of its firmware (or modules), releasing a compiled binary version of them. These binaries can't be included in the Linux kernel repository, and they are packed in a package called sys-kernel/linux-firmware.

So, before compiling the kernel, it is essential to know that some devices require additional firmware to make the system run properly. Second, these are more common than we think, from network adapters, wireless cards, graphic cards, and CPUs.

For the most common firmware requirements, we will install the sys-kernel/linux-firmware:

$ emerge --ask sys-kernel/linux-firmware `
...
>>> Completed (1 of 1) sys-kernel/linux-firmware-20230919::gentoo

 * Messages for package sys-kernel/linux-firmware-20230919:

 * Your configuration for sys-kernel/linux-firmware-20230919 has been saved in 
 * "/etc/portage/savedconfig/sys-kernel/linux-firmware-20230919" for your editing pleasure.
 * You can edit these files by hand and remerge this package with
 * USE=savedconfig to customise the configuration.
 * You can rename this file/directory to one of the following for
 * its configuration to apply to multiple versions:
 * ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/
 * [${CTARGET}|${CHOST}|""]/${CATEGORY}/[${PF}|${P}|${PN}]
 * If you are only interested in particular firmware files, edit the saved
 * configfile and remove those that you do not want.

 * GNU info directory index is up-to-date.

 * IMPORTANT: 10 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
  1. sys-firmware/intel-microcode

Additionally, check the Microocode page in the Gentoo wiki to see if you need any additional firmware to make your CPU work properly. For example, intel CPUs are usually required to install the Intel microcode package sys-firmware/intel-microcode .

(chroot) livecd / # emerge --ask sys-firmware/intel-microcode
...
>>> Completed (2 of 2) sys-firmware/intel-microcode-20230808_p20230804::gentoo

 * Messages for package sys-firmware/intel-microcode-20230808_p20230804:

 * Unable to find kernel sources at /usr/src/linux
 * Unable to calculate Linux Kernel version for build, attempting to use running version  <-- ???

 * GNU info directory index is up-to-date.

 * IMPORTANT: 10 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
  1. Installing the sources
(chroot) livecd / # emerge --ask sys-kernel/gentoo-sources
(chroot) livecd / # eselect kernel list
Available kernel symlink targets:
  [1]   linux-6.1.57-gentoo
(chroot) livecd / # eselect kernel set 1
(chroot) livecd / # ls -l /usr/src
total 4
lrwxrwxrwx  1 root root   19 Oct 24 23:43 linux -> linux-6.1.57-gentoo
drwxr-xr-x 27 root root 4096 Oct 24 23:40 linux-6.1.57-gentoo

From this point, only two things are missing: configure and compile it. There are two ways to do that:

- Manual configuration and automated build
- Semi-automated by using `genkernel`
- Fully automated via distribution kernels (not covered in this guide. Follow the official documentation [here](https://wiki.gentoo.org/wiki/Project:Distribution_Kernel))
  1. boot.scr
'V�A'eH�;"�SM�boot script
#
# flash-kernel: bootscr.odroid-g12
#

# Bootscript using the new unified bootcmd handling
#
# Expects to be called with the following environment variables set:
#
#  devtype              e.g. mmc/scsi etc
#  devnum               The device number of the given type
#  bootpart             The partition containing the boot files
#  distro_bootpart      The partition containing the boot files
#                       (introduced in u-boot mainline 2016.01)
#  prefix               Prefix within the boot partiion to the boot files
#  kernel_addr_r        Address to load the kernel to
#  fdt_addr_r           Address to load the FDT to
#  ramdisk_addr_r       Address to load the initrd to.
#
# The uboot must support the booti and generic filesystem load commands.

setenv bootargs " ${bootargs} quiet"
setenv overlay_resize 8192

setenv bootlabel "Debian GNU/Linux 12 (bookworm)"

# Default serial console
# setenv console "ttyAML0,115200n8"

# Default TTY console
setenv bootargs "${bootargs} console=tty1"
setenv fdt_addr_r "0x20000000"
setenv bootargs "${bootargs} cma=800M"
setenv bootargs "${bootargs} clk_ignore_unused"
setenv bootargs "${bootargs} fsck.mode=force fsck.repair=yes"

load ${devtype} ${devno}:${partition} ${loadaddr} ${prefix}config.ini \
    &&  ini generic ${loadaddr}
if test -n "${overlay_profile}"; then
    ini overlay_${overlay_profile} ${loadaddr}
fi

if test -n "${console}"; then
  setenv bootargs "${bootargs} console=${console}"
fi

if test -n "${default_console}"; then
  setenv bootargs "${bootargs} console=${default_console}"
fi

if test -z "${fk_kvers}"; then
   setenv fk_kvers "6.1.0-odroid-arm64"
fi

# Hack to set kernel load address for Linux kernel v3.16.56 only
if test "${fk_kvers}" = "3.16.56-odroid-arm64"; then
   setenv kernel_addr_r "0x10800000"
fi

if test -z "${fdtfile}"; then
   setenv fdtfile "meson64_odroid${variant}.dtb"
fi

if test -z "${distro_bootpart}"; then
  setenv partition ${bootpart}
else
  setenv partition ${distro_bootpart}
fi


if test -n "${fbcon}"; then
    setenv bootargs "${bootargs} fbcon=${fbcon}"
fi

setenv dtbo_addr_r 0x21000000
setenv zimage_addr_r ${ramdisk_addr_r}

load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtbs/${fk_kvers}/amlogic/${fdtfile}
if test -n "${overlays}"; then
    fdt addr ${fdt_addr_r}
    fdt resize ${overlay_resize}

    setenv overlay ${variant}
    if test "${variant}" = "n2l"; then setenv overlay "n2"; fi
    if test "${variant}" = "n2_plus"; then setenv overlay "n2"; fi
    if test "${variant}" = "hc4"; then setenv overlay "c4"; fi

    for file in ${overlays}; do
        load ${devtype} ${devnum}:${partition} ${dtbo_addr_r} ${prefix}dtbs/${fk_kvers}/amlogic/overlays/odroid${overlay}/${file}.dtbo \
            && fdt apply ${dtbo_addr_r}
    done
fi

load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& unzip ${zimage_addr_r} ${kernel_addr_r} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& unzip ${zimage_addr_r} ${kernel_addr_r} \
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtb-${fk_kvers} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz \
&& unzip ${zimage_addr_r} ${kernel_addr_r} \
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtb \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img \
&& echo "Booting Debian from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}