§2023-10-08

The orgpi5Jammy.yushei.ney was setup as,

nvme0n1                                                                            
├─nvme0n1p1 ext4   1.0         ef0394d0-a234-4bb8-a52a-c9981efb9ced    1.5G    15% /boot
├─nvme0n1p2 swap   1           608531c6-aac8-4199-8241-f7662a23355f                [SWAP]
├─nvme0n1p3 ext4   1.0         beffc735-c7b2-479c-b1a4-f540cde91114   48.9G    12% /var/log.hdd
│                                                                                  /
├─nvme0n1p4 ext4   1.0         498c03bc-f0b2-4de8-91dd-329b95802962          <-- test with gentoo-kernel-bin        
└─nvme0n1p5 ext4   1.0         19951c36-7a95-444b-96ef-6a20b463f4e2   62.4G     4% /mnt/gentoo  <-- test with genkernel 
  1. arch-chroot
# When LC_ALL is set, it overrides all other locale-related variables, including LANG
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
timedatectl list-timezones | grep Taipei
timedatectl set-timezone Asia/Taipei
timedatectl --> show
(chroot) orangepi5plus / # ln -sf /usr/share/zoneinfo/ROC /etc/localtime
(chroot) orangepi5plus / # date
Mon Oct  9 06:37:58 PM CST 2023
[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-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
sync-git-verify-commit-signature = yes
# Set the number of CPU cores for parallel compilation (adjust as needed)
MAKEOPTS="-j8"
(chroot) orgpi58G / # locale-gen
 * Generating 3 locales (this might take a while) with 8 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) orgpi58G / # 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) orgpi58G / # eselect locale set 4
Setting LANG to en_US.utf8 ...
Run ". /etc/profile" to update the variable in your shell.
(chroot) orgpi58G / # . /etc/profile

(chroot) orgpi58G / # emerge --ask --verbose --update --deep --newuse @world setlocale: unsupported locale setting

(chroot) orgpi58G / # locale -a
C
C.utf8
en_US.utf8
ja_JP.utf8
POSIX
(chroot) orgpi58G / # export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

(chroot) orgpi58G / # emerge --ask --verbose --update --deep --newuse @world
  1. emerge --ask sys-kernel/gentoo-sources get kernel source
(chroot) orangepi5plus /usr/src # ln -sf linux-6.1.53-gentoo-r1/ linux   <-- eselect kernel (list/set)
(chroot) orangepi5plus / # cd /usr/src/
(chroot) orangepi5plus /usr/src # ls 
linux-6.1.53-gentoo-r1

(chroot) orangepi5plus /usr/src # eselect kernel list
Available kernel symlink targets:
  [1]   linux-6.1.53-gentoo-r1

(chroot) orangepi5plus /usr/src # eselect kernel set 1
(chroot) orangepi5plus /usr/src # ls -l
total 4
lrwxrwxrwx  1 root root   22 Oct  9 20:23 linux -> linux-6.1.53-gentoo-r1
drwxr-xr-x 27 root root 4096 Oct  9 20:17 linux-6.1.53-gentoo-r1

(chroot) orangepi5plus /usr/src # ls -l
total 4
lrwxrwxrwx  1 root root   23 Oct  8 03:10 linux -> linux-6.1.53-gentoo-r1/
drwxr-xr-x 27 root root 4096 Oct  8 03:08 linux-6.1.53-gentoo-r1

zcat /proc/config.gz > /usr/src/linux/.config
cd linux
run `make menuconfig` to check
(chroot) orangepi5plus /usr/src/linux # make menuconfig
  HOSTCC  scripts/basic/fixdep
  UPD     scripts/kconfig/mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/mconf
.config:8056:warning: symbol value 'm' invalid for CRYPTO_LIB_BLAKE2S_GENERIC  --> it wil change to y automatically
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
  1. genkernel is a tool created by Gentoo used to automate the build process of the kernel and initramfs.
(chroot) orangepi5plus /usr/src/linux # emerge sys-kernel/genkernel

 * IMPORTANT: 11 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.

Calculating dependencies... done!
Dependency resolution took 1.79 s.


!!! All ebuilds that could satisfy "sys-kernel/linux-firmware" have been masked.
!!! One of the following masked packages is required to complete your request:
- sys-kernel/linux-firmware-99999999::gentoo (masked by: || ( ) linux-fw-redistributable license(s), missing keyword)
A copy of the 'linux-fw-redistributable' license is located at '/var/db/repos/gentoo/licenses/linux-fw-redistributable'.

- sys-kernel/linux-firmware-20230919::gentoo (masked by: || ( ) linux-fw-redistributable license(s))
- sys-kernel/linux-firmware-20230804::gentoo (masked by: || ( ) linux-fw-redistributable license(s))
- sys-kernel/linux-firmware-20230625_p20230724::gentoo (masked by: || ( ) linux-fw-redistributable license(s))

