§2023-08-25

¶ 0. using img file

$ dd if=/dev/zero of=x86_64-32G-systemd.img bs=1M count=32768
$ sudo losetup /dev/loop24 x86_64-32G-systemd.img
$ sudo fdisk /dev/loop24
Device        Boot   Start      End  Sectors  Size Id Type
/dev/loop24p1         2048  1050623  1048576  512M  c W95 FAT32 (LBA)
/dev/loop24p2      1050624 67108863 66058240 31.5G 83 Linux
$ sudo partprobe /dev/loop24
$ lsblk
...
loop24       7:24   0    32G  0 loop 
├─loop24p1 259:0    0   512M  0 part 
└─loop24p2 259:1    0  31.5G  0 part

¶Step 1. Prepare to be arch-chroot into it

$ mkdir -p build/gentoo/src && cd $_
$ wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20230820T164643Z/stage3-amd64-systemd-20230820T164643Z.tar.xz
デバイス   起動 開始位置  最後から    セクタ サイズ Id タイプ
Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048    206847    204800   100M ef EFI (FAT-12/16/32) 
/dev/sdb2          206848   1255423   1048576   512M 83 Linux  --->.BOOT
/dev/sdb3         1255424 127084543 125829120    60G 83 Linux  ----> /, ROOT
/dev/sdb4       127084544 488397167 361312624 172.3G  5 Extended
/dev/sdb5       127086592 160641023  33554432    16G 82 Linux swap / Solaris --> SWAP
/dev/sdb6       160643072 488397167 327754096 156.3G 83 Linux  --->XFS AREA
[root@x8664Arch src]# sudo mkfs.vfat -F 32 /dev/sdb1
mkfs.fat 4.2 (2021-01-31)
[root@x8664Arch src]# sudo mkfs.vfat /dev/sdb2
mkfs.fat 4.2 (2021-01-31)
[root@x8664Arch src]# sudo mkfs.ext4 /dev/sdb3
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done                            
Creating filesystem with 15728640 4k blocks and 3932160 inodes
Filesystem UUID: 61a30f6d-e5e3-48af-bdb7-f93802b2a9b6
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done   

[root@x8664Arch src]# sudo mkswap /dev/sdb5
Setting up swapspace version 1, size = 16 GiB (17179865088 bytes)
no label, UUID=fda16193-da0f-4f3b-954e-676b7520fd84

$ mkdir root boot $ sudo mount /dev/sda3 root $ ls boot root stage3-amd64-systemd-20230820T164643Z.tar.xz $ sudo tar xvpf stage3-amd64-systemd-20230827T170145Z.tar.xz -C root

$ sudo arch-chroot root /bin/bash h2Jammy / # nano /etc/locale.gen h2Jammy / # locale-gen

- add the followings to end of /etc/profile
```
# export LANG, LC_ALL 
export LANG=en_US.UTF-8
# LANG is the primary environmental variable that sets the default locale for your system.
export LC_ALL=C.UTF-8
# LC_ALL is another environmental variable that can override the settings of LANG and other LC_* variables for all locale categories.
# 

# PS1
export PS1="(chroot) $PS1"
```
h2Jammy / # nano /etc/profile
h2Jammy / # source /etc/profile
(chroot) h2Jammy / # 
```

¶Step 2. /etc/resolv.conf
```
(chroot) hc4Gentoo / # nano /etc/resolv.conf
(chroot) hc4Gentoo / # cat /etc/resolv.conf 
nameserver 8.8.8.8
nameserver 8.8.4.4
(chroot) x8664Arch / # ping google.com
PING google.com (172.217.163.46) 56(84) bytes of data.
64 bytes from maa05s01-in-f14.1e100.net (172.217.163.46): icmp_seq=1 ttl=57 time=4.74 ms
64 bytes from tsa01s13-in-f14.1e100.net (172.217.163.46): icmp_seq=2 ttl=57 time=6.92 ms
```
¶Step 3 : Edit /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 -march=native"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
#
# *** CHOST ***
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
# for 64bit Intel PCs
 CHOST="x86_64-pc-linux-gnu"
# for 32bit Intel PCs
# CHOST="i686-pc-linux-gnu"
#
# *** USE flags ***
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
# See official Gentoo docs for more information.
USE="bindist mmx sse sse2 udev branding dbus startup-notification"
#
# *** MAKEOPTS ***
# With MAKEOPTS you define how many parallel compilations should occur
# when you install a package. A good choice is the number of CPUs (or CPU cores)
# in your system plus one, but this guideline isn't always perfect.
MAKEOPTS="-j4"

# 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

# Set the desired locale (adjust as needed)
LINGUAS="en_US.UTF-8"

# Set the system timezone (adjust as needed)
TIMEZONE="Asia/Taipei"

# Set the desired Python interpreter (adjust as needed)
# PYTHON_TARGETS="python3_7 python3_8"
PYTHON_TARGETS="python3_11 python3_10"
```

