20220331

Cache Coherency

Jserv: TODO https://www.youtube.com/playlist?list=PLDoI-XvXO0aqgj_8Og51XoE7iyAu5yEWZ

Hint from Jserv

mem hier
LLC public shared, L1 private individual

?snooping

?MOESI protocsl

up to 10k cpu cycle

Cortex A9 feature (extendsion) L2(LLC) lockdown

新版

A72 拿掉,但新版的又加回來,但是是新的更細緻的 Cache control

CS61C

  • 23.1

Amdahl’s law : paralizing Moore’s Law
https://en.wikipedia.org/wiki/Amdahl’s_law#:~:text=In computer architecture%2C Amdahl’s law,system whose resources are improved.

  • 23.2

mat muti

cache scheme

phonebook design

cache block optimization

  • 23.3

KML
Q: 如果沒有 L2 lockdown feature 怎麼辦?
A: KML

KML patch

Qemu

  • build the latest version

stackoverflow: Emulating raspberry pi 4 with qemu

https://stackoverflow.com/questions/67045438/emulating-raspberry-pi-4-with-qemu

Q: Which machine? virt?

不需要模擬周邊,用 virt 即可

Q: Kernel or rpi4 image?

Kernel 讓干擾因素變少,busybox/ buildroot

Pick the virt-6.1 up

There is no exact rpi4 emulator right now. Some WIP plz see the link
https://github.com/docdude/qemu_rpi4
https://gitlab.com/philmd/qemu/-/tree/raspi4_wip

https://github.com/0xMirasio/qemu-patch-raspberry4

we might choose generic one if rpi4 isn’t ready.

Q: What’s the impact on testing rpi4 kernel modifier on generic solution? Is there any trouble on porting to rpi4 machine or even Debian image?

follow up https://wiki.qemu.org/Documentation/Platforms/ARM

Buidroot

git clone git://git.buildroot.net/buildroot

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

傻了 直接用 defconfig

qemu_aarch64_virt_defconfig

把 CPU 改 a72

Rpi 4

datasheet
https://datasheets.raspberrypi.com/rpi4/raspberry-pi-4-datasheet.pdf

CPU
Quad core 64-bit ARM-Cortex A72 running at 1.5GHz

qemu-system-aarch64 \
-M virt \
-cpu cortex-a72 \
-kernel Image \
-append "rootwait root=/dev/vda console=ttyAMA0" \
-nographic \
-smp 1 \
-netdev user,id=eth0 \
-device virtio-net-device,netdev=eth0 \
-device virtio-blk-device,drive=hd0 \
-drive file=rootfs.ext4,if=none,format=raw,id=hd0

Customize buildroot

Git diff
5.15 vs 對應的 patch 的
要確切

KML

/home/yan/dev/linux-rpi/arch/arm64/include/asm/processor.h

static inline void start_thread_common(struct pt_regs *regs, unsigned long pc) { memset(regs, 0, sizeof(*regs)); forget_syscall(regs); regs->pc = pc; if (system_uses_irq_prio_masking()) regs->pmr_save = GIC_PRIO_IRQON; } static inline void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) { start_thread_common(regs, pc); regs->pstate = PSR_MODE_EL0t; spectre_v4_enable_task_mitigation(current); regs->sp = sp; } #ifdef CONFIG_COMPAT static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) { start_thread_common(regs, pc); regs->pstate = PSR_AA32_MODE_USR; if (pc & 1) regs->pstate |= PSR_AA32_T_BIT; #ifdef __AARCH64EB__ regs->pstate |= PSR_AA32_E_BIT; #endif spectre_v4_enable_task_mitigation(current); regs->compat_sp = sp; } #endif

Q: 怎麼改要研究一下

  • arch/arm/include/asm/ptrace.h | 11 +++++++

Q: ptrace?

man page

  • arch/arm/include/asm/thread_info.h | 16 ++++++++++

/home/yan/dev/linux-rpi/arch/arm64/include/asm/thread_info.h
沒特別改變

  • arch/arm/kernel/entry-armv.S | 16 ++++++++++

/home/yan/dev/linux-rpi/arch/arm64/kernel/entry.S

Q: 比較不一樣,function 都不同 (搜 vector)

-[ ] diff 把差異列出來
/home/yan/dev/linux-rpi/arch/arm64/kernel/entry-common.c

  • arch/arm/lib/uaccess_with_memcpy.c | 12 ++++++-

檔案找不到 arch/arm/lib/uaccess_with_memcpy.c https://github.com/sonicyang/KML/blob/master/0001-Integrate-KML.patch#L344
4.14 kenernl

  • arch/arm/vfp/vfphw.S | 13 ++++++++
  • drivers/pnp/pnpbios/bioscalls.c | 4 +++
  • fs/binfmt_elf.c | 64 ++++++++++++++++++++++++++++++++++++
  • fs/compat_binfmt_elf.c | 3 ++
  • init/do_mounts.c | 8 +++++
  • kernel/Kconfig.kml | 34 ++++++++++++++++++++
  • kernel/tracepoint.c | 5 +++
  • lib/iov_iter.c | 4 +++
  • mm/memory.c | 4 +++
#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP) void __might_fault(const char *file, int line) { /* * Some code (nfs/sunrpc) uses socket ops on kernel memory while * holding the mmap_lock, this is safe because kernel memory doesn't * get paged out, therefore we'll never actually fault, and the * below annotations will generate false positives. */ if (uaccess_kernel()) return; if (pagefault_disabled()) return; __might_sleep(file, line, 0); #if defined(CONFIG_DEBUG_ATOMIC_SLEEP) if (current->mm) might_lock_read(&current->mm->mmap_lock); #endif } EXPORT_SYMBOL(__might_fault); #endif

Q: GDB 去跑,看 uaccess_kernel() 跑去哪邊就改哪邊

  • security/tomoyo/network.c | 4 +++