(dependency required by "sys-kernel/genkernel-4.3.6::gentoo[firmware]" [ebuild])
(dependency required by "sys-kernel/genkernel" [argument])
For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.

(chroot) orangepi5plus /usr/src/linux # emerge sys-kernel/genkernel --autounmask --autounmask-write

 * IMPORTANT: 11 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.

Calculating dependencies... done!
Dependency resolution took 1.33 s.

[ebuild  N     ] sys-kernel/linux-firmware-20230919  USE="redistributable -compress-xz -compress-zstd (-initramfs) -savedconfig (-unknown-license)" 
[ebuild  N     ] sys-kernel/genkernel-4.3.6  USE="firmware (-ibm)" PYTHON_SINGLE_TARGET="python3_11 -python3_10" 

The following license changes are necessary to proceed:
 (see "package.license" in the portage(5) man page for more details)
# required by sys-kernel/genkernel-4.3.6::gentoo[firmware]
# required by sys-kernel/genkernel (argument)
=sys-kernel/linux-firmware-20230919 linux-fw-redistributable

Autounmask changes successfully written.

 * IMPORTANT: config file '/etc/portage/package.license' needs updating.
 * See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS
 * sections of the emerge man page to learn how to update config files.

(chroot) orangepi5plus /usr/src/linux # dispatch-conf 
--- /tmp/tmpl3xkl1pz/0  2023-10-08 03:20:05.342706440 -0000
+++ /etc/portage/._cfg0000_package.license      2023-10-08 03:19:30.746368322 -0000
@@ -1 +1,3 @@
-/dev/null
+# required by sys-kernel/genkernel-4.3.6::gentoo[firmware]
+# required by sys-kernel/genkernel (argument)
+=sys-kernel/linux-firmware-20230919 linux-fw-redistributable


>> (1 of 1) -- /etc/portage/package.license
>> q quit, h help, n next, e edit-new, z zap-new, u use-new
   m merge, t toggle-merge, l look-merge: 

chroot) orangepi5plus /usr/src/linux # cat /etc/portage/package.license 
# required by sys-kernel/genkernel-4.3.6::gentoo[firmware]
# required by sys-kernel/genkernel (argument)
=sys-kernel/linux-firmware-20230919 linux-fw-redistributable
(chroot) orangepi5plus /usr/src/linux # emerge sys-kernel/genkernel
    • emerge dev-embedded/u-boot-tools