¶ Step 4: `nano /etc/portage/repos.conf/gentoo.conf` as

- `(chroot) hc4Gentoo / # mkdir /etc/portage/repos.conf` 

- nano /etc/portage/repos.conf/gentoo.conf
```
[gentoo]
location = /var/db/repos/gentoo
sync-type = rsync
sync-uri = rsync://rsync.namerica.gentoo.org/gentoo-portage
auto-sync = yes
priority = 10
```
¶Step 5. fix `/etc/portage/make.profile is not a symlink`
```
(chroot) hc4Gentoo / # ls -l /etc/portage/make.profile
lrwxrwxrwx 1 root root 67 Aug 21 05:38 /etc/portage/make.profile -> ../../var/db/repos/gentoo/profiles/default/linux/arm64/17.0/systemd
(chroot) hc4Gentoo / # ls /var/db/repos/ 
(chroot) hc4Gentoo / # ls /usr/portage/profiles/default/linux/amd64/17.1
clang  desktop  developer  eapi  hardened  no-multilib  parent  profile.bashrc  selinux  systemd
(chroot) hc4Gentoo / # ln -sf /usr/portage/profiles/default/linux/amd64/17.1 /etc/portage/make.profile
```
¶Step 6; emerge-webrsync

From here, emerge-webrsync will connect to the mirrors that you have selected and download the latest EBUILDS available for Gentoo.

```
(chroot) h2Jammy / # nano /etc/portage/repos.conf/gentoo.conf
(chroot) h2Jammy / # emerge-webrsync
!!! Section 'gentoo' in repos.conf has location attribute set to nonexistent directory: '/var/db/repos/gentoo'
!!! Invalid Repository Location (not a dir): '/var/db/repos/gentoo'
 * PGP verification method: gemato
 * Fetching most recent snapshot ...
 * Trying to retrieve 20230901 snapshot from http://distfiles.gentoo.org ...
 * Fetching file gentoo-20230901.tar.xz.md5sum ...
[   INFO] - status: OpenPGPSignatureStatus.GOOD
[   INFO] - valid: True, trusted: True
[   INFO] - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
[   INFO] - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
[   INFO] - timestamp: 2023-08-27 00:56:33 UTC
 * Getting snapshot timestamp ...
 * Syncing local repository ...

Number of files: 146,253 (reg: 119,373, dir: 26,880)
Number of created files: 146,252 (reg: 119,373, dir: 26,879)
Number of deleted files: 0
Number of regular files transferred: 119,373
Total file size: 194.22M bytes
Total transferred file size: 194.22M bytes
Literal data: 194.22M bytes
Matched data: 0 bytes
File list size: 3.22M
File list generation time: 0.002 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 104.41M
Total bytes received: 2.39M

sent 104.41M bytes  received 2.39M bytes  3.75M bytes/sec
total size is 194.22M  speedup is 1.82
 * Cleaning up ...

Performing Global Updates
(Could take a couple of minutes if you have a lot of binary packages.)



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

&para;Step 7. fix `current profile is invalid`   <-- could skip

```
(chroot) x8664Arch / # 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)
  [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)
(chroot) x8664Arch / # eselect profile set 1 , do not set 7, then it will emerge a lot of file
```
&para; Step 8. rerun `emerge-webrsync`

```
(chroot) x8664Arch / # emerge-webrsync
 * PGP verification method: gemato
 * Fetching most recent snapshot ...
 * Latest snapshot date: 20230824
 * 
 * Approximate snapshot timestamp: 1692924300
 *        Current local timestamp: 1692924001
 * 
 * The current local timestamp is possibly identical to the
 * timestamp of the latest snapshot. In order to force sync, use
 * the --revert option or remove the timestamp file located at
 * '/usr/portage/metadata/timestamp.x'.
