§2023-08-24

[alexlai@hc4Gentoo ~]$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0 223.6G  0 disk 
├─sda1        8:1    0   487M  0 part 
├─sda2        8:2    0   7.5G  0 part 
├─sda3        8:3    0    60G  0 part 
└─sda4        8:4    0 155.6G  0 part 
mtdblock0    31:0    0    16M  0 disk 
mmcblk0     179:0    0  28.3G  0 disk 
├─mmcblk0p1 179:1    0 457.8M  0 part /boot
└─mmcblk0p2 179:2    0  27.9G  0 part /
zram0       253:0    0   5.4G  0 disk [SWAP]

¶Step 1 : Setting up Partitions

Now we need a valid partition table on the Hard Drive or SSD that we are using to install Gentoo. We are free to choose any of the utilities available on our live system. I choose cfdisk. You can go with gparted or any other utility you like.

For this tutorial I have the following partitioning scheme.

/dev/sda1 → to be used as /boot
/dev/sda2 → to be used as /swap
/dev/sda3 → to be used as /root

Just create the partitions and you are ready to go, no need to format or worry about mount points at this moment.

¶Step 2 : Formatting

# mkfs.vfat /dev/sda1
# mkfs.ext4 /dev/sda3
# mkswap /dev/sda2

¶Step 3 : Mounting

[root@hc4Gentoo src]# pwd
/home/alexlai/build/src
[root@hc4Gentoo src]# ls -l
total 8
drwxr-xr-x 2 alexlai alexlai 4096 Aug 24 13:45 boot
drwxr-xr-x 2 alexlai alexlai 4096 Aug 24 13:45 root
# mount /dev/sda1 boot/
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
# mount /dev/sda2 root/
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
# systemctl daemon-reload
# lsblk -f
NAME        FSTYPE FSVER LABEL      UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                     
├─sda1      vfat   FAT16            F63A-4702                             486.7M     0% /home/alexlai/build/src/boot
├─sda2      swap   1                f4e47b4d-3ecc-4e27-83ec-4b9aafa71882                
├─sda3      ext4   1.0              0eec5082-3336-4c1d-be70-2a9e34a8fd2d   55.7G     0% /home/alexlai/build/src/root
└─sda4                                                                                                             

¶Step 5 : Downloading Stage3, arm64, systemd version and Extracting the Tarball into root

You can download the stage3 tarball from here. Choose your architecture, click on stages and download the latest stage3 tarball.

# cd /home/alexlai/build/gentoo/src
# wget https://distfiles.gentoo.org/releases/arm64/autobuilds/20230820T223139Z/stage3-arm64-systemd-20230820T223139Z.tar.xz
# ls
boot  root  stage3-arm64-systemd-20230820T223139Z.tar.xz
# tar xvpf stage3-arm64-systemd-20230827T234643Z.tar.xz -C root
[root@hc4Gentoo src]# tar xvpf stage3-arm64-openrc-20230827T234643Z.tar.xz -C root   <-- 2023-08-29 try openrc version

¶Step 6 : Chrooting

# arch-chroot root /bin/bash   # don't use chroot, might have some problem
# source /etc/profile
# export PS1="(chroot) $PS1"

¶Step 7. /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) hc4Gentoo / # 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=115 time=3.88 ms
64 bytes from maa05s01-in-f14.1e100.net (172.217.163.46): icmp_seq=2 ttl=115 time=3.81 ms

¶Step 8 : Edit /etc/portage/make.conf

This is one of the most crucial stages of installing Gentoo. Now we must 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=armv8-a+crc -mtune=cortex-a76.cortex-a55"
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=en_US.UTF-8  <-- do not change it here!
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"

# Set the number of CPU cores for parallel compilation (adjust as needed)
MAKEOPTS="-j4"

# emerge --ask sys-kernel/genkernel
ACCEPT_LICENSE="linux-fw-redistributable"

- to solve emerge --ask sys-kernel/genkernel add the abpve line