mount your boot partition and `nano /etc/fstab

# /etc/fstab: static file system information.
#
# See the manpage fstab(5) for more information.
#
# NOTE: The root filesystem should have a pass number of either 0 or 1.
#       All other filesystems should have a pass number of 0 or greater than 1.
#
# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3
#       filesystems.  This just tells the kernel to use the ext4 driver.
#
# NOTE: You can use full paths to devices like /dev/sda3, but it is often
#       more reliable to use filesystem labels or UUIDs. See your filesystem
#       documentation for details on setting a label. To obtain the UUID, use
#       the blkid(8) command.

# <fs>                  <mountpoint>    <type>          <opts>          <dump> <pass>

#LABEL=boot             /boot           ext4            defaults        1 2
UUID=ef0394d0-a234-4bb8-a52a-c9981efb9ced               /boot           ext4            defaults                1 2
#LABEL=root,  /dev/nvme0n1p5 
UUID=19951c36-7a95-444b-96ef-6a20b463f4e2               /               ext4            defaults                0 1
#UUID=58e72203-57d1-4497-81ad-97655bd56494              /               xfs             defaults                0 1
#LABEL=swap             none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0

# /dev/nvme0n1p5: UUID="19951c36-7a95-444b-96ef-6a20b463f4e2" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="9ad7b12f->
# /dev/nvme0n1p3: UUID="beffc735-c7b2-479c-b1a4-f540cde91114" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="7b73dd3a->
# /dev/nvme0n1p1: UUID="ef0394d0-a234-4bb8-a52a-c9981efb9ced" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="5e696824->
# /dev/nvme0n1p4: UUID="498c03bc-f0b2-4de8-91dd-329b95802962" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="d1cc9344->
# /dev/nvme0n1p2: UUID="608531c6-aac8-4199-8241-f7662a23355f" TYPE="swap" PARTLABEL="Linux swap" PARTUUID="9d828745-ab02-4ab3-94d1-7bb538623>
(chroot) orgpi5Gentoo /usr/src # nano /etc/genkernel.conf  <-- skip, just tun genkernel all
(chroot) orangepi5plus /usr/src/linux # mount /dev/nvme0n1p1 /boot
(chroot) orangepi5plus /usr/src/linux # las
bash: las: command not found
(chroot) orangepi5plus /usr/src/linux # lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
mtdblock0    31:0    0    16M  0 disk 
zram0       254:0    0   3.8G  0 disk [SWAP]
zram1       254:1    0   200M  0 disk 
nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p1 259:1    0     2G  0 part /boot
├─nvme0n1p2 259:2    0    16G  0 part [SWAP]
├─nvme0n1p3 259:3    0    60G  0 part /etc/resolv.conf
├─nvme0n1p4 259:4    0    90G  0 part 
└─nvme0n1p5 259:5    0  70.5G  0 part /
(chroot) orgpi5Gentoo /usr/src # genkernel all --kernel-config=menuconfig
    • genkernel all
(chroot) orangepi5plus /usr/src # genkernel all
* Gentoo Linux Genkernel; Version 4.3.6
* Using genkernel configuration from '/etc/genkernel.conf' ...
* Running with options: all

* Working with Linux kernel 6.1.53-gentoo-r1 for arm64
* Using kernel config file '/usr/share/genkernel/arch/arm64/generated-config' ...
* 
* Note: The version above is subject to change (depends on config and status of kernel sources).

* kernel: >> Initializing ...
*         >> Previous config backed up to .config--2023-10-08--03-27-39.bak
*         >> Running 'make mrproper' ...
*         >> Running 'make oldconfig' ...
*         >> Ignoring --microcode parameter; Architecture does not support microcode loading ...
*         >> Re-running 'make oldconfig' due to changed kernel options ...
*         >> Kernel version has changed (probably due to config change) since genkernel start:
*            We are now building Linux kernel 6.1.53-gentoo-r1-arm64 for arm64 ...
*         >> Compiling 6.1.53-gentoo-r1-arm64 Image ...
*         >> Compiling 6.1.53-gentoo-r1-arm64 modules ...
*         >> Installing 6.1.53-gentoo-r1-arm64 modules (and stripping) ...
*         >> Generating module dependency data ...
*         >> Compiling out-of-tree module(s) ...
*         >> Saving config of successful build to '/etc/kernels/kernel-config-6.1.53-gentoo-r1-arm64' ...

* initramfs: >> Initializing ...
*         >> Appending devices cpio data ...
*         >> Appending base_layout cpio data ...
*         >> Appending util-linux cpio data ...
*         >> Appending eudev cpio data ...
*         >> Appending auxiliary cpio data ...
*         >> Appending busybox cpio data ...
*         >> Appending modprobed cpio data ...
*         >> Appending modules cpio data ...
*         >> Deduping cpio ...
*         >> Pre-generating initramfs' /etc/ld.so.cache ...
*         >> Compressing cpio data (.xz) ...
xz: Reduced the number of threads from 8 to 1 to not exceed the memory usage limit of 1923 MiB

* Kernel compiled successfully!
* 
* --no-bootloader set; Skipping bootloader update ...
* 
* Required kernel parameter:
* 
* 	root=/dev/$ROOT
* 
* Where $ROOT is the device node for your root partition as the
* one specified in /etc/fstab

* If you require Genkernel's hardware detection features, you MUST
* tell your bootloader to use the provided initramfs file '/boot/initramfs-6.1.53-gentoo-r1-arm64.img'.

* WARNING... WARNING... WARNING...
* Additional kernel parameters that *may* be required to boot properly:

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
* 
* Make sure you have the latest ~arch genkernel before reporting bugs.
* Failed to determine session leader; Will not try to stop child processes

/etc/fstab I forgot to set up, but /boot was moued

(chroot) orangepi5plus /usr/src # ls /boot/ -l
total 300724
-rwxr-xr-x 1 root root   230456 Jun  1 04:07 boot.bmp
-rwxr-xr-x 1 root root     3339 Jun  1 04:05 boot.cmd
-rwxr-xr-x 1 root root     3411 Jun  1 04:15 boot.scr
-rwxr-xr-x 1 root root   219610 Jun  1 03:43 config-5.10.110-rockchip-rk3588
-rw-r--r-- 1 root root   281506 Oct  7 09:22 config-6.1.55-gentoo-dist
-rwxr-xr-x 1 root root 37714432 Oct  7 12:09 decompressed_kernel
drwxr-xr-x 3 root root     4096 Jun  1 04:06 dtb
drwxr-xr-x 3 root root     4096 Jun  1 04:06 dtb-5.10.110-rockchip-rk3588
drwxr-xr-x 3 root root     4096 Oct  7 09:20 dtbs
lrwxrwxrwx 1 root root       32 Oct  8 01:59 Image -> vmlinuz-5.10.110-rockchip-rk3588
-rw-r--r-- 1 root root  9640328 Oct  8 05:12 initramfs-6.1.53-gentoo-r1-arm64.img  <--- Was generated
-rw------- 1 root root 12177947 Oct  8 00:29 initramfs-6.1.53-gentoo-r1.img
-rw-r--r-- 1 root root 28914325 Oct  7 09:22 initramfs-6.1.55-gentoo-dist.img
-rwxr-xr-x 1 root root 20015902 Jun  1 04:16 initrd.img-5.10.110-rockchip-rk3588
-rwxr-xr-x 1 root root  1152056 Jun  1 04:07 logo.bmp
drwx------ 2 root root    16384 Oct  7 07:05 lost+found
-rwxr-xr-x 1 root root      226 Oct  8 02:20 orangepiEnv.txt
-rwxr-xr-x 1 root root     1542 Jun  1 04:13 orangepi_first_run.txt.template
-rwxr-xr-x 1 root root  7780782 Jun  1 03:43 System.map-5.10.110-rockchip-rk3588
-rw-r--r-- 1 root root  4371654 Oct  8 03:41 System.map-6.1.53-gentoo-r1-arm64     <--- Was generated-   
-rw-r--r-- 1 root root  6986092 Oct  7 09:22 System.map-6.1.55-gentoo-dist
lrwxrwxrwx 1 root root       32 Oct  8 01:59 uInitrd -> uInitrd-5.10.110-rockchip-rk3588
-rwxr-xr-x 1 root root 20015966 Oct  7 07:48 uInitrd-5.10.110-rockchip-rk3588
-rw-r--r-- 1 root root 12178011 Oct  8 00:33 uInitrd-6.1.53-gentoo-r1
-rwxr-xr-x 1 root root 28914389 Oct  7 09:38 uInitrd-6.1.55-gentoo-dist
-rwxr-xr-x 1 root root 34109952 Oct  7 11:46 vmlinuz-5.10.110-rockchip-rk3588
-rw-r--r-- 1 root root 31156736 Oct  7 23:31 vmlinuz-6.1.53-gentoo-dist
-rw-r--r-- 1 root root 27806208 Oct  8 03:41 vmlinuz-6.1.53-gentoo-r1-arm64     <--- Was generated 
-rw-r--r-- 1 root root 12272594 Oct  7 09:22 vmlinuz-6.1.55-gentoo-dist
-rw-r--r-- 1 root root 12272594 Oct  7 12:03 vmlinuz-6.1.55-gentoo-dist.ori

make modules_install

  1. emerge dev-embedded/u-boot-tools
(chroot) orangepi5plus /boot # mkimage -A arm64 -O linux -T ramdisk -C none -a 0 -e 0  -d initramfs-6.1.53-gentoo-r1-arm64.img  uInitrd-6.1.53-gentoo-r1-arm64 
Image Name:   
Created:      Sun Oct  8 07:19:22 2023
Image Type:   AArch64 Linux RAMDisk Image (uncompressed)
Data Size:    9637200 Bytes = 9411.33 KiB = 9.19 MiB
Load Address: 00000000
Entry Point:  00000000
(chroot) orangepi5plus /boot # file uInitrd-6.1.53-gentoo-r1-arm64 
uInitrd-6.1.53-gentoo-r1-arm64: u-boot legacy uImage, , Linux/ARM 64-bit, RAMDisk Image (Not compressed), 9637200 bytes, Sun Oct  8 07:19:22 2023, Load Address: 00000000, Entry Point: 00000000, Header CRC: 0X7E24B81E, Data CRC: 0X578838A8

(chroot) orangepi5plus /boot # file uInitrd-5.10.110-rockchip-rk3588 
uInitrd-5.10.110-rockchip-rk3588: u-boot legacy uImage, , Linux/ARM 64-bit, RAMDisk Image (Not compressed), 20015902 bytes, Sat Oct  7 07:48:57 2023, Load Address: 00000000, Entry Point: 00000000, Header CRC: 0X3FC0BAF3, Data CRC: 0X818C401E

(chroot) orangepi5plus /boot # cp -v  boot.scr  boot.scr.ori
'boot.scr' -> 'boot.scr.ori'
(chroot) orangepi5plus /boot # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
Image Name:   
Created:      Sun Oct  8 07:25:48 2023
Image Type:   ARM Linux Script (uncompressed)
Data Size:    3347 Bytes = 3.27 KiB = 0.00 MiB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 3339 Bytes = 3.26 KiB = 0.00 MiB
(chroot) hc4Gentoo /boot # mkimage -A arm64 -O linux -T ramdisk -C none -a 0 -e 0  -d initramfs-6.1.53-gentoo-r1-arm64.img  ^Citramfs-6.1.53-gentoo-r1-arm64.uimg 
(chroot) hc4Gentoo /boot

do forget make modules_install <-- genkernel will install it