/home/yan/dev/linux-rpi/arch/arm64/include/asm/thread_info.h

vDSO

/home/yan/dev/linux-rpi/arch/arm64/kernel/vdso
├── gen_vdso_offsets.sh
├── Makefile
├── note.S
├── sigreturn.S
├── vdso.lds.S
└── vgettimeofday.c

arch/arm64/kernel/vdso vs arch/arm64/kernel/vdso32

  • kernel/time/time.c | 1 -
  • kernel/time/timekeeping.c | 1 -

wastedcore

$ make menuconfig
$ make -j8

* wastedcores
*
systemtap (BR2_PACKAGE_SYSTEMTAP) [Y/n/?] y
wastedcores (BR2_PACKAGE_WASTEDCORES) [Y/n/?] y
  Target CPU count (BR2_PACKAGE_WASTEDCORES_NUM_CPU) [4] (NEW) 
  Max Entries (BR2_PACKAGE_WASTEDCORES_MAX_SAMPLE) [100000000] (NEW) 
  Enable Extra Profiling (BR2_PACKAGE_WASTEDCORES_EXTRA) [N/y/?] (NEW) y
mctest (BR2_PACKAGE_MCTEST) [N/y/?] (NEW) y
#
# configuration written to /home/yan/dev/rt-experiments/buildroot/.config
#
#x86 version

#make -j8

/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin/ccache /usr/bin/gcc  -I.   -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include  -O2 -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include -c -o freadahead.o freadahead.c
/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin/ccache /usr/bin/gcc  -I.   -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include  -O2 -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include -c -o fseek.o fseek.c
/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin/ccache /usr/bin/gcc  -I.   -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include  -O2 -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include -c -o fseeko.o fseeko.c
/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin/ccache /usr/bin/gcc  -I.   -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include  -O2 -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include -c -o isnanl.o isnanl.c
freadahead.c: In function 'freadahead':
freadahead.c:91:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
   91 |  #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
      |   ^~~~~
make[5]: *** [Makefile:1842: freadahead.o] Error 1
make[5]: *** Waiting for unfinished jobs....
fseeko.c: In function 'rpl_fseeko':
fseeko.c:109:4: error: #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
  109 |   #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
      |    ^~~~~
make[5]: *** [Makefile:1842: fseeko.o] Error 1
make[4]: *** [Makefile:1602: all] Error 2
make[3]: *** [Makefile:1506: all-recursive] Error 1
make[2]: *** [Makefile:1461: all] Error 2
make[1]: *** [package/pkg-generic.mk:219: /home/yan/dev/rt-experiments/buildroot/output/build/host-m4-1.4.17/.stamp_built] Error 2
make: *** [Makefile:76: _all] Error 2
lib/fseterr.c: In function 'fseterr':
lib/fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
   77 |  #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
      |   ^~~~~
make[4]: *** [Makefile:3466: lib/fseterr.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:4522: all-recursive] Error 1
make[2]: *** [Makefile:2625: all] Error 2
make[1]: *** [package/pkg-generic.mk:219: /home/yan/dev/rt-experiments/buildroot/output/build/host-bison-3.0.4/.stamp_built] Error 2
make: *** [Makefile:76: _all] Error 2
yan@am-002b67307289:~/dev/rt-experiments/buildroot/output/build/host-bison-3.0.4$ wget https://github.com/easybuilders/easybuild-easyconfigs/files/3307749/Bison-3.0.4_glibc_2.28.patch.zip
--2022-04-12 04:45:55--  https://github.com/easybuilders/easybuild-easyconfigs/files/3307749/Bison-3.0.4_glibc_2.28.patch.zip
Resolving github.com (github.com)... 52.69.186.44
Connecting to github.com (github.com)|52.69.186.44|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-repository-file-5c1aeb/6228403/3307749?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220411%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220411T204556Z&X-Amz-Expires=300&X-Amz-Signature=d90556344d893d85f0be39097c896006029ac8d44d07299587f375d4eae6a3da&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=6228403&response-content-disposition=attachment%3Bfilename%3DBison-3.0.4_glibc_2.28.patch.zip&response-content-type=application%2Fzip [following]
--2022-04-12 04:45:56--  https://objects.githubusercontent.com/github-production-repository-file-5c1aeb/6228403/3307749?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220411%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220411T204556Z&X-Amz-Expires=300&X-Amz-Signature=d90556344d893d85f0be39097c896006029ac8d44d07299587f375d4eae6a3da&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=6228403&response-content-disposition=attachment%3Bfilename%3DBison-3.0.4_glibc_2.28.patch.zip&response-content-type=application%2Fzip
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 902 [application/zip]
Saving to: ‘Bison-3.0.4_glibc_2.28.patch.zip’

Bison-3.0.4_glibc_2.28.patch 100%[============================================>]     902  --.-KB/s    in 0s      

2022-04-12 04:45:58 (31.9 MB/s) - ‘Bison-3.0.4_glibc_2.28.patch.zip’ saved [902/902]

yan@am-002b67307289:~/dev/rt-experiments/buildroot/output/build/host-bison-3.0.4$ unzip 
Bison-3.0.4_glibc_2.28.patch.zip  etc/                              runtime-po/
build-aux/                        examples/                         src/
data/                             lib/                              tests/
djgpp/                            m4/                               
doc/                              po/                               
yan@am-002b67307289:~/dev/rt-experiments/buildroot/output/build/host-bison-3.0.4$ unzip Bison-3.0.4_glibc_2.28.patch.zip 
Archive:  Bison-3.0.4_glibc_2.28.patch.zip
  inflating: Bison-3.0.4_glibc_2.28.patch  