!!! All ebuilds that could satisfy "sys-kernel/linux-firmware" have been masked. !!! One of the following masked packages is required to complete your request:

(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.


&para; Step 9: `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


&para; Step 10.  `edit /etc/locale.gen   <--skip

```bash
(chroot) hc4Gentoo / # nano /etc/locale.gen
(chroot) hc4Gentoo / # local
local       locale      locale-gen  localectl   localedef   
(chroot) hc4Gentoo / # locale-gen
 * Generating 2 locales (this might take a while) with 4 jobs
 *  (2/2) Generating C.UTF-8 ...                                                                                                                               [ ok ]
 *  (1/2) Generating en_US.UTF-8 ...                                                                                                                           [ ok ]
 * Generation complete
 * Adding locales to archive ...                                                                                                                               [ ok ]
(chroot) hc4Gentoo / # localectl set-locale LANG=en_US.UTF-8
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

¶ Step 11:

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

(chroot) hc4Gentoo / # emerge-webrsync
....
Total bytes sent: 104.40M
Total bytes received: 2.39M

sent 104.40M bytes  received 2.39M bytes  2.77M bytes/sec
total size is 194.26M  speedup is 1.82
 * Cleaning up ...

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




!!! /etc/portage/make.profile is not a symlink and will probably prevent most merges.
!!! It should point into a profile within /usr/portage/profiles/
!!! (You can safely ignore this message when syncing. It's harmless.)


!!! Your current profile is invalid. If you have just changed your profile
!!! configuration, you should revert back to the previous configuration.
!!! Allowed actions are limited to --help, --info, --search, --sync, and
!!! --version.

(chroot) hc4Gentoo / # ls /usr/portage/profiles/default/linux/amd64/17.1 <-- skip this clang desktop developer eapi hardened no-multilib parent profile.bashrc selinux systemd

&para;Step 11-01; emerge-webrsync

- Fix `/etc/portage/make.profile is not a symlink`   <-- !!! skip this

(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

- And, eselect profile

(chroot) hc4Gentoo / # eselect profile list <-- has to wait after emerge-webrsync Available profile symlink targets: [1] default/linux/amd64/17.1 (stable) * <-- Mine is arm64 [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) hc4Gentoo / # eselect profile set 1


again,

(chroot) hc4Gentoo / # rm /usr/portage/metadata/timestamp.x (chroot) hc4Gentoo / # emerge-webrsync ... !!! /etc/portage/make.profile is not a symlink and will probably prevent most merges. !!! It should point into a profile within /usr/portage/profiles/ !!! (You can safely ignore this message when syncing. It's harmless.)

!!! Your current profile is invalid. If you have just changed your profile !!! configuration, you should revert back to the previous configuration. !!! Allowed actions are limited to --help, --info, --search, --sync, and !!! --version.


- retry
```bash
(chroot) hc4Gentoo / # emerge-webrsync
 * PGP verification method: gemato
 * Fetching most recent snapshot ...
 * Latest snapshot date: 20230823
 * 
 * Approximate snapshot timestamp: 1692837900
 *        Current local timestamp: 1692837601
 * 
 * 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) hc4Gentoo / # rm /usr/portage/metadata/timestamp.x
(chroot) hc4Gentoo / # emerge-webrsync
...
sent 3.87M bytes  received 27.68K bytes  599.96K bytes/sec
total size is 192.95M  speedup is 49.48
 * Cleaning up ...

 * IMPORTANT: 10 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
 ...
sent 3.87M bytes  received 27.68K bytes  599.96K bytes/sec
total size is 192.95M  speedup is 49.48
 * Cleaning up ...

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

¶Step 12. Your First Gentoo System Update

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

emerge --ask --verbose --update --deep --newuse @world

Total: 47 packages (37 new, 10 reinstalls), Size of downloads: 385675 KiB

 * Error: circular dependencies:

(sys-libs/gpm-1.20.7-r5:0/0::gentoo, ebuild scheduled for merge) depends on
 (sys-libs/ncurses-6.4_p20230401:0/6::gentoo, ebuild scheduled for merge) (buildtime_slot_op)
  (sys-libs/gpm-1.20.7-r5:0/0::gentoo, ebuild scheduled for merge) (buildtime)

It might be possible to break this cycle
by applying the following change:
- sys-libs/ncurses-6.4_p20230401 (Change USE: -gpm)

Note that this change can be reverted, once the package has been installed.

Use emerge @preserved-rebuild to rebuild packages using these libraries

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

 * After world updates, it is important to remove obsolete packages with
 * emerge --depclean. Refer to `man emerge` for more information.s
(chroot) hc4Gentoo / # emerge --depclean

 * Always study the list of packages to be cleaned for any obvious
 * mistakes. Packages that are part of the world set will always
 * be kept.  They can be manually added to this set with
 * `emerge --noreplace <atom>`.  Packages that are listed in
 * package.provided (see portage(5)) will be removed by
 * depclean, even if they are part of the world set.
 * 
 * As a safety measure, depclean will not remove any packages
 * unless *all* required dependencies have been resolved.  As a
 * consequence of this, it often becomes necessary to run 
 * `emerge --update --newuse --deep @world` prior to depclean.
!!! You have no world file.

Calculating dependencies... done!
 * Dependencies could not be completely resolved due to
 * the following required packages not being installed:
 * 
 *   dev-libs/libunistring:0/2= pulled in by:
 *     net-dns/libidn2-2.3.4
 * 
 *   dev-libs/libunistring:0/2= pulled in by:
 *     net-libs/gnutls-3.7.8
 * 
 * Have you forgotten to do a complete update prior to depclean? The
 * most comprehensive command for this purpose is as follows:
 * 
 *   emerge --update --newuse --deep --with-bdeps=y @world
 * 
 * Note that the --with-bdeps=y option is not required in many
 * situations. Refer to the emerge manual page (run `man emerge`)
 * for more information about --with-bdeps.
 * 
 * Also, note that it may be necessary to manually uninstall
 * packages that no longer exist in the repository, since it may not
 * be possible to satisfy their dependencies.

(chroot) hc4Gentoo / # emerge --update --newuse --deep --with-bdeps=y @world

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

Calculating dependencies \


chatGPT,

The error message you've encountered indicates that there is a circular dependency issue involving the sys-libs/gpm and sys-libs/ncurses packages during the package update process. Circular dependencies occur when two or more packages depend on each other, creating a loop that prevents them from being installed or updated successfully.

To fix this issue, you can follow the suggested solution in the error message, which is to temporarily change the USE flag for the sys-libs/ncurses package by removing the "gpm" flag. Here's how you can do it:

Open your terminal.

Run the following command to edit the USE flags for the sys-libs/ncurses package in the Portage configuration:

bash

sudo nano /etc/portage/package.use/ncurses

This will open the Nano text editor for the newly created file.

Add USE Flag: In the opened file, add the following line to remove the "gpm" USE flag for the sys-libs/ncurses package:

plaintext

sys-libs/ncurses -gpm

This line tells Portage not to use the "gpm" feature for the sys-libs/ncurses package.

Save and Close: After adding the line, save the file and close the text editor. In Nano, you can do this by pressing Ctrl + O to write the changes and Ctrl + X to exit.

Run the Update Command: With the new file in place, you can now run the package update command again:

bash

emerge --ask --update --deep --newuse @world

bash

sys-libs/ncurses gpm

Remove the "gpm" USE flag from the line. After making the change, the line should look like this:

bash

sys-libs/ncurses

Save the changes and close the text editor.

Run the following command to update the package dependencies and resolve the circular dependency issue:

css

emerge --ask --update --deep --newuse @world

The package manager should now attempt to install the packages without the circular dependency. After the installation is complete, the circular dependency should be resolved.

