[Bug 257514] Can not embed ZFS into Kernel on RelEng/13.0 i386

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 31 Jul 2021 03:14:26 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257514

            Bug ID: 257514
           Summary: Can not embed ZFS into Kernel on RelEng/13.0 i386
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs_at_FreeBSD.org
          Reporter: CrazyMihey_at_Ya.Ru

Created attachment 226811
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=226811&action=edit
Simplyfied Kernel Configuration, Full Building Process Results and System
Information

Hello, Developers! & Sorry, if I do SomeThing wrong.
Some Time ago, on FreeBSD (at least 11.3 & 12.1 & 12.2) on x86 32-Bit I
included ZFS Support into Custom Kernel in following Way:
device  zfs     # in «/usr/src/sys/i386/conf/CrazyBook»
But after DownLoading RelEng/13.0 Sources, This Kernel Configuration does not
Build any more. :(
Process of Getting 13.0:
        pkg install gitup
        sed -E -i "" "s~(releng/)([\.\,0-9]*)~\113.0~"
"/usr/local/etc/gitup.conf"
        $(whereis -b -q time) -l rm -rf /usr/src/* /usr/src/.[!.]* /usr/obj/*
/usr/obj/.[!.]* /usr/ports/* /usr/ports/.[!.]* "/var/db/portsnap"
"/var/db/gitup"
        $(whereis -b -q time) -l gitup "release" -v "1" && rm -Rf
"/var/db/gitup/release" && for ConfigurationPath in $(find
"${Src%"/"}"/sys/*/conf -prune -print); do [ -f "${ConfigurationPath}/GENERIC"
] && printf "\"%s\"\n" "${ConfigurationPath}" && ln -f -s -v ~/Kernels/*
"${ConfigurationPath}"; done
First Build the Compiler:
        cd "/usr/src" && script -a -q "/var/tmp/$(date -j
"+%Y.%m.%d-%H:%M:%S")-BuildWorld-$(sh -c 'set -o "pipefail" && egrep -i -o
"^[[:space:]]*#[[:space:]]*DeFine.*BSD.*Version[[:space:]]+[[:digit:]]+"
"/usr/src/sys/sys/param.h" | rev | egrep -o "[[:digit:]]+" | head -n "1" | rev
| tr -d "[[:space:]]"' || svnlite info "/usr/src" 2>"/dev/null" | grep
--ignore-case -- "RevisiOn" | grep --only-matching "[[:digit:]]\+" || cat
"/usr/src/.svnversion" 2>"/dev/null" | tr -d "\r\n" | grep "" || cut -f "2" -d
":" "/usr/src/.gituprevision")-$(( "$(sysctl -n "hw.realmem")" >> 30
))GB-$(($(sysctl -n "kern.sched.topology_spec" 2>"/dev/null" | grep
--extended-regexp --ignore-case --quiet "<Flags>.*Thread.*Group.*</Flags>"
>"/dev/null" 2>&1 && printf "$(($(sysctl -n "kern.smp.cpus")/2))" || printf
"$(sysctl -n "kern.smp.cpus")")+1))Th.Out" $(whereis -b -q time) -l make
buildworld KERNCONF="CrazyBook" -j "$(($(sysctl -n "kern.sched.topology_spec"
2>"/dev/null" | grep --extended-regexp --ignore-case --quiet
"<Flags>.*Thread.*Group.*</Flags>" >"/dev/null" 2>&1 && printf "$(($(sysctl -n
"kern.smp.cpus")/2))" || printf "$(sysctl -n "kern.smp.cpus")")+1))"    # I
understand, the Command looks Ugly, but this is just a Part of Future Script,
where Long Expressions will be moved into Functions or AliAces…
To make sure about CLang Parameters, I removed Parameter Files «/etc/src.conf»
and «/etc/make.conf»:
        rm -Rf "/etc/src.conf" "/etc/make.conf"
Second try to Build a Custom Kernel:
        cd "/usr/src" && script -a -q "/var/tmp/$(date -j
"+%Y.%m.%d-%H:%M:%S")-BuildKernel-$(sh -c 'set -o "pipefail" && egrep -i -o
"^[[:space:]]*#[[:space:]]*DeFine.*BSD.*Version[[:space:]]+[[:digit:]]+"
"/usr/src/sys/sys/param.h" | rev | egrep -o "[[:digit:]]+" | head -n "1" | rev
| tr -d "[[:space:]]"' || svnlite info "/usr/src" 2>"/dev/null" | grep
--ignore-case -- "RevisiOn" | grep --only-matching "[[:digit:]]\+" || cat
"/usr/src/.svnversion" 2>"/dev/null" | tr -d "\r\n" | grep "" || cut -f "2" -d
":" "/usr/src/.gituprevision")-$(( "$(sysctl -n "hw.realmem")" >> 30
))GB-$(($(sysctl -n "kern.sched.topology_spec" 2>"/dev/null" | grep
--extended-regexp --ignore-case --quiet "<Flags>.*Thread.*Group.*</Flags>"
>"/dev/null" 2>&1 && printf "$(($(sysctl -n "kern.smp.cpus")/2))" || printf
"$(sysctl -n "kern.smp.cpus")")+1))Th.Out" $(whereis -b -q time) -l make
buildkernel KERNCONF="CrazyBook" -j "$(($(sysctl -n "kern.sched.topology_spec"
2>"/dev/null" | grep --extended-regexp --ignore-case --quiet
"<Flags>.*Thread.*Group.*</Flags>" >"/dev/null" 2>&1 && printf "$(($(sysctl -n
"kern.smp.cpus")/2))" || printf "$(sysctl -n "kern.smp.cpus")")+1))" && printf
"\007" && sleep "0.500" && printf "\007" && sleep "1.000" && printf "\007" &&
sleep "2.000" && printf "\007" && sleep "4.000" && printf "\007"
Now I get Following Error:
…       …       …       …
--- opensolaris_atomic.o ---
cc -target i386-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/i386.i386/tmp
-B/usr/obj/usr/src/i386.i386/tmp/usr/bin -c -x assembler-with-cpp -DLOCORE
-DFREEBSD_NAMECACHE  -D_SYS_VMEM_H_  -D__KERNEL  -D__KERNEL__  -nostdinc 
-include /usr/src/sys/modules/zfs/static_ccompile.h 
-I/usr/src/sys/contrib/openzfs/include 
-I/usr/src/sys/contrib/openzfs/include/os/freebsd 
-I/usr/src/sys/contrib/openzfs/include/os/freebsd/spl 
-I/usr/src/sys/contrib/openzfs/include/os/freebsd/zfs  
-I/usr/src/sys/modules/zfs  -I/usr/src/sys/contrib/openzfs/module/zstd/include 
-O2 -pipe  -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys
-I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt -D_KERNEL
-DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common    -MD 
-MF.depend.opensolaris_atomic.o -MTopensolaris_atomic.o
-fdebug-prefix-map=./machine=/usr/src/sys/i386/include
-fdebug-prefix-map=./x86=/usr/src/sys/x86/include -mno-mmx -mno-sse
-msoft-float -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
-Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas
-Wno-error-tautological-compare -Wno-error-empty-body
-Wno-error-parentheses-equality -Wno-error-unused-function
-Wno-error-pointer-sign -Wno-error-shift-negative-value
-Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx 
-std=iso9899:1999  -Wno-cast-qual  -Wno-duplicate-decl-specifier  -Wno-inline 
-Wno-missing-braces  -Wno-missing-prototypes  -Wno-nested-externs 
-Wno-parentheses  -Wno-pointer-arith  -Wno-redundant-decls 
-Wno-strict-prototypes  -Wno-switch  -Wno-undef  -Wno-uninitialized 
-Wno-unknown-pragmas  -Wno-unused  -include
/usr/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h 
-I/usr/src/sys/cddl/contrib/opensolaris/uts/common  -I/usr/src/sys
-I/usr/src/sys/cddl/compat/opensolaris -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY 
-DWITH_NETDUMP -D__KERNEL__ -D_SYS_CONDVAR_H_ -DSMP  -DIN_FREEBSD_BASE
-DHAVE_KSID -DBITS_PER_LONG=32 -Werror
/usr/src/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S
cc: error: no such file or directory:
'/usr/src/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S'
cc: error: no input files
*** [opensolaris_atomic.o] Error code 1

make[2]: stopped in /usr/obj/usr/src/i386.i386/sys/CrazyBook
…       …       …       …
When I try to use «options ZFS» instead of «device zfs», or both in kernel
Config, I get the same Error.
The very Simplyfied Kernel Configuration, that Produces Described Error is
attached to Message. Also attached Full «Make BuildKernel» OutPut (Big File)
and Current System «kldstat -v», which shows that Modules «zfs_vdev»,
«zfs_zvol», «zfsctrl», «zfs», «opensolaris» are in «/boot/kernel/kernel» on
12.1, how to make the same in 13.0?

I saw file
«/usr/src/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S»
in 12.2 Sources, but It was ReMoved in 13.0. I did not try to Copy this File
from Previous Distributions, because IMHO this is a «Wrong Way».

Why am I worried about This?
        1. I Read that some Modules (for example, "IPFW", …) work Better
(Theoretically, Faster) when they are Embedded into the FreeBSD Kernel, than if
they are KLDLoaded during Boot.
        2. SomeTimes (on Some Small-Disk Systems) is useful to make «bzip2
--best --verbose "/boot/kernel/kernel"», but It does not Work on
«/boot/kernel/*.ko».
        3. Finally, It worked in Previous Versions of the System — so, Should
work in 13.0 too. And the Solution, most likely, is not very Labor-Intensive…

What is the Best Way to Do in Case to Make the Kernel, including «All Needed»?
is it safe to use:
        device  zfs
        options KSTACK_PAGES=4
        makeoptions     WITHOUT_MODULES+="opensolaris zfs"
or better:
        options ZFS
I did not Find some Detailed Documentation about This Parameters and what is
the Difference between «options ZFS» and «device zfs»…

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Sat Jul 31 2021 - 03:14:26 UTC

Original text of this message