yan@am-002b67307289:~/dev/rt-experiments/buildroot/output/build/host-bison-3.0.4$ ls
ABOUT-NLS                         ChangeLog       COPYING      INSTALL      Makefile.am   README-release
aclocal.m4                        ChangeLog-1998  data         javacomp.sh  Makefile.in   runtime-po
AUTHORS                           ChangeLog-2012  djgpp        javaexec.sh  NEWS          src
Bison-3.0.4_glibc_2.28.patch      config.log      doc          lib          PACKAGING     tests
Bison-3.0.4_glibc_2.28.patch.zip  config.status   etc          m4           po            THANKS
build-aux                         configure       examples     maint.mk     README        TODO
cfg.mk                            configure.ac    GNUmakefile  Makefile     README-alpha
yan@am-002b67307289:~/dev/rt-experiments/buildroot/output/build/host-bison-3.0.4$ git apply --check Bison-3.0.4_glibc_2.28.patch -v
Checking patch output/build/host-bison-3.0.4/lib/fseterr.c...
Checking patch output/build/host-bison-3.0.4/lib/stdio-impl.h...
yan@am-002b67307289:~/dev/rt-experiments/buildroot/output/build/host-bison-3.0.4$ git apply Bison-3.0.4_glibc_2.28.patch -v
Checking patch output/build/host-bison-3.0.4/lib/fseterr.c...
Checking patch output/build/host-bison-3.0.4/lib/stdio-impl.h...
Applied patch output/build/host-bison-3.0.4/lib/fseterr.c cleanly.
Applied patch output/build/host-bison-3.0.4/lib/stdio-impl.h cleanly.

m4 的漏洞,照這個改 https://github.com/easybuilders/easybuild-easyconfigs/issues/8501
裏頭有個 patch

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make
>>> linux-headers custom Downloading
cp: cannot stat '/home/yan/dev/rt-experiments/buildroot/../linux.tar': No such file or directory
--2022-04-12 04:15:48--  http://sources.buildroot.net/linux.tar
Resolving sources.buildroot.net (sources.buildroot.net)... 2606:4700:20::ac43:4838, 2606:4700:20::681a:25, 2606:4700:20::681a:125, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|2606:4700:20::ac43:4838|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-04-12 04:15:48 ERROR 404: Not Found.

make[1]: *** [package/pkg-generic.mk:130: /home/yan/dev/rt-experiments/buildroot/output/build/linux-headers-custom/.stamp_downloaded] Error 1
make: *** [Makefile:76: _all] Error 2

# 要在上一個目錄
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.12.tar.xz

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make
>>> host-e2fsprogs 1.43.3 Building
PATH="/home/yan/dev/rt-experiments/buildroot/output/host/bin:/home/yan/dev/rt-experiments/buildroot/output/host/sbin:/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin:/home/yan/dev/rt-experiments/buildroot/output/host/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin" PKG_CONFIG="/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/yan/dev/rt-experiments/buildroot/output/host/usr/lib/pkgconfig:/home/yan/dev/rt-experiments/buildroot/output/host/usr/share/pkgconfig"  /usr/bin/make -j9  -C /home/yan/dev/rt-experiments/buildroot/output/build/host-e2fsprogs-1.43.3/
make[3]: 'util/subst.conf' is up to date.
make[3]: 'lib/config.h' is up to date.
make[3]: 'lib/dirpaths.h' is up to date.
make[3]: 'lib/ext2fs/ext2_types.h' is up to date.
make[3]: 'lib/blkid/blkid_types.h' is up to date.
make[3]: 'lib/uuid/uuid_types.h' is up to date.
make[3]: 'compile_et' is up to date.
make[3]: 'ext2_err.h' is up to date.
make[3]: 'prof_err.h' is up to date.
/usr/bin/make libs
make[4]: 'util/subst.conf' is up to date.
make[4]: 'lib/config.h' is up to date.
make[4]: 'lib/dirpaths.h' is up to date.
make[4]: 'lib/ext2fs/ext2_types.h' is up to date.
make[4]: 'lib/blkid/blkid_types.h' is up to date.
make[4]: 'lib/uuid/uuid_types.h' is up to date.
make[4]: 'compile_et' is up to date.
make[4]: 'ext2_err.h' is up to date.
make[4]: 'prof_err.h' is up to date.
making all in lib/et
make[4]: Nothing to be done for 'all'.
making all in lib/ss
make[4]: Nothing to be done for 'all'.
making all in lib/e2p
make[4]: Nothing to be done for 'all'.
making all in lib/uuid
make[4]: Nothing to be done for 'all'.
making all in lib/blkid
make[4]: Nothing to be done for 'all'.
making all in lib/support
make[4]: Nothing to be done for 'all'.
making all in lib/ext2fs
make[4]: Nothing to be done for 'all'.
making all in intl
make[4]: Nothing to be done for 'all'.
/usr/bin/make progs
make[4]: 'util/subst.conf' is up to date.
make[4]: 'lib/config.h' is up to date.
make[4]: 'lib/dirpaths.h' is up to date.
make[4]: 'lib/ext2fs/ext2_types.h' is up to date.
make[4]: 'lib/blkid/blkid_types.h' is up to date.
make[4]: 'lib/uuid/uuid_types.h' is up to date.
make[4]: 'compile_et' is up to date.
make[4]: 'ext2_err.h' is up to date.
make[4]: 'prof_err.h' is up to date.
making all in lib/et
make[4]: Nothing to be done for 'all'.
making all in lib/ss
make[4]: Nothing to be done for 'all'.
making all in lib/e2p
make[4]: Nothing to be done for 'all'.
making all in lib/uuid
make[4]: Nothing to be done for 'all'.
making all in lib/blkid
make[4]: Nothing to be done for 'all'.
making all in lib/support
make[4]: Nothing to be done for 'all'.
making all in lib/ext2fs
make[4]: Nothing to be done for 'all'.
making all in intl
make[4]: Nothing to be done for 'all'.
making all in e2fsck
        LD e2fsck