(chroot) x8664Arch / # rm /usr/portage/metadata/timestamp.x
(chroot) x8664Arch / # emerge-webrsync
...
* Checking digest ...
 * Checking signature ...
[   INFO] Refreshing keys...
[   INFO] Keys refreshed.
[   INFO] File /var/tmp/portage/webrsync-rsr0kF/gentoo-20230824.tar.xz verified successfully against the signature in /var/tmp/portage/webrsync-rsr0kF/gentoo-20230824.tar.xz.gpgsig:
[   INFO] - status: OpenPGPSignatureStatus.GOOD
[   INFO] - valid: True, trusted: True
[   INFO] - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
[   INFO] - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
[   INFO] - timestamp: 2023-08-25 00:56:30 UTC
 * Getting snapshot timestamp ...
 * Syncing local repository ...

Number of files: 145,760 (reg: 118,878, dir: 26,882)
Number of created files: 1 (reg: 1)
Number of deleted files: 0
Number of regular files transferred: 1
Total file size: 193.09M bytes
Total transferred file size: 43 bytes
Literal data: 43 bytes
Matched data: 0 bytes
File list size: 131.05K
File list generation time: 0.003 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 3.88M
Total bytes received: 27.59K

sent 3.88M bytes  received 27.59K bytes  601.61K bytes/sec
total size is 193.09M  speedup is 49.38
 * Cleaning up ...

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

&para;Step 9.  Your First Gentoo System Update

You can now update your system to match the latest EBUILDS by running this emerge command:

```
(chroot) h2nas01 / # emerge --ask --verbose --update --deep --newuse @world

 * 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:
```

&para; 10. install your first package `git` 

```
(chroot) x8664Arch / # emerge --ask dev-vcs/git
(chroot) x8664Arch / # which git
/usr/bin/git

```

