ยง2023-10-25
UEFI, short for Unified Extensible Firmware Interface, is a firmware standard for boot ROM designed to provide a stable API for interacting with system hardware. On x86 it replaced the legacy BIOS.
It was developed by Intel as Extensible Firmware Interface, short EFI, for the Itanium architecture ("IA-64" or Intel Architecture 64-bit). Like Open Firmware it is designed to be an architecture independent platform available to different CPU instruction sets. It was ported to 32-bit x86 "IA-32" (also i386 and x86-32), 64-bit x86 "x86-64" (also x64, AMD64 and Intel 64), ARM, RISC-V, and LoongArch.
This is a continuation from 2023-10-24-LiveUSB.md.
- Install sys-apps/pciutils. This package contains a tool called lspci that you will use to identify what PCI hardware you have in your system. You will have to enable all drivers on the kernel.
emerge --ask sys-apps/pciutils
- list pci devices
(chroot) livecd / # lspci
00:00.0 Host bridge: Intel Corporation Gemini Lake Host Bridge (rev 03)
00:02.0 VGA compatible controller: Intel Corporation GeminiLake [UHD Graphics 600] (rev 03)
00:0e.0 Audio device: Intel Corporation Celeron/Pentium Silver Processor High Definition Audio (rev 03)
00:0f.0 Communication controller: Intel Corporation Celeron/Pentium Silver Processor Trusted Execution Engine Interface (rev 03)
00:12.0 SATA controller: Intel Corporation Celeron/Pentium Silver Processor SATA Controller (rev 03)
00:13.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f3)
00:14.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f3)
00:14.1 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f3)
00:15.0 USB controller: Intel Corporation Celeron/Pentium Silver Processor USB 3.0 xHCI Controller (rev 03)
00:17.0 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor I2C 4 (rev 03)
00:17.1 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor I2C 5 (rev 03)
00:17.2 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor I2C 6 (rev 03)
00:17.3 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor I2C 7 (rev 03)
00:1c.0 SD Host controller: Intel Corporation Celeron/Pentium Silver Processor SDA Standard Compliant SD Host Controller (rev 03)
00:1f.0 ISA bridge: Intel Corporation Celeron/Pentium Silver Processor LPC Controller (rev 03)
00:1f.1 SMBus: Intel Corporation Celeron/Pentium Silver Processor Gaussian Mixture Model (rev 03)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04)
make menuconfig
- copy from liveCD
sudo cp -v /etc/kernels/kernel-config-6.1.57-gentoo-x86_64 /mnt/gentoo/usr/src
(chroot) livecd /usr/src # cd linux-6.1.57-gentoo/
(chroot) livecd /usr/src/linux-6.1.57-gentoo # make mrproper
(chroot) livecd /usr/src/linux-6.1.57-gentoo # cp -v ../kernel-config-6.1.57-gentoo-x86_64 .config
'../kernel-config-6.1.57-gentoo-x86_64' -> '.config'
(chroot) livecd /usr/src/linux-6.1.57-gentoo # make oldconfig
(chroot) livecd /usr/src/linux-6.1.57-gentoo # make menuconfig --> make sure EFI support. Skip lspci devices, for the time being
time make
on h2Hammy, odroid-h2
real 381m46.644s
user 343m51.747s
sys 037m1.934s
make modules_install
(chroot) livecd / # ls /lib
cpp libBrokenLocale.so.1 libcrypt.so.2.0.0 libnsl.so.1 libnss_hesiod.so.2 librt.so.1 systemd
firmware libc_malloc_debug.so.0 libc.so.6 libnss_compat.so.2 libowcrypt.so.1 libthread_db.so.1 udev
gentoo libcrypt.so.1 libdl.so.2 libnss_db.so.2 libpcprofile.so libutil.so.1
ld-linux.so.2 libcrypt.so.1.1.0 libmemusage.so libnss_dns.so.2 libpthread.so.0 modprobe.d
libanl.so.1 libcrypt.so.2 libm.so.6 libnss_files.so.2 libresolv.so.2 sysctl.d
(chroot) livecd /usr/src/linux-6.1.57-gentoo # make modules_install
...
INSTALL /lib/modules/6.1.57-gentoo-x86_64/kernel/sound/usb/usx2y/snd-usb-usx2y.ko
INSTALL /lib/modules/6.1.57-gentoo-x86_64/kernel/sound/virtio/virtio_snd.ko
INSTALL /lib/modules/6.1.57-gentoo-x86_64/kernel/sound/x86/snd-hdmi-lpe-audio.ko
INSTALL /lib/modules/6.1.57-gentoo-x86_64/kernel/sound/xen/snd_xen_front.ko
INSTALL /lib/modules/6.1.57-gentoo-x86_64/kernel/virt/lib/irqbypass.ko
DEPMOD /lib/modules/6.1.57-gentoo-x86_64
mount to /boot
(chroot) livecd /usr/src/linux-6.1.57-gentoo # mount /dev/sdb1 /boot
(chroot) livecd /usr/src/linux-6.1.57-gentoo # make install
INSTALL /boot
(chroot) livecd /usr/src/linux-6.1.57-gentoo # ls /boot/
config-6.1.57-gentoo-x86_64 System.map-6.1.57-gentoo-x86_64 vmlinuz-6.1.57-gentoo-x86_64
- Install sys-kernel/dracut
This package will help you create an initrmfs (Init Ram Filesystem) with the required tools to make the kernel bootable:
emerge --ask sys-kernel/dracut
Run dracut to generate an initramfs for our kernel version:
dracut --kver=5.15.59-gentoo
<-- same name as /lib/modules/6.1.57-gentoo-x86_64
(chroot) livecd /usr/src/linux-6.1.57-gentoo # dracut --kver=6.1.57-gentoo-x86_64
dracut: Executing: /usr/bin/dracut --kver=6.1.57-gentoo-x86_64
dracut: dracut module 'dash' will not be installed, because command 'dash' could not be found!
dracut: dracut module 'mksh' will not be installed, because command 'mksh' could not be found!
dracut: dracut module 'systemd-integritysetup' will not be installed, because command '/lib/systemd/systemd-integritysetup' could not be found!
dracut: dracut module 'systemd-integritysetup' will not be installed, because command '/lib/systemd/system-generators/systemd-integritysetup-generator' could not be found!
dracut: dracut module 'systemd-pcrphase' will not be installed, because command '/lib/systemd/systemd-pcrphase' could not be found!
dracut: dracut module 'systemd-veritysetup' will not be installed, because command '/lib/systemd/systemd-veritysetup' could not be found!
dracut: dracut module 'systemd-veritysetup' will not be installed, because command '/lib/systemd/system-generators/systemd-veritysetup-generator' could not be found!
dracut: dracut module 'modsign' will not be installed, because command 'keyctl' could not be found!
dracut: dracut module 'busybox' will not be installed, because command 'busybox' could not be found!
dracut: dracut module 'dbus-broker' will not be installed, because command 'dbus-broker' could not be found!
dracut: dracut module 'rngd' will not be installed, because command 'rngd' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmanctl' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand-wait-online' could not be found!
dracut: dracut module 'network-legacy' will not be installed, because command 'dhclient' could not be found!
dracut: dracut module 'network-wicked' will not be installed, because command 'wicked' could not be found!
dracut: 62bluetooth: Could not find any command of '/usr/lib/bluetooth/bluetoothd /usr/libexec/bluetooth/bluetoothd'!
dracut: dracut module 'lvmmerge' will not be installed, because command 'lvm' could not be found!
dracut: dracut module 'lvmthinpool-monitor' will not be installed, because command 'lvm' could not be found!
dracut: dracut module 'btrfs' will not be installed, because command 'btrfs' could not be found!
dracut: 90crypt: Could not find any command of '/lib/systemd/systemd-cryptsetup cryptsetup'!
dracut: dracut module 'dm' will not be installed, because command 'dmsetup' could not be found!
dracut: dracut module 'dmraid' will not be installed, because command 'dmraid' could not be found!
dracut: dracut module 'dmsquash-live-ntfs' will not be installed, because command 'ntfs-3g' could not be found!
dracut: dracut module 'lvm' will not be installed, because command 'lvm' could not be found!
dracut: dracut module 'mdraid' will not be installed, because command 'mdadm' could not be found!
dracut: dracut module 'multipath' will not be installed, because command 'multipath' could not be found!
dracut: dracut module 'pcsc' will not be installed, because command 'pcscd' could not be found!
dracut: dracut module 'tpm2-tss' will not be installed, because command 'tpm2' could not be found!
dracut: dracut module 'cifs' will not be installed, because command 'mount.cifs' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'dcbtool' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'fipvlan' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'lldpad' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'fcoemon' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'fcoeadm' could not be found!
dracut: dracut module 'fcoe-uefi' will not be installed, because command 'dcbtool' could not be found!
dracut: dracut module 'fcoe-uefi' will not be installed, because command 'fipvlan' could not be found!
dracut: dracut module 'fcoe-uefi' will not be installed, because command 'lldpad' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsi-iname' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsiadm' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsid' could not be found!
dracut: dracut module 'nbd' will not be installed, because command 'nbd-client' could not be found!
dracut: 95nfs: Could not find any command of 'rpcbind portmap'!
dracut: dracut module 'nvmf' will not be installed, because command 'nvme' could not be found!
dracut: dracut module 'biosdevname' will not be installed, because command 'biosdevname' could not be found!
dracut: dracut module 'memstrack' will not be installed, because command 'memstrack' could not be found!
dracut: memstrack is not available
dracut: If you need to use rd.memdebug>=4, please install memstrack and procps-ng
dracut: dracut module 'squash' will not be installed, because command 'mksquashfs' could not be found!
dracut: dracut module 'squash' will not be installed, because command 'unsquashfs' could not be found!
dracut: *** Including module: systemd ***
dracut: *** Including module: systemd-initrd ***
dracut: *** Including module: i18n ***
dracut: *** Including module: kernel-modules ***
dracut: *** Including module: kernel-modules-extra ***
dracut: *** Including module: nvdimm ***
dracut: *** Including module: qemu ***
dracut: *** Including module: qemu-net ***
dracut: *** Including module: lunmask ***
dracut: *** Including module: resume ***
dracut: *** Including module: rootfs-block ***
dracut: *** Including module: terminfo ***
dracut: *** Including module: udev-rules ***
dracut: Skipping udev rule: 40-redhat.rules
dracut: Skipping udev rule: 50-firmware.rules
dracut: Skipping udev rule: 50-udev.rules
dracut: Skipping udev rule: 91-permissions.rules
dracut: Skipping udev rule: 80-drivers-modprobe.rules
dracut: *** Including module: virtiofs ***
dracut: *** Including module: dracut-systemd ***
dracut: *** Including module: usrmount ***
dracut: *** Including module: base ***
dracut: *** Including module: fs-lib ***
dracut: *** Including module: shutdown ***
dracut: *** Including modules done ***
dracut: *** Installing kernel module dependencies ***
dracut: *** Installing kernel module dependencies done ***
dracut: *** Resolving executable dependencies ***
dracut: *** Resolving executable dependencies done ***
dracut: *** Hardlinking files ***
dracut: Mode: real
dracut: Method: sha256
dracut: Files: 1636
dracut: Linked: 4 files
dracut: Compared: 0 xattrs
dracut: Compared: 452 files
dracut: Saved: 6.9 KiB
dracut: Duration: 0.029723 seconds
dracut: *** Hardlinking files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Constructing AuthenticAMD.bin ***
dracut: *** Constructing GenuineIntel.bin ***
dracut: *** Store current command line parameters ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Creating image file '/boot/initramfs-6.1.57-gentoo-x86_64.img' ***
dracut: Using auto-determined compression method 'gzip'
dracut: *** Creating initramfs image file '/boot/initramfs-6.1.57-gentoo-x86_64.img' done ***
(chroot) livecd /usr/src/linux-6.1.57-gentoo # file /boot/initramfs-6.1.57-gentoo-x86_64.img
/boot/initramfs-6.1.57-gentoo-x86_64.img: ASCII cpio archive (SVR4 with no CRC)
- Systemd boot (bootloader)
Systemd-boot is a simple UEFI boot manager which executes configured EFI images. The default entry is selected by an on-screen menu.
It is simple to configure, but can only start EFI executables, such as the Linux kernel EFISTUB, UEFI Shell, GRUB, and go on.
Before installing the EFI binaries we need to check if EFI variables are accessible:
(chroot) livecd /usr/src/linux-6.1.57-gentoo # emerge --ask sys-libs/efivar
(chroot) livecd /usr/src/linux-6.1.57-gentoo # efivar -l
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootCurrent
8be4df61-93ca-11d2-aa0d-00e098032b8c-PlatformLangCodes
8be4df61-93ca-11d2-aa0d-00e098032b8c-ErrOutDev
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOptionSupport
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConInDev
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOutDev
9cfa1ece-4488-49be-9a4b-e9b511826577-SSRAMBASE
9cb2e73f-7325-40f4-a484-659bb344c3cd-SOFTWAREGUARDSTATUS
8be4df61-93ca-11d2-aa0d-00e098032b8c-OsIndicationsSupported
01368881-c4ad-4b1d-b631-d57a8ec8db6b-OA3MSDMvariable
01368881-c4ad-4b1d-b631-d57a8ec8db6b-FPDT_Volatile
8be4df61-93ca-11d2-aa0d-00e098032b8c-PKDefault
8be4df61-93ca-11d2-aa0d-00e098032b8c-KEKDefault
8be4df61-93ca-11d2-aa0d-00e098032b8c-dbDefault
8be4df61-93ca-11d2-aa0d-00e098032b8c-dbxDefault
19ad5244-fd6b-4e5c-826a-414646d6da6a-PlatformInfo
8be4df61-93ca-11d2-aa0d-00e098032b8c-VendorKeys
8be4df61-93ca-11d2-aa0d-00e098032b8c-SignatureSupport
8be4df61-93ca-11d2-aa0d-00e098032b8c-SecureBoot
8be4df61-93ca-11d2-aa0d-00e098032b8c-SetupMode
8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
8be4df61-93ca-11d2-aa0d-00e098032b8c-PlatformLang
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot000C
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0002
8be4df61-93ca-11d2-aa0d-00e098032b8c-OsIndications
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootOrder
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0007
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0008
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot000B
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0000
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0001
81c76078-bfde-4368-9790-570914c01a65-SetUpdateCountVar
fd72b1b5-5391-4c6a-bdfd-9f59a7880a21-PlatformRelatedInfo
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0006
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0005
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0004
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0003
45cf35f6-0d6e-4d04-856a-0370a5b16f53-DefaultBootOrder
8be4df61-93ca-11d2-aa0d-00e098032b8c-ErrOut
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConIn
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOut
e20939be-32d4-41be-a150-897f85d49829-MemoryOverwriteRequestControl
bb983ccf-151d-40e1-a07b-4a17be168292-MemoryOverwriteRequestControlLock
4b3082a3-80c6-4d7e-9cd0-583917265df1-MaximumTableSize
4b3082a3-80c6-4d7e-9cd0-583917265df1-SmbiosScratchBuffer
4b3082a3-80c6-4d7e-9cd0-583917265df1-SmbiosV3EntryPointTable
4b3082a3-80c6-4d7e-9cd0-583917265df1-SmbiosEntryPointTable
4b3082a3-80c6-4d7e-9cd0-583917265df1-WriteOnceStatus
3812723d-7e48-4e29-bc27-f5a39ac94ef1-ItkBiosModVar
c60aa7f6-e8d6-4956-8ba1-fe26298f5e87-EPCBIOS
ec87d643-eba4-4bb5-a1e5-3f3e36b20da9-IBBROBBBase
41282ef2-9b5a-4eb7-95d8-d9cd7bdce367-SLP20Magic
8be4df61-93ca-11d2-aa0d-00e098032b8c-PK
8be4df61-93ca-11d2-aa0d-00e098032b8c-KEK
d719b2cb-3d3a-4596-a3bc-dad00e67656f-db
d719b2cb-3d3a-4596-a3bc-dad00e67656f-dbx
9d0da369-540b-46f8-85a0-2b5f2c301e15-EfiTime
01368881-c4ad-4b1d-b631-d57a8ec8db6b-MonotonicCounter
97e8965f-c761-4f48-b6e4-9ffa9cb2a2d6-DeploymentModeNv
- verify you have mounted boot
(chroot) livecd /usr/src/linux-6.1.57-gentoo # mount | grep boot
/dev/sdb1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
- we have to use bootctl, by install
sys-kernel/installkernel-systemd-boot
(chroot) livecd /usr/src/linux-6.1.57-gentoo # emerge --ask sys-kernel/installkernel-systemd-boot
* IMPORTANT: 10 news items need reading for repository 'gentoo'.
* Use eselect news read to view new items.
These are the packages that would be merged, in order:
Calculating dependencies... done!
Dependency resolution took 3.33 s.
[ebuild N ] sys-boot/gnu-efi-3.0.15 USE="(-custom-cflags)" ABI_X86="(64) -32"
[ebuild R ] sys-apps/systemd-253.11 USE="gnuefi*"
[ebuild N ] sys-kernel/installkernel-systemd-boot-2-r3
[uninstall ] sys-kernel/installkernel-gentoo-7
[blocks b ] sys-kernel/installkernel-gentoo ("sys-kernel/installkernel-gentoo" is soft blocking sys-kernel/installkernel-systemd-boot-2-r3)
[blocks b ] sys-kernel/installkernel-systemd-boot ("sys-kernel/installkernel-systemd-boot" is soft blocking sys-kernel/installkernel-gentoo-7)
The following USE changes are necessary to proceed:
(see "package.use" in the portage(5) man page for more details)
# required by sys-kernel/installkernel-systemd-boot-2-r3::gentoo
# required by sys-kernel/installkernel-systemd-boot (argument)
>=sys-apps/systemd-253.11 gnuefi
Would you like to add these changes to your config files? [Yes/No]
Autounmask changes successfully written.
* IMPORTANT: config file '/etc/portage/package.use/zz-autounmask' 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) livecd /usr/src/linux-6.1.57-gentoo # dispatch-conf
--- /etc/portage/package.use/zz-autounmask 2023-10-25 10:42:00.402286837 -0000
+++ /etc/portage/package.use/._cfg0000_zz-autounmask 2023-10-25 10:42:02.982287016 -0000
@@ -1 +1,3 @@
-# package.use
\ No newline at end of file
+# package.use# required by sys-kernel/installkernel-systemd-boot-2-r3::gentoo
+# required by sys-kernel/installkernel-systemd-boot (argument)
+>=sys-apps/systemd-253.11 gnuefi
>> (1 of 1) -- /etc/portage/package.use/zz-autounmask
>> q quit, h help, n next, e edit-new, z zap-new, u use-new
m merge, t toggle-merge, l look-merge: <-- u
(chroot) livecd /usr/src/linux-6.1.57-gentoo # emerge --ask sys-kernel/installkernel-systemd-boot <-- again, to install
for oranpepi5+
git clone --depth=1 -b orange-pi-5.10-rk3588 https://github.com/orangepi-xunlong/linux-orangepi <-- faled to make
mv linux-orangepi/ linux-orange-pi-5.10-rk3588
make rockchip_linux_defconfig
git clone -b linux-5.10-gen-rkr5.1 https://github.com/Joshua-Riek/linux-rockchip.git
make rockchip_linux_defconfig
time make -j8 <--- ??? error ???
real 5m42.893s
user 39m43.449s
sys 4m33.305s
(chroot) orgpi58G /usr/src/linux-5.10-gen-rkr5.1 # make modules_install
sed: can't read modules.order: No such file or directory
make: *** [Makefile:1553: _modinst_] Error 2
zcat /proc/config.gz > .config