/usr/bin/ld: ../lib/libext2fs.a(ismounted.o): in function `check_mntent_file':
ismounted.c:(.text+0x21d): undefined reference to `major'
/usr/bin/ld: ../lib/libblkid.a(devname.o): in function `probe_all':
devname.c:(.text+0x7d8): undefined reference to `makedev'
/usr/bin/ld: devname.c:(.text+0xabd): undefined reference to `makedev'
/usr/bin/ld: devname.c:(.text+0xb8b): undefined reference to `makedev'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:426: e2fsck] Error 1
make[3]: *** [Makefile:405: all-progs-recursive] Error 1
make[2]: *** [Makefile:341: all] Error 2
make[1]: *** [package/pkg-generic.mk:219: /home/yan/dev/rt-experiments/buildroot/output/build/host-e2fsprogs-1.43.3/.stamp_built] Error 2
make: *** [Makefile:76: _all] Error 2
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make menuconfig


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

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make menuconfig


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

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ ls
arch                         board             configs     fs               output   toolchain
ARM-A9-buildroot-config      boot              COPYING     kconfig          package  vmalloc-384M.patch
ARM-A9-kernel-config         CHANGES           DEVELOPERS  linux            README   x86_64-buildroot-config
ARM-A9-KML-buildroot-config  Config.in         dl          Makefile         support  x86_64-kernel-config
ARM-A9-KML-kernel-config     Config.in.legacy  docs        Makefile.legacy  system
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/
Display all 1716 possibilities? (y or n)
4th/                            libart/                         perl-netaddr-ip/
a10disp/                        libasplib/                      perl-net-dns/
acl/                            libass/                         perl-net-http/
acpica/                         libassuan/                      perl-net-ssleay/
acpid/                          libatasmart/                    perl-path-tiny/
acpitool/                       libatomic_ops/                  perl-timedate/
acsccid/                        libbdplus/                      perl-time-hires/
adwaita-icon-theme/             libbluray/                      perl-try-tiny/
aer-inject/                     libbroadvoice/                  perl-uri/
aespipe/                        libbsd/                         perl-www-robotrules/
agentpp/                        libcap/                         perl-xml-libxml/
aiccu/                          libcap-ng/                      perl-xml-namespacesupport/
aircrack-ng/                    libcdaudio/                     perl-xml-sax/
alljoyn/                        libcddb/                        perl-xml-sax-base/
alljoyn-base/                   libcdio/                        phidgetwebservice/
alljoyn-tcl/                    libcec/                         php/
alljoyn-tcl-base/               libcgi/                         php-amqp/
alsa-lib/                       libcgicc/                       php-geoip/
alsamixergui/                   libcgroup/                      php-gnupg/
alsa-utils/                     libcli/                         php-imagick/
am335x-pru-package/             libcoap/                        php-memcached/
am33x-cm3/                      libcodec2/                      php-ssh2/
amd-catalyst/                   libcofi/                        php-yaml/
android-tools/                  libconfig/                      php-zmq/
angularjs/                      libconfuse/                     picocom/
apache/                         libcroco/                       pifmrds/
apitrace/                       libcrossguid/                   pinentry/
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/elf
elf2flt/  elftosb/  elfutils/ 
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/e2
e2fsprogs/ e2tools/   
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/e2
e2fsprogs/ e2tools/   
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/e2fsprogs/
0001-sem-init-libs.patch                        Config.in.host
0002-MCONFIG.in-handle-CLOCK_GETTIME_LIB.patch  e2fsprogs.hash
Config.in                                       e2fsprogs.mk
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/e2fsprogs/e2fsprogs.mk 
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ git apply --check Bison-3.0.4_glibc_2.28.patch -v^C
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ rm -rf ^C
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ rm -rf /home/yan/dev/rt-experiments/buildroot/output/build/host-e2fsprogs-1.43.3
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make -j8
>>> host-e2fsprogs 1.43.5 Downloading
--2022-04-12 05:03:23--  https://cdn.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.5/e2fsprogs-1.43.5.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 2a04:4e42:48::432, 199.232.45.176
Connecting to cdn.kernel.org (cdn.kernel.org)|2a04:4e42:48::432|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5301436 (5.1M) [application/x-xz]
Saving to: ‘/home/yan/dev/rt-experiments/buildroot/output/build/.e2fsprogs-1.43.5.tar.xz.wqYVwO/output’

/home/yan/dev/rt-experiments 100%[============================================>]   5.06M  7.94MB/s    in 0.6s    

2022-04-12 05:03:25 (7.94 MB/s) - ‘/home/yan/dev/rt-experiments/buildroot/output/build/.e2fsprogs-1.43.5.tar.xz.wqYVwO/output’ saved [5301436/5301436]

ERROR: No hash found for e2fsprogs-1.43.5.tar.xz
--2022-04-12 05:03:25--  http://sources.buildroot.net/e2fsprogs-1.43.5.tar.xz
Resolving sources.buildroot.net (sources.buildroot.net)... 2606:4700:20::ac43:4838, 2606:4700:20::681a:25, 2606:4700:20::681a:125, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|2606:4700:20::ac43:4838|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-04-12 05:03:25 ERROR 404: Not Found.