If the installation is successful, you can revert the change you made to the USE flags for the sys-libs/ncurses package. Open the /etc/portage/package.use file again and add back the "gpm" USE flag to the line for sys-libs/ncurses.

Remember that while this solution should resolve the circular dependency issue, it's always a good idea to check for any updates or changes in package dependencies before performing updates to ensure a smooth process.

----

---
&para; 12. install git 
- so that I could get [compile odroid-n2 kernel](https://wiki.odroid.com/odroid-n2/software/building_kernel

emerge --sync emerge --ask dev-vcs/git git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y --> into /usr/src   <-- you have to use gcc-11.30 Jammy


&para;Step 13, [compile kernel](https://www.unixmen.com/a-beginners-guide-to-install-gentoo/)

Kernel
Install the kernel tools and firmware.

emerge --ask sys-kernel/gentoo-sources ---> get kernel source emerge --ask sys-kernel/genkernel ---> to make initramfs.img, !!! All ebuilds that could satisfy "sys-kernel/linux-firmware" have been masked. emerge --ask sys-fs/cryptsetup emerge --ask sys-kernel/linux- emerge --ask sys-kernel/dracut emerge -av dev-embedded/u-boot-tools                                    ---> mkimg

emerge -av dev-embedded/u-boot-tools

...

Merging dev-embedded/u-boot-tools-2023.01 to / --- /usr/ --- /usr/share/ --- /usr/share/man/ --- /usr/share/man/man1/ /usr/share/man/man1/mkimage.1.bz2 --- /usr/bin/ /usr/bin/bmp_logo /usr/bin/gen_eth_addr /usr/bin/fdtgrep /usr/bin/mkimage /usr/bin/fw_printenv /usr/bin/fw_setenv -> fw_printenv /usr/bin/img2srec /usr/bin/mkenvimage /usr/bin/dumpimage --- /etc/ /etc/fw_env.config


Total: 2 packages (2 new), Size of downloads: 26525 KiB

Would you like to merge these packages? [Yes/No] yes

>>> Verifying ebuild manifests

>>> Emerging (1 of 2) dev-lang/swig-4.1.1-r1::gentoo
 * Fetching files in the background.
 * To view fetch progress, run in another terminal:
 * tail -f /var/log/emerge-fetch.log

Replace this part with Native Compile - ODROID-HC4/Ubuntu

13.1. emerge --ask sys-kernel/gentoo-sources to get kernel source code

(chroot) n2Mnjaro /usr/src # emerge --ask sys-kernel/gentoo-sources
(chroot) n2Mnjaro /usr/src # ls
linux  linux-6.1.46-gentoo
(chroot) n2Mnjaro /usr/src # git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y
chroot) hc4Gentoo /usr/src # ls
linux  linux-6.1.46-gentoo
(chroot) n2Mnjaro /usr/src # mv linux linux-odroidg12-4.9.y
(chroot) hc4Gentoo /usr/src # ls linux-odroidg12-4.9.y/arch/arm64/configs/
defconfig  meson64_defconfig  meson64_smarthome_defconfig  odroidc4_defconfig  odroidg12_defconfig  odroidn2_drm_defconfig  ranchu64_defconfig
(c

13.2 make menuconfig <-- skip

(chroot) n2Mnjaro /usr/src # cp -v linux-odroidg12-4.9.y/arch/arm64/configs/odroidn2_drm_defconfig linux-6.1.46-gentoo/arch/arm64/configs/
# or
chroot) hc4Gentoo /usr/src # cp -v linux-odroidg12-4.9.y/arch/arm64/configs/odroidc4_defconfig linux-6.1.46-gentoo/arch/arm64/configs/
'linux-odroidg12-4.9.y/arch/arm64/configs/odroidc4_defconfig' -> 'linux-6.1.46-gentoo/arch/arm64/configs/odroidc4_defconfig'
'linux-odroidg12-4.9.y/arch/arm64/configs/odroidn2_drm_defconfig' -> 'linux-6.1.46-gentoo/arch/arm64/configs/odroidn2_drm_defconfig'
(chroot) n2Mnjaro /usr/src # cd linux-6.1.46-gentoo/

(chroot) n2Mnjaro /usr/src/linux-6.1.46-gentoo # make odroidn2_drm_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
arch/arm64/configs/odroidn2_drm_defconfig:722:warning: symbol value 'm' invalid for NF_CT_PROTO_DCCP
arch/arm64/configs/odroidn2_drm_defconfig:723:warning: symbol value 'm' invalid for NF_CT_PROTO_GRE
arch/arm64/configs/odroidn2_drm_defconfig:724:warning: symbol value 'm' invalid for NF_CT_PROTO_SCTP
arch/arm64/configs/odroidn2_drm_defconfig:725:warning: symbol value 'm' invalid for NF_CT_PROTO_UDPLITE
arch/arm64/configs/odroidn2_drm_defconfig:751:warning: symbol value 'm' invalid for NF_NAT_REDIRECT
arch/arm64/configs/odroidn2_drm_defconfig:754:warning: symbol value 'm' invalid for NF_TABLES_INET
arch/arm64/configs/odroidn2_drm_defconfig:755:warning: symbol value 'm' invalid for NF_TABLES_NETDEV
arch/arm64/configs/odroidn2_drm_defconfig:932:warning: symbol value 'm' invalid for NF_TABLES_IPV4
arch/arm64/configs/odroidn2_drm_defconfig:936:warning: symbol value 'm' invalid for NF_TABLES_ARP
arch/arm64/configs/odroidn2_drm_defconfig:977:warning: symbol value 'm' invalid for NF_TABLES_IPV6
arch/arm64/configs/odroidn2_drm_defconfig:3392:warning: symbol value 'm' invalid for LIRC
#
# configuration written to .config
#
Or,

(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # make odroidc4_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
arch/arm64/configs/odroidc4_defconfig:770:warning: symbol value 'm' invalid for NF_CT_PROTO_DCCP
arch/arm64/configs/odroidc4_defconfig:771:warning: symbol value 'm' invalid for NF_CT_PROTO_GRE
arch/arm64/configs/odroidc4_defconfig:772:warning: symbol value 'm' invalid for NF_CT_PROTO_SCTP
arch/arm64/configs/odroidc4_defconfig:773:warning: symbol value 'm' invalid for NF_CT_PROTO_UDPLITE
arch/arm64/configs/odroidc4_defconfig:799:warning: symbol value 'm' invalid for NF_NAT_REDIRECT
arch/arm64/configs/odroidc4_defconfig:802:warning: symbol value 'm' invalid for NF_TABLES_INET
arch/arm64/configs/odroidc4_defconfig:803:warning: symbol value 'm' invalid for NF_TABLES_NETDEV
arch/arm64/configs/odroidc4_defconfig:980:warning: symbol value 'm' invalid for NF_TABLES_IPV4
arch/arm64/configs/odroidc4_defconfig:984:warning: symbol value 'm' invalid for NF_TABLES_ARP
arch/arm64/configs/odroidc4_defconfig:1025:warning: symbol value 'm' invalid for NF_TABLES_IPV6
arch/arm64/configs/odroidc4_defconfig:3863:warning: symbol value 'm' invalid for LIRC
#
# configuration written to .config
#

(

(chroot) hc4Gentoo /usr/src/linux-6.1.46-gentoo # make modules_install
...
INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/drivers/snd-serial-u16550.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/6fire/snd-usb-6fire.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/bcd2000/snd-bcd2000.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/caiaq/snd-usb-caiaq.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/hiface/snd-usb-hiface.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/line6/snd-usb-line6.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/line6/snd-usb-pod.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/line6/snd-usb-podhd.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/line6/snd-usb-toneport.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/line6/snd-usb-variax.ko
  INSTALL /lib/modules/6.1.46-gentoo/kernel/sound/usb/misc/snd-ua101.ko
  DEPMOD  /lib/modules/6.1.46-gentoo

$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y $ cd linux $ make odroidg12_defconfig $ time make -j4 ... fs/logfs/readwrite.c: In function ‘fill_shadow_tree’: fs/logfs/readwrite.c:1282:21: error: the comparison will always evaluate as ‘true’ for the address of ‘alias_map’ will never be NULL [-Werror=address] 1282 | if (block->alias_map) | ^~~~~ In file included from fs/logfs/readwrite.c:19: fs/logfs/logfs.h:304:23: note: ‘alias_map’ declared here 304 | unsigned long alias_map[LOGFS_BLOCK_FACTOR / BITS_PER_LONG]; | ^~~~~~~~~ CC [M] fs/ncpfs/ncplib_kernel.o CC [M] fs/ncpfs/sock.o CC [M] fs/lockd/svcsubs.o cc1: all warnings being treated as errors make[2]: *** [scripts/Makefile.build:337: fs/logfs/readwrite.o] Error 1 make[1]: *** [scripts/Makefile.build:651: fs/logfs] Error 2 make[1]: *** Waiting for unfinished jobs.... CC [M] fs/ncpfs/ncpsign_kernel.o CC [M] fs/lockd/mon.o CC [M] fs/lockd/xdr.o CC [M] fs/ncpfs/getopt.o CC [M] fs/ncpfs/symlink.o CC [M] fs/lockd/clnt4xdr.o LD [M] fs/ncpfs/ncpfs.o CC [M] fs/lockd/xdr4.o CC [M] fs/lockd/svc4proc.o CC [M] fs/lockd/procfs.o LD [M] fs/lockd/lockd.o make: *** [Makefile:1102: fs] Error 2

How to solve this error??


I see that your kernel build process has the -Werror flag enabled, which treats all warnings as errors. To resolve the specific error you mentioned earlier without disabling -Werror globally, you can use the following approach:

Edit the Affected Source Code: Open the fs/logfs/readwrite.c file and locate the problematic comparison that triggers the warning. In your error message, it's this line:

c
Copy code
if (block->alias_map)
You can modify this code to address the warning by checking if block->alias_map is non-null before accessing it:

c
Copy code
if (block->alias_map != NULL)
This change explicitly checks if block->alias_map is not NULL before using it, which should satisfy the compiler.

Rebuild: After making this code change, save the file and attempt to rebuild the kernel using the same build command:

Modify the Configuration: If the issue persists, you can try modifying the kernel configuration. It's possible that the 'logfs' filesystem is causing the problem. You can try disabling it in the configuration:

bash
Copy code
make menuconfig  --> File System --> Miscellaneous File System -->logfs 


It seems you encountered another error related to the -Werror flag in your kernel build, this time in the kernel/extable.c file. To address this, you can apply a similar fix to the one we used for the previous error:

Edit the Affected Source Code: Open the kernel/extable.c file and locate the problematic comparison that triggers the warning. In your error message, it's this line:

c
Copy code
if (main_extable_sort_needed && __stop___ex_table > __start___ex_table) {
You can modify this code to address the warning by using the suggested alternative comparison with array indexing:

c
Copy code
if (main_extable_sort_needed && &__stop___ex_table[0] > &__start___ex_table[0]) {
This change uses array indexing to compare the addresses of __stop___ex_table and __start___ex_table, which should satisfy the compiler.

Rebuild: After making this code change, save the file and attempt to rebuild the kernel using the same build command:

css
Copy code
time make -j4
With the code modification, the build should proceed without treating this particular warning as an error.

Repeat this process for any other similar errors you encounter. Be cautious when making these changes, as they involve modifying the kernel source code. It's important to thoroughly test the resulting kernel to ensure it works as expected, especially if you make code changes to address compiler warnings.