&para; Step 11. [Get kermel source and compile](https://www.unixmen.com/a-beginners-guide-to-install-gentoo/)

Gentoo provide several kernel sources. Please read http://www.gentoo.org/doc/en/gentoo-kernel.xml for more information.<<-- 404 error

We are going to use the gentoo-sources.  `emerge gentoo-sources` It would automatically create a symbolic link /usr/src/linux pointing to you kernel source directory in /usr/src.

```
(chroot) x8664Arch / # emerge gentoo-sources

(chroot) x8664Arch / # ls -l /usr/src/
total 4
drwxr-xr-x 27 root root 4096 Aug 25 07:51 linux-6.1.46-gentoo
```

&para; Step 12. `make x86_64_defconfig` `time make -j 4` && `make modules-install` && `make install`\

```
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # make x86_64_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.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/conf
#
# configuration written to .config
#
```

>Kernel configuration: In order to support native (U)EFI, the kernel needs to be configured with EFI support.
KERNEL Enable basic EFI boot support.  It is a deafult choice
```
Processor type and features  --->
    [*] EFI runtime service support (EFI=y)
    [ ]   EFI stub support (EFI_STUB=n)
    [ ]     EFI mixed-mode support (EFI_MIXED=n)
```



```
(chroot) x8664Arch / # cd usr/src/linux-6.1.46-gentoo/
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # 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
#
# using defaults found in arch/x86/configs/x86_64_defconfig
#


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # make -j4
..
GZIP    arch/x86/boot/compressed/vmlinux.bin.gz
  MKPIGGY arch/x86/boot/compressed/piggy.S
  AS      arch/x86/boot/compressed/piggy.o
  LD      arch/x86/boot/compressed/vmlinux
  ZOFFSET arch/x86/boot/zoffset.h
  OBJCOPY arch/x86/boot/vmlinux.bin
  AS      arch/x86/boot/header.o
  LD      arch/x86/boot/setup.elf
  OBJCOPY arch/x86/boot/setup.bin
  BUILD   arch/x86/boot/bzImage
Kernel: arch/x86/boot/bzImage is ready  (#1)

chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # make modules_install
  INSTALL /lib/modules/6.1.46-gentoo/kernel/drivers/thermal/intel/x86_pkg_temp_thermal.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/fs/efivarfs/efivarfs.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/net/ipv4/netfilter/iptable_nat.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/net/netfilter/nf_log_syslog.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/net/netfilter/xt_LOG.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/net/netfilter/xt_MASQUERADE.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/net/netfilter/xt_addrtype.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/net/netfilter/xt_mark.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/net/netfilter/xt_nat.ko
  DEPMOD  /lib/modules/6.1.46-gentoo
```

&para;Step 12, prepare /boot partiton

```
chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # mount /dev/sdb1 /boot
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # ls -l /boot
total 0
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # cp -v arch/x86_64/boot/bzImage /boot/bzImage-6.1.46
'arch/x86_64/boot/bzImage' -> '/boot/bzImage-6.1.46'
```

- sys-kernel/genkernel
```
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # emerge -av sys-kernel/genkernel

 * 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 11.92 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 '/usr/portage/licenses/linux-fw-redistributable'.

- 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))
- sys-kernel/linux-firmware-20230625_p20230707::gentoo (masked by: || ( ) linux-fw-redistributable license(s))
- sys-kernel/linux-firmware-20230515::gentoo (masked by: || ( ) linux-fw-redistributable license(s))

(dependency required by "sys-kernel/genkernel-4.3.5::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.
```

```
nano /etc/portage/package.license
```
and add this line `sys-kernel/linux-firmware linux-fw-redistributable`

Save the file and proceed to the next step.

Update Portage: After creating or updating the package.license file, update Portage to recognize the changes:

`emerge --sync`

Retry Emerge: Now, attempt to emerge the `sys-kernel/genkernel` package again:

`emerge -av sys-kernel/genkernel`

```


- [Gentoo install guide](https://github.com/sergibarroso/gentoo_install)
  
---

&para; Step 13.  EFI partiton

- 13.1. Format the EFI Partition:
```
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # emerge --ask sys-fs/dosfstools
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # mkfs.vfat /dev/sdb1
mkfs.fat 4.2 (2021-01-31)
```

- 13.2 create /boot/efi 
```
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # mkdir /boot/efi
```
- 13.3. Install Bootloader (GRUB in this example):
```
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # emerge --ask sys-boot/grub
```
- 13.4 mount /dev/sdb1 to /boot/efi
```
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # mount /dev/sdb1 /boot/efi
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 223.6G  0 disk 
├─sda1   8:1    0 213.6M  0 part 
├─sda2   8:2    0    60G  0 part 
├─sda3   8:3    0     9G  0 part [SWAP]
└─sda4   8:4    0 154.4G  0 part 
sdb      8:16   0 232.9G  0 disk 
├─sdb1   8:17   0   512M  0 part /boot/efi
├─sdb2   8:18   0    16G  0 part 
└─sdb3   8:19   0    60G  0 part /
sdc      8:32   1     0B  0 disk 
```
- 
```
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo
Installing for x86_64-efi platform.
Installation finished. No error reported.

(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # ls /boot/efi/
EFI
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # ls /boot/efi/EFI
Gentoo
(chroot) x8664Arch /usr/src/linux-6.1.46-gentoo # ls /boot/efi/EFI/Gentoo/
grubx64.efi

```


    Once you've created the EFI partition, format it with the FAT32 file system. You can use the mkfs.fat command for this purpose.

Mount the EFI Partition:

    Create a mount point for the EFI partition, for example: mkdir /mnt/gentoo/boot/efi
    Mount the EFI partition to this directory: mount /dev/sdX1 /mnt/gentoo/boot/efi (replace /dev/sdX1 with the actual partition name)

Install Bootloader (GRUB in this example):

    Chroot into your Gentoo installation: chroot /mnt/gentoo /bin/bash

    Install GRUB package (if not already installed): emerge --ask sys-boot/grub

    Install GRUB to the EFI partition: grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo

    Generate GRUB configuration: grub-mkconfig -o /boot/grub/grub.cfg

Configure Network (if needed):

    Set up networking in the chroot environment if you need to download additional packages or updates within the chrooted environment.

Exit Chroot and Reboot:

    Exit the chroot environment: exit

    Unmount all mounted partitions: umount -R /mnt/gentoo

    Reboot your system: reboot