make[1]: *** [package/pkg-generic.mk:130: /home/yan/dev/rt-experiments/buildroot/output/build/host-e2fsprogs-1.43.5/.stamp_downloaded] Error 1
make: *** [Makefile:76: _all] Error 2
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/e2fsprogs/
0001-sem-init-libs.patch                        Config.in.host
0002-MCONFIG.in-handle-CLOCK_GETTIME_LIB.patch  e2fsprogs.hash
Config.in                                       e2fsprogs.mk
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/e2fsprogs/e2fsprogs.hash 
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ cat package/e2fsprogs/e2fsprogs.hash 
# From https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.3/sha256sums.asc
sha256 744ca4e9a8e6c943601b2744d1ae658e5f37d35b5ea5b1dea86985320bd87f37  e2fsprogs-1.43.3.tar.xz
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ cat package/e2fsprogs/e2fsprogs.hash 
# From https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.3/sha256sums.asc
sha256 744ca4e9a8e6c943601b2744d1ae658e5f37d35b5ea5b1dea86985320bd87f37  e2fsprogs-1.43.3.tar.xz
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/e2fsprogs/e2fsprogs.hash 
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ ls
arch                         board             configs     fs               output   toolchain
ARM-A9-buildroot-config      boot              COPYING     kconfig          package  vmalloc-384M.patch
ARM-A9-kernel-config         CHANGES           DEVELOPERS  linux            README   x86_64-buildroot-config
ARM-A9-KML-buildroot-config  Config.in         dl          Makefile         support  x86_64-kernel-config
ARM-A9-KML-kernel-config     Config.in.legacy  docs        Makefile.legacy  system
yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make -j8
>>> host-e2fsprogs 1.43.5 Downloading
--2022-04-12 05:07:36--  https://cdn.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.43.5/e2fsprogs-1.43.5.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 2a04:4e42:48::432, 199.232.45.176
Connecting to cdn.kernel.org (cdn.kernel.org)|2a04:4e42:48::432|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5301436 (5.1M) [application/x-xz]
Saving to: ‘/home/yan/dev/rt-experiments/buildroot/output/build/.e2fsprogs-1.43.5.tar.xz.KW4zez/output’

/home/yan/dev/rt-experiments 100%[============================================>]   5.06M  7.98MB/s    in 0.6s    

2022-04-12 05:07:38 (7.98 MB/s) - ‘/home/yan/dev/rt-experiments/buildroot/output/build/.e2fsprogs-1.43.5.tar.xz.KW4zez/output’ saved [5301436/5301436]

e2fsprogs-1.43.5.tar.xz: OK (sha256: 261f3d9ade383fbf032a19140c9c25e998cc0f71a1ae686614fb3ae0eb955a17)
>>> host-e2fsprogs 1.43.5 Extracting
xzcat /home/yan/dev/rt-experiments/buildroot/dl/e2fsprogs-1.43.5.tar.xz | tar --strip-components=1 -C /home/yan/dev/rt-experiments/buildroot/output/build/host-e2fsprogs-1.43.5   -xf -
>>> host-e2fsprogs 1.43.5 Patching

Applying 0001-sem-init-libs.patch using patch: 
patching file MCONFIG.in
Hunk #1 succeeded at 115 (offset 30 lines).

Applying 0002-MCONFIG.in-handle-CLOCK_GETTIME_LIB.patch using patch: 
patching file MCONFIG.in
>>> host-e2fsprogs 1.43.5 Updating config.sub and config.guess
for file in config.guess config.sub; do for i in $(find /home/yan/dev/rt-experiments/buildroot/output/build/host-e2fsprogs-1.43.5 -name $file); do cp support/gnuconfig/$file $i; done; done
>>> host-e2fsprogs 1.43.5 Patching libtool
>>> host-e2fsprogs 1.43.5 Configuring
(cd /home/yan/dev/rt-experiments/buildroot/output/build/host-e2fsprogs-1.43.5/ && rm -rf config.cache; PATH="/home/yan/dev/rt-experiments/buildroot/output/host/bin:/home/yan/dev/rt-experiments/buildroot/output/host/sbin:/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin:/home/yan/dev/rt-experiments/buildroot/output/host/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin" PKG_CONFIG="/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/yan/dev/rt-experiments/buildroot/output/host/usr/lib/pkgconfig:/home/yan/dev/rt-experiments/buildroot/output/host/usr/share/pkgconfig" AR="/usr/bin/ar" AS="/usr/bin/as" LD="/usr/bin/ld" NM="/usr/bin/nm" CC="/usr/bin/gcc" GCC="/usr/bin/gcc" CXX="/usr/bin/g++" CPP="/usr/bin/cpp" OBJCOPY="/usr/bin/objcopy" RANLIB="/usr/bin/ranlib" CPPFLAGS="-I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include" CFLAGS="-O2 -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include" CXXFLAGS="-O2 -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include" LDFLAGS="-L/home/yan/dev/rt-experiments/buildroot/output/host/lib -L/home/yan/dev/rt-experiments/buildroot/output/host/usr/lib -Wl,-rpath,/home/yan/dev/rt-experiments/buildroot/output/host/usr/lib" INTLTOOL_PERL=/usr/bin/perl CFLAGS="-O2 -I/home/yan/dev/rt-experiments/buildroot/output/host/usr/include" LDFLAGS="-L/home/yan/dev/rt-experiments/buildroot/output/host/lib -L/home/yan/dev/rt-experiments/buildroot/output/host/usr/lib -Wl,-rpath,/home/yan/dev/rt-experiments/buildroot/output/host/usr/lib" ac_cv_header_magic_h=no ac_cv_lib_magic_magic_file=no CONFIG_SITE=/dev/null ./configure --prefix="/home/yan/dev/rt-experiments/buildroot/output/host/usr" --sysconfdir="/home/yan/dev/rt-experiments/buildroot/output/host/etc" --localstatedir="/home/yan/dev/rt-experiments/buildroot/output/host/var" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-dependency-tracking  --disable-defrag --disable-fuse2fs )
configure: WARNING: unrecognized options: --enable-shared, --disable-static, --disable-gtk-doc, --disable-gtk-doc-html, --disable-doc, --disable-docs, --disable-documentation, --disable-debug, --with-xmlto, --with-fop, --disable-dependency-tracking
Generating configuration file for e2fsprogs version 1.43.5

