§2023-09-19
- on h2Jammy.yushei.net
- please follow rpi4B 00-build to prepre your SSD.
- make sure you did copy the directory of kernel built directory
linux-6.3-manjaro
/usr/src/.
And then move on to hc4Gentoo.yushei.net, to make initramfs...
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 512M 0 part
├─sda2 8:2 0 16G 0 part
└─sda3 8:3 0 60G 0 part
$ sudo mount /dev/sda3 root
$ ls root
bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin sys tmp usr var
$ sudo arch-chroot root /bin/bash
hc4Gentoo / # source /etc/profile
hc4Gentoo / # export PS1="(chroot) $PS1"
(chroot) hc4Gentoo / #
nano /etc/resolv.conf
<-- look like has been set
nameserver 8.8.8.8
nameserver 8.8.4.4
(chroot) hc4Gentoo / # ping google.com
PING google.com (172.217.160.110) 56(84) bytes of data.
64 bytes from tsa03s06-in-f14.1e100.net (172.217.160.110): icmp_seq=1 ttl=57 time=3.91 ms
64 bytes from tsa03s06-in-f14.1e100.net (172.217.160.110): icmp_seq=2 ttl=57 time=3.80 ms
/etc/portage/repos.conf/gentoo.conf
(chroot) hc4Gentoo / # mkdir /etc/portage/repos.conf/
(chroot) hc4Gentoo / # /etc/portage/repos.conf/gentoo.conf --> as follows
[gentoo]
location = /var/db/repos/gentoo
sync-type = rsync
sync-uri = rsync://rsync.namerica.gentoo.org/gentoo-portage
auto-sync = yes
priority = 10
(chroot) hc4Gentoo /# mkdir -p /var/db/repos/gentoo
(chroot) hc4Gentoo / # chown portage:portage -R /var/db/repos/
(chroot) hc4Gentoo / # emerge-webrsync
....
# eselect profile list
# eselect profile se 4
# # ls -l /etc/portage/make.profile
lrwxrwxrwx 1 root root 67 Sep 19 06:24 /etc/portage/make.profile -> ../../var/db/repos/gentoo/profiles/default/linux/arm64/17.0/deskto
# emerge -av u-boot-tools
# qlist u-boot-tools
/etc/fw_env.config
/usr/share/man/man1/mkimage.1.bz2
/usr/bin/fdtgrep
/usr/bin/img2srec
/usr/bin/fw_printenv
/usr/bin/mkimage
/usr/bin/dumpimage
/usr/bin/gen_eth_addr
/usr/bin/bmp_logo
/usr/bin/mkenvimage
/usr/bin/fw_setenv
- nano
/etc/portgage/make.conf
add these lines
# emerge --ask sys-kernel/genkernel
ACCEPT_LICENSE="linux-fw-redistributable"
# emerge --ask sys-kernel/genkernel
# qlist genkernel|grep bin
/usr/share/genkernel/netboot/misc/bin/ashlogin
/usr/share/genkernel/netboot/misc/bin/net-setup
/usr/bin/genkernel
# ls -l /usr/src/
total 4
lrwxrwxrwx 1 root root 18 Sep 19 06:52 linux -> linux-6.3-manjaro/
drwxr-xr-x 26 root root 4096 Sep 19 05:56 linux-6.3-manjaro
# mount /dev/sda1 /boot
(chroot) hc4Gentoo / # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 512M 0 part /boot
├─sda2 8:2 0 16G 0 part
└─sda3 8:3 0 60G 0 part /
# ls /boot
Image Image.gz boot.ini dtbs initramfs-linux.img initramfs-linux.uimg sd_fusing.sh u-boot.bin
# genkernel --install initramfs
* Gentoo Linux Genkernel; Version 4.3.6
* Using genkernel configuration from '/etc/genkernel.conf' ...
* Running with options: --install initramfs
* Working with Linux kernel 6.3.0 for arm64
* Using kernel config file '/usr/share/genkernel/arch/arm64/generated-config' ...
* Current kernel's LOCALVERSION is set to ''; Will ignore set --kernel-localversion value '-arm64' because kernel was not built ...
* 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 4 to one. The automatic memory usage limit of 917 MiB is still being exceeded. 1250 MiB of memory is required. Continuing anyway.
*
* You will find the initramfs in '/boot/initramfs-6.3.0.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
# ls /boot
Image Image.gz boot.ini dtbs initramfs-6.3.0.img initramfs-linux.img initramfs-linux.uimg sd_fusing.sh u-boot.bin
- time genkernel all
# time 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.3.0 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 ...
* >> 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.3.0-arm64 for arm64 ...
* >> Compiling 6.3.0-arm64 Image ...
* >> Installing 6.3.0-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.3.0-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 4 to one. The automatic memory usage limit of 917 MiB is still being exceeded. 1250 MiB of memory is required. Continuing anyway.
* 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.3.0-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.
real 327m4.380s
user 1180m54.158s
sys 103m34.782s
5. mkimage
(chroot) hc4Gentoo /boot # # mkimage -A arm64 -O linux -T ramdisk -C none -a 0x0 -e 0x0 -d initramfs-6.3.0-arm64.img initramfs-6.3.0-arm64.img.uimg
Image Name:
Created: Tue Sep 19 21:54:34 2023
Image Type: AArch64 Linux RAMDisk Image (uncompressed)
Data Size: 9842028 Bytes = 9611.36 KiB = 9.39 MiB
Load Address: 00000000
Entry Point: 00000000
mkimage -A arm64 -O linux -T ramdisk -C none -a 0x1080000 -e 0x1080000 -d initramfs-6.3.0-arm64.img initramfs-6.3.0-arm64.img.uimg
Image Name:
Created: Tue Sep 19 21:43:10 2023
Image Type: AArch64 Linux RAMDisk Image (uncompressed)
Data Size: 9842028 Bytes = 9611.36 KiB = 9.39 MiB
Load Address: 01080000
Entry Point: 01080000
---
- /etc/genkernel.conf
Configuration file for genkernel
This file is sourced by genkernel at startup and determines which options
we will be using to compile our kernel. The order of precidence is simple,
with the internal settings being least important, configuration file
settings next, and command line options being most important.
=========COMMON COMMAND LINE OPTION DEFAULTS=========
Install to $BOOTDIR
#INSTALL="yes"
Run 'make oldconfig' before compiling this kernel
#OLDCONFIG="yes"
Run 'make menuconfig' before compiling this kernel
#MENUCONFIG="no"
Run 'make gconfig' before compiling this kernel
#GCONFIG="no"
Run 'make nconfig' (ncurses 'menuconfig') before compiling this kernel
#NCONFIG="no"
Run 'make xconfig' before compiling this kernel
#XCONFIG="no"
Run 'make mrproper' before compiling this kernel
#MRPROPER="yes"
Run 'make clean' before compiling this kernel
Only needed if MRPROPER is set to NO because
MRPROPER implies 'make clean'.
#CLEAN="yes"
Mount BOOTDIR automatically if it isn't mounted
#MOUNTBOOT="yes"
Make symlinks in BOOTDIR automatically
#SYMLINK="no"
Save the new configuration in /etc/kernels upon
successful compilation
#SAVE_CONFIG="yes"
Enable color output in genkernel
NOCOLOR="false"
Clear build cache dir on gernkernel start
#CLEAR_CACHEDIR="no"
Clear all tmp files and caches after genkernel has run
#POSTCLEAR="no"
Check for x MB free disk space in BOOTDIR
#CHECK_FREE_DISK_SPACE_BOOTDIR=0
Check for x MB free disk space in kernel outputdir
#CHECK_FREE_DISK_SPACE_KERNELOUTPUTDIR=0
Genkernel uses an independent configuration for MAKEOPTS, and does not source
/etc/portage/make.conf . You can override the default setting by uncommenting
and tweaking the following line. Default setting is set up by
${GK_SHARE}/${ARCH_OVERRIDE}/config.sh . The recommended value for -j
argument is: *+1
#MAKEOPTS="$(portageq envvar MAKEOPTS)"
Run the kernel make at the following NICE level
#NICE=10
Add bcache support
#BCACHE="no"
Add LVM support
#LVM="no"
Add LUKS support
#LUKS="no"
Add GnuPG support
#GPG="no"
Add keyctl support for loading LUKS passphrase into a keyring
#KEYCTL="no"
Add in early microcode support: this sets the kernel options for early microcode loading
Possible values: empty/"no", "all", "intel", "amd"
#MICROCODE="all"
Include early microcode in generated initramfs.
Only needed if system cannot load multiple initramfs.
NOTE: >=sys-boot/grub-2 will detect and auto-load {amd,intel}-uc.img file
provided by sys-firmware/intel-microcode[initramfs] or
sys-kernel/linux-firmware[initramfs].
#MICROCODE_INITRAMFS="no"
Add NFS support
#NFS="no"
Add DMRAID support
#DMRAID="no"
Add SSH support
#SSH="no"
Add b2sum support
#B2SUM="no"
Include busybox in the initramfs. If included, busybox is rebuilt
if the cached copy is out of date.
#BUSYBOX="yes"
Add MDRAID support
#MDADM="no"
Specify a custom mdadm.conf.
By default the initramfs will be built without an mdadm.conf and will auto-detect
arrays during bootup. Usually, this should not be needed.
#MDADM_CONFIG="/etc/mdadm.conf"
Add Multipath support
#MULTIPATH="no"
Add iSCSI support
#ISCSI="no"
Add e2fsprogs support
#E2FSPROGS="no"
Include support for unionfs
#UNIONFS="no"
Include support for zfs volume management. If unset, genkernel will attempt
to autodetect and enable this when rootfs is on zfs.
#ZFS="no"
Add BTRFS support
#BTRFS="no"
Add xfsprogs support
#XFSPROGS="no"
Install firmware onto root filesystem
Will conflict with sys-kernel/linux-firmware package
#FIRMWARE_INSTALL="no"
Add firmware(s) to initramfs
#FIRMWARE="no"
Specify directory to pull from
#FIRMWARE_DIR="/lib/firmware"
Specify a comma-separated list of firmware files or directories to include,
relative to FIRMWARE_DIR. If empty or unset, the full contents of
FIRMWARE_DIR will be included (if FIRMWARE option above is set to YES).
#FIRMWARE_FILES=""
Add new kernel to grub
Possible values: empty/"no", "grub", "grub2"
#BOOTLOADER="no"
Use sandbox when building initramfs
#SANDBOX="yes"
Embed and set font early on boot
Possible values: empty/"none", "current",
#BOOTFONT="none"
Add boot splash using splashutils
#SPLASH="no"
Use this splash theme. If commented out - the "default" name theme is used.
Also, SPLASH="yes" needs to be enabled for this one to work.
This supersedes the "SPLASH_THEME" option in '/etc/conf.d/splash'.
#SPLASH_THEME="gentoo"
Run "emerge @module-rebuild" automatically when possible and necessary
after kernel and modules have been compiled
#MODULEREBUILD="yes"
Run the specified command in the current environment after the kernel and
modules have been compiled, useful to rebuild external kernel module
(see MODULEREBUILD above) or installing additional
files (use 'copy_image_with_preserve dtb path/to/dtb dtb ')
#CMD_CALLBACK=""
=========KEYMAP SETTINGS=========
Force keymap selection at boot
#DOKEYMAPAUTO="no"
Enables keymap selection support
#KEYMAP="yes"
=========LOW LEVEL COMPILE SETTINGS=========
Assembler to use for the kernel. See also the --kernel-as command line
option.
#KERNEL_AS="as"
Archiver to use for the kernel. See also the --kernel-ar command line
option.
#KERNEL_AR="ar"
Compiler to use for the kernel (e.g. distcc). See also the --kernel-cc
command line option.
#KERNEL_CC="gcc"
Linker to use for the kernel. See also the --kernel-ld command line option.
#KERNEL_LD="ld"
NM utility to use for the kernel. See also the --kernel-nm command line option.
#KERNEL_NM="nm"
GNU Make to use for kernel. See also the --kernel-make command line option.
#KERNEL_MAKE="make"
objcopy utility to use for the kernel. See also the --kernel-objcopy command
line option.
#KERNEL_OBJCOPY="objcopy"
objdump utility to use for the kernel. See also the --kernel-objdump command
line option.
#KERNEL_OBJDUMP="objdump"
ranlib utility to use for the kernel. See also the --kernel-ranlib command
line option.
#KERNEL_RANLIB="ranlib"
readelf utility to use for the kernel. See also the --kernel-readelf command
line option.
#KERNEL_READELF="readelf"
strip utility to use for the kernel. See also the --kernel-strip command line
option.
#KERNEL_STRIP="strip"
Assembler to use for the utilities. See also the --utils-as command line
option.
#UTILS_AS="as"
Archiver to use for the utilities. See also the --utils-ar command line
option.
#UTILS_AR="ar"
C Compiler to use for the utilities (e.g. distcc). See also the --utils-cc
command line option.
#UTILS_CC="gcc"
C++ Compiler to use for the utilities (e.g. distcc). See also the --utils-cxx
command line option.
#UTILS_CXX="g++"
Linker to use for the utilities. See also the --utils-ld command line
option.
#UTILS_LD="ld"
NM utility to use for the utilities. See also the --utils-nm command line option.
#UTILS_NM="nm"
GNU Make to use for the utilities. See also the --utils-make command line
option.
#UTILS_MAKE="make"
Target triple (i.e. aarch64-linux-gnu) to build for. If you do not
cross-compile, leave blank for auto detection.
#CROSS_COMPILE=""
Target triple (i.e. aarch64-linux-gnu) to build kernel for. Utilities will be
built for the native target, not this target. If you do not cross-compile,
leave blank.
#KERNEL_CROSS_COMPILE=""
Override default make target (bzImage). See also the --kernel-target
command line option. Useful to build a uImage on arm.
#KERNEL_MAKE_DIRECTIVE_OVERRIDE="fooImage"
Override default kernel binary path. See also the --kernel-binary
command line option. Useful to install a uImage on arm.
#KERNEL_BINARY_OVERRIDE="arch/foo/boot/bar"
=========GENKERNEL LOCATION CONFIGURATION=========
Variables:
%%ARCH%% - Final determined architecture
%%CACHE%% - Final determined cache location
Set genkernel's temporary work directory
#TMPDIR="/var/tmp/genkernel"
Set the boot directory, default is /boot
#BOOTDIR="/boot"
Default share directory location
GK_SHARE="${GK_SHARE:-/usr/share/genkernel}"
Location of the default cache
CACHE_DIR="/var/cache/genkernel"
Location of DISTDIR, where our source tarballs are stored
DISTDIR="${GK_SHARE}/distfiles"
Log output file
LOGFILE="/var/log/genkernel.log"
Debug Level
LOGLEVEL=1
=========COMPILED UTILS CONFIGURATION=========
Default location of kernel source
DEFAULT_KERNEL_SOURCE="/usr/src/linux"
Default kernel config (only use to override using
arch/%%ARCH%%/kernel-config-${VER}.${PAT} !)
#DEFAULT_KERNEL_CONFIG="${GK_SHARE}/arch/%%ARCH%%/kernel-config"
Specifies a user created busybox config
#BUSYBOX_CONFIG="/path/to/file"
NOTE: Since genkernel 3.4.41 the version of
busybox, lvm, mdadm, ... have been moved to
/usr/share/genkernel/defaults/software.sh in order to
reduce the merging you have to do during etc-update.
You can still override these settings in here.
=========MISC KERNEL CONFIGURATION=========
Set kernel filename which will be used when kernel will be installed
into BOOTDIR. See man page to learn more about available placeholders.
#KERNEL_FILENAME="vmlinuz-%%KV%%"
Set kernel symlink name which will be used when kernel will be installed
into BOOTDIR and SYMLINK option is enabled
#KERNEL_SYMLINK_NAME="kernel"
This option will set kernel option CONFIG_LOCALVERSION.
Use special value "UNSET" to unset already set CONFIG_LOCALVERSION.
#KERNEL_LOCALVERSION="-%%ARCH%%"
This option is only valid if kerncache is
defined. If there is a valid kerncache no checks
will be made against a kernel source tree.
#KERNEL_SOURCES="yes"
Build a static (monolithic kernel)
#BUILD_STATIC="no"
Make and install kernelz image (PowerPC)
#GENZIMAGE="no"
Archive file created using tar containing kernel binary, content
of /lib/modules and the kernel config.
NOTE: Archive is created before the callbacks are run!
#KERNCACHE="/path/to/file.tar.xz"
Prefix to kernel module destination, modules
will be installed in /lib/modules
#KERNEL_MODULES_PREFIX=""
=========MISC INITRAMFS CONFIGURATION=========
Set initramfs filename which will be used when initramfs will be
installed into BOOTDIR. See man page to learn more about available
placeholders.
#INITRAMFS_FILENAME="initramfs-%%KV%%.img"
Set initramfs symlink name which will be used when initramfs will be
installed into BOOTDIR and SYMLINK option is enabled
#INITRAMFS_SYMLINK_NAME="initramfs"
Copy all compiled kernel modules to the initramfs
#ALLRAMDISKMODULES="no"
Copy selected modules to the initramfs based on arch-specific modules_load file
#RAMDISKMODULES="yes"
Archive file created using tar containing kernel and initramfs.
NOTE: No modules outside of the initramfs will be included!
#MINKERNPACKAGE="/path/to/file.tar.xz"
Add additional modules to the initramfs using the module groups defined
in /usr/share/genkernel/defaults/modules_load (see this file for
more details). This would be used if, for example, you
required an additional crypto module or network device at boot
time and did not want to statically compile these in the kernel.
Options take the form AMODULES_{group} where {group} is one of
the groups in modules_load (which are in the form MODULES_{group}).
Use this with caution.
#AMODULES_group="module-to-include another-module"
Override the default modules in the initramfs, for a given group, as defined by
/usr/share/genkernel/defaults/modules_load and the per-arch modules_load
files. You PROBABLY want to use AMODULES_* above, and NOT MODULES_* here.
If you use MODULES_* here, the default and per-arch modules will NOT be used.
#MODULES_group1="some-module" #MODULES_group2="" # Load no modules for this group
Override the default used linuxrc script.
#LINUXRC="/path/to/custom/linuxrc"
Archive file created using tar containing modules after
the callbacks have run
#MODULESPACKAGE="/path/to/file.tar.xz"
Directory structure to include in the initramfs,
only available on >=2.6 kernels
#INITRAMFS_OVERLAY=""
Build the generated initramfs into the kernel instead of
keeping it as a separate file
#INTEGRATED_INITRAMFS="no"
Compress generated initramfs
#COMPRESS_INITRD="yes"
Types of compression: best, xz, lzma, bzip2, gzip, lzop, lz4, zstd, fastest
"best" selects the best available compression method
"fastest" selects the fastest available compression method
#COMPRESS_INITRD_TYPE="best"
wrap initramfs using mkimage for u-boot bootloader
WRAP_INITRD=no
Create a self-contained env in the initramfs
#NETBOOT="no"
=========MISC BOOT CONFIGURATION=========
Specify a default for real_root=
#REAL_ROOT="/dev/one/two/gentoo"