參考 https://patchwork.ozlabs.org/project/buildroot/patch/20170810124536.26344-1-daggs@gmx.com/

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make
>>> linux 4.4.12 Building
PATH="/home/yan/dev/rt-experiments/buildroot/output/host/bin:/home/yan/dev/rt-experiments/buildroot/output/host/sbin:/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin:/home/yan/dev/rt-experiments/buildroot/output/host/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin" BR_BINARIES_DIR=/home/yan/dev/rt-experiments/buildroot/output/images /usr/bin/make -j9 HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=arm INSTALL_MOD_PATH=/home/yan/dev/rt-experiments/buildroot/output/target CROSS_COMPILE="/home/yan/dev/rt-experiments/buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabihf-" DEPMOD=/home/yan/dev/rt-experiments/buildroot/output/host/sbin/depmod INSTALL_MOD_STRIP=1 -C /home/yan/dev/rt-experiments/buildroot/output/build/linux-4.4.12 zImage
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      scripts/mod/empty.o
make[3]: 'include/generated/mach-types.h' is up to date.
  CC      scripts/mod/devicetable-offsets.s
  HOSTLD  scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x40): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x30): first defined here
  CHK     include/generated/timeconst.h
  CC      kernel/bounds.s
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
collect2: error: ld returned 1 exit status
make[4]: *** [scripts/Makefile.host:100: scripts/dtc/dtc] Error 1
make[3]: *** [scripts/Makefile.build:403: scripts/dtc] Error 2
make[3]: *** Waiting for unfinished jobs....
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  CHK     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  HOSTLD  scripts/mod/modpost
make[2]: *** [Makefile:545: scripts] Error 2
make[2]: *** Waiting for unfinished jobs....
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
make[1]: *** [package/pkg-generic.mk:219: /home/yan/dev/rt-experiments/buildroot/output/build/linux-4.4.12/.stamp_built] Error 2
make: *** [Makefile:76: _all] Error 2

follow https://fw64.net/solution-for-multiple-definition-of-yylloc-error

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make
>>> mctest master Downloading
Doing shallow clone
Cloning into 'mctest-master'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Shallow clone failed, falling back to doing a full clone
Doing full clone
Cloning into 'mctest-master'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
--2022-04-13 16:56:38--  http://sources.buildroot.net/mctest-master.tar.gz
Resolving sources.buildroot.net (sources.buildroot.net)... 2606:4700:20::681a:25, 2606:4700:20::681a:125, 2606:4700:20::ac43:4838, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|2606:4700:20::681a:25|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-04-13 16:56:39 ERROR 404: Not Found.

make[1]: *** [package/pkg-generic.mk:130: /home/yan/dev/rt-experiments/buildroot/output/build/mctest-master/.stamp_downloaded] Error 1
make: *** [Makefile:76: _all] Error 2

解法

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ vim package/mctest/mctest.mk

#MCTEST_VERSION = master
#MCTEST_SITE = git@github.com:sonicyang/mctest.git
#MCTEST_SITE_METHOD = git
MCTEST_VERSION=master
MCTEST_SOURCE=mctest-$(MCTEST_VERSION).tar.gz
MCTEST_SITE = http://github.com/sonicyang/mctest/tarball/$(MCTEST_VERSION)

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make
>>> uboot socfpga_v2013.01.01 Downloading
Doing full clone
Cloning into 'uboot-socfpga_v2013.01.01'...
remote: Enumerating objects: 841937, done.
remote: Counting objects: 100% (39987/39987), done.
remote: Compressing objects: 100% (9695/9695), done.
remote: Total 841937 (delta 30933), reused 35109 (delta 29923), pack-reused 801950
Receiving objects: 100% (841937/841937), 200.22 MiB | 11.76 MiB/s, done.
Resolving deltas: 100% (690657/690657), done.
Updating files: 100% (17838/17838), done.
Could not fetch special ref 'socfpga_v2013.01.01'; assuming it is not special.
error: pathspec 'socfpga_v2013.01.01' did not match any file(s) known to git
--2022-04-14 11:57:57--  http://sources.buildroot.net/uboot-socfpga_v2013.01.01.tar.gz
Resolving sources.buildroot.net (sources.buildroot.net)... 2606:4700:20::ac43:4838, 2606:4700:20::681a:125, 2606:4700:20::681a:25, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|2606:4700:20::ac43:4838|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-04-14 11:57:58 ERROR 404: Not Found.

make[1]: *** [package/pkg-generic.mk:130: /home/yan/dev/rt-experiments/buildroot/output/build/uboot-socfpga_v2013.01.01/.stamp_downloaded] Error 1
make: *** [Makefile:76: _all] Error 2

這樣部會動,要改成這樣,這是一個 backport

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ make

In file included from /home/yan/dev/rt-experiments/buildroot/output/build/uboot-rel_socfpga_v2013.01.01_20.07.02_rc1/include/image.h:56,
                 from fit_image.c:31:
/usr/include/libfdt.h:1818:19: error: redefinition of ‘fdt_appendprop_u32’
 1818 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from fdt_host.h:25,
                 from mkimage.h:35,
                 from fit_image.c:30:
../include/libfdt.h:1296:19: note: previous definition of ‘fdt_appendprop_u32’ was here
 1296 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from /home/yan/dev/rt-experiments/buildroot/output/build/uboot-rel_socfpga_v2013.01.01_20.07.02_rc1/include/image.h:56,
                 from fit_image.c:31:
/usr/include/libfdt.h:1853:19: error: redefinition of ‘fdt_appendprop_u64’
 1853 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from fdt_host.h:25,
                 from mkimage.h:35,
                 from fit_image.c:30:
../include/libfdt.h:1331:19: note: previous definition of ‘fdt_appendprop_u64’ was here
 1331 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from /home/yan/dev/rt-experiments/buildroot/output/build/uboot-rel_socfpga_v2013.01.01_20.07.02_rc1/include/image.h:56,
                 from fit_image.c:31:
/usr/include/libfdt.h:1865:19: error: redefinition of ‘fdt_appendprop_cell’
 1865 | static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~
In file included from fdt_host.h:25,
                 from mkimage.h:35,
                 from fit_image.c:30:
../include/libfdt.h:1343:19: note: previous definition of ‘fdt_appendprop_cell’ was here
 1343 | static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~
make[3]: *** [/home/yan/dev/rt-experiments/buildroot/output/build/uboot-rel_socfpga_v2013.01.01_20.07.02_rc1/rules.mk:66: fit_image.o] Error 1
make[2]: *** [Makefile:590: tools] Error 2
make[1]: *** [package/pkg-generic.mk:219: /home/yan/dev/rt-experiments/buildroot/output/build/uboot-rel_socfpga_v2013.01.01_20.07.02_rc1/.stamp_built] Error 2
make: *** [Makefile:76: _all] Error 2

解法

yan@am-002b67307289:~/dev/rt-experiments/buildroot$ sudo apt-get purge -y --auto-remove libfdt-dev

Wastecore

wastedcore seem not worth time to deep into. Check the thread on Linux Mailing List (Brend) & the experiment from him

I quote:

Summary: no significant difference seen in these tests.

20220415

轉向 buildroot arm_qemu_deconfig

buildroot 先走到 2022.02.x

yan@am-002b67307289:~/dev/buildroot$ make qemu_arm_vexpress_defconfig
#
# configuration written to /home/yan/dev/buildroot/.config
#
yan@am-002b67307289:~/dev/buildroot$ git status 
On branch 2022.02.x
Your branch is up to date with 'origin/2022.02.x'.

nothing to commit, working tree clean
ls configs/

qemu_arm_versatile_defconfig        qemu_arm_versatile_nommu_defconfig  qemu_arm_vexpress_defconfig         qemu_arm_vexpress_tz_defconfig  #Trustzone

Compile 不會過

/home/yan/dev/buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-gcc -Wp,-MD,kernel/.fork.o.d -nostdinc -isystem /home/yan/dev/buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.3.0/include -I./arch/arm/include -Iarch/arm/include/generated/uapi -Iarch/arm/include/generated  -Iinclude -I./arch/arm/include/uapi -Iarch/arm/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-dwarf2-cfi-asm -fno-ipa-sra -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -funwind-tables -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -Wno-unused-const-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Wno-attribute-alias    -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(fork)"  -D"KBUILD_MODNAME=KBUILD_STR(fork)" -c -o kernel/fork.o kernel/fork.c -v
Using built-in specs.
COLLECT_GCC=/home/yan/dev/buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-gcc.br_real
Target: arm-buildroot-linux-gnueabihf
Configured with: ./configure --prefix=/home/yan/dev/buildroot/output/host --sysconfdir=/home/yan/dev/buildroot/output/host/etc --enable-static --target=arm-buildroot-linux-gnueabihf --with-sysroot=/home/yan/dev/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --with-gmp=/home/yan/dev/buildroot/output/host --with-mpc=/home/yan/dev/buildroot/output/host --with-mpfr=/home/yan/dev/buildroot/output/host --with-pkgversion='Buildroot 2022.02-521-g114487dfd2' --with-bugurl=http://bugs.buildroot.net/ --without-zstd --disable-libquadmath --disable-libquadmath-support --enable-tls --enable-threads --without-isl --without-cloog --with-abi=aapcs-linux --with-cpu=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard --with-mode=arm --enable-languages=c --with-build-time-tools=/home/yan/dev/buildroot/output/host/arm-buildroot-linux-gnueabihf/bin --enable-shared --disable-libgomp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.3.0 (Buildroot 2022.02-521-g114487dfd2) 
COLLECT_GCC_OPTIONS='-fstack-protector-strong' '-nostdinc' '-isystem' '/home/yan/dev/buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.3.0/include' '-I' './arch/arm/include' '-I' 'arch/arm/include/generated/uapi' '-I' 'arch/arm/include/generated' '-I' 'include' '-I' './arch/arm/include/uapi' '-I' 'arch/arm/include/generated/uapi' '-I' './include/uapi' '-I' 'include/generated/uapi' '-include' './include/linux/kconfig.h' '-D' '__KERNEL__' '-mlittle-endian' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration' '-Wno-format-security' '-std=gnu90' '-fno-dwarf2-cfi-asm' '-fno-ipa-sra' '-mabi=aapcs-linux' '-mno-thumb-interwork' '-mfpu=vfp' '-funwind-tables' '-marm' '-D' '__LINUX_ARM_ARCH__=7'  '-mfloat-abi=soft' '-U' 'arm' '-fno-delete-null-pointer-checks' '-O2' '-Wframe-larger-than=1024' '-fno-stack-protector' '-Wno-unused-but-set-variable' '-Wunused-const-variable=0' '-fomit-frame-pointer' '-fno-var-tracking-assignments' '-g' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes' '-Werror=date-time' '-Werror=incompatible-pointer-types' '-Wattribute-alias=0' '-D' 'KBUILD_STR(s)=#s' '-D' 'KBUILD_BASENAME=KBUILD_STR(fork)' '-D' 'KBUILD_MODNAME=KBUILD_STR(fork)' '-c' '-o' 'kernel/fork.o' '-v' '-mtls-dialect=gnu' '-march=armv7-a'
 /home/yan/dev/buildroot/output/host/libexec/gcc/arm-buildroot-linux-gnueabihf/10.3.0/cc1 -quiet -nostdinc -v -I ./arch/arm/include -I arch/arm/include/generated/uapi -I arch/arm/include/generated -I include -I ./arch/arm/include/uapi -I arch/arm/include/generated/uapi -I ./include/uapi -I include/generated/uapi -isysroot /home/yan/dev/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot -D __KERNEL__ -D __LINUX_ARM_ARCH__=7 -U arm -D KBUILD_STR(s)=#s -D KBUILD_BASENAME=KBUILD_STR(fork) -D KBUILD_MODNAME=KBUILD_STR(fork) -isystem /home/yan/dev/buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.3.0/include -include ./include/linux/kconfig.h -MD kernel/.fork.o.d kernel/fork.c -quiet -dumpbase fork.c -mlittle-endian -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -marm -mfloat-abi=soft -mtls-dialect=gnu -march=armv7-a -auxbase-strip kernel/fork.o -g -O2 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror=implicit-function-declaration -Wno-format-security -Wframe-larger-than=1024 -Wno-unused-but-set-variable -Wunused-const-variable=0 -Wdeclaration-after-statement -Wno-pointer-sign -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Wattribute-alias=0 -std=gnu90 -version -fstack-protector-strong -fno-strict-aliasing -fno-common -fno-dwarf2-cfi-asm -fno-ipa-sra -funwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -fomit-frame-pointer -fno-var-tracking-assignments -fno-strict-overflow -fconserve-stack -o /tmp/ccYYcoHI.s
GNU C89 (Buildroot 2022.02-521-g114487dfd2) version 10.3.0 (arm-buildroot-linux-gnueabihf)
        compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "arch/arm/include/generated/uapi"
#include "..." search starts here:
#include <...> search starts here:
 ./arch/arm/include
 arch/arm/include/generated/uapi
 arch/arm/include/generated
 include
 ./arch/arm/include/uapi
 ./include/uapi
 include/generated/uapi
 /home/yan/dev/buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.3.0/include
End of search list.
GNU C89 (Buildroot 2022.02-521-g114487dfd2) version 10.3.0 (arm-buildroot-linux-gnueabihf)
        compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: f0b4a9b923e6cc478a2ab2aeb6c8f754
In file included from include/linux/kernel.h:11,
                 from include/asm-generic/bug.h:13,
                 from ./arch/arm/include/asm/bug.h:62,
                 from include/linux/bug.h:4,
                 from include/linux/mmdebug.h:4,
                 from include/linux/gfp.h:4,
                 from include/linux/slab.h:14,
                 from kernel/fork.c:14:
include/linux/log2.h:22:1: warning: ignoring attribute ‘noreturn’ because it conflicts with attribute ‘const’ [-Wattributes]
   22 | int ____ilog2_NaN(void);
      | ^~~
COLLECT_GCC_OPTIONS='-fstack-protector-strong' '-nostdinc' '-isystem' '/home/yan/dev/buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.3.0/include' '-I' './arch/arm/include' '-I' 'arch/arm/include/generated/uapi' '-I' 'arch/arm/include/generated' '-I' 'include' '-I' './arch/arm/include/uapi' '-I' 'arch/arm/include/generated/uapi' '-I' './include/uapi' '-I' 'include/generated/uapi' '-include' './include/linux/kconfig.h' '-D' '__KERNEL__' '-mlittle-endian' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs' '-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration' '-Wno-format-security' '-std=gnu90' '-fno-dwarf2-cfi-asm' '-fno-ipa-sra' '-mabi=aapcs-linux' '-mno-thumb-interwork' '-mfpu=vfp' '-funwind-tables' '-marm' '-D' '__LINUX_ARM_ARCH__=7'  '-mfloat-abi=soft' '-U' 'arm' '-fno-delete-null-pointer-checks' '-O2' '-Wframe-larger-than=1024' '-fno-stack-protector' '-Wno-unused-but-set-variable' '-Wunused-const-variable=0' '-fomit-frame-pointer' '-fno-var-tracking-assignments' '-g' '-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow' '-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes' '-Werror=date-time' '-Werror=incompatible-pointer-types' '-Wattribute-alias=0' '-D' 'KBUILD_STR(s)=#s' '-D' 'KBUILD_BASENAME=KBUILD_STR(fork)' '-D' 'KBUILD_MODNAME=KBUILD_STR(fork)' '-c' '-o' 'kernel/fork.o' '-v' '-mtls-dialect=gnu' '-march=armv7-a'
 /home/yan/dev/buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.3.0/../../../../arm-buildroot-linux-gnueabihf/bin/as -v -I ./arch/arm/include -I arch/arm/include/generated/uapi -I arch/arm/include/generated -I include -I ./arch/arm/include/uapi -I arch/arm/include/generated/uapi -I ./include/uapi -I include/generated/uapi -EL -march=armv7-a -mfloat-abi=soft -mfpu=vfp -meabi=5 -o kernel/fork.o /tmp/ccYYcoHI.s
GNU assembler version 2.37 (arm-buildroot-linux-gnueabihf) using BFD version (GNU Binutils) 2.37
/tmp/ccYYcoHI.s: Assembler messages:
/tmp/ccYYcoHI.s:3348: Error: .err encountered

稍微研究了一下,發現是新版 GCC const register 出問題,但這個問題需要一步一步測試,但由於這並不是我們要的最終版本,我們可以不一定要解他,當初做這個的想法是,有一個對照版本
以下是有用資訊
gcc: Bug 85745 - variable with asm register assignment allocated in wrong reg
Bug 86673 - [8/9 regression] inline asm sometimes ignores 'register asm("reg")' declarations
/tmp/cctnQ1CM.s:35: Error: .err encountered
GCC 8.3 ARM Assembly error when building Linux kernel 3.14.17 in Buildroot 2020.02 setup

multiple definition of `yylloc'

(.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here

https://review.lineageos.org/c/LineageOS/android_kernel_oneplus_sm8150/+/273023