Should I build a patched kernel? How do I?


#1

I want to try out a patch to bhyve, according to this:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229852

I have already patched and built ports, but never the kernel yet. Is it worth it? Which are the steps?

(I don’t mind screwing a BE if it happens - that’s what they are for.)


#2

if you are on telegram, also ask there. @beanpole135 may answer


#3

The traditional FreeBSD upgrade was from source. That meant:
source tree in /usr/src (git repo clone of the TrueOS tree, make sure you do a git checkout of the correct stable tag)
Then you do the following:
make buildworld && make buildkernel && make installkernel && mergemaster -p && reboot to single user && make installworld && mergemaster
Then you’d rebuild all your ports :slight_smile:

Binary upgrades and packaging of the Base probably changed some of those steps so you may be able to do something a little easier. I just don’t know what that is. Conceptually I’m thinking local build (make sure you pull down the same make.conf or any other settings TrueOS is using) which creates a local package repo and then sysup point at that local repo should work. Easy to say, probably not easy to do.

I’d be inclined to follow @RodMyers suggestion and ask on telegram.


#4

I’m not on telegram. If I can do this work, I will go there just to get the best directions.

But if I’ll have to rebuild all my ports, I don’t even dare to. :frowning:


#5

from my understanding, if you change kernel options and/or update kernel, requiring a rebuild, then yes. the ports tree requires a rebuild


#6

:frowning: Thanks, gentlemen.


#7

Any hope that asking the devs to apply this patch would result in a fixed release soon?

(It’s already done here… https://github.com/trueos/trueos/issues/297 )

Hope survives.


#8

file a request on https://github.com/project-trident


#9
# beadm create patched-be
# beadm mount patched-be /tmp/patched-be
# make installkernel DESTDIR=/tmp/patched-be
# make installworld DESTDIR=/tmp/patched-be
Not necessary unless using a different branch or 
applying major changes to the ABI.

John
groenveld@acm.org

#10

Thanks @jgroenveld.

Once again, the power of ZFS and boot environments.
Understood and agree on the ports; my problem was that I’d typically update the ports tree around the same time I’d do a source upgrade, so sometimes I’d cross that boundary.


#11

So, I started. Soon, this presented me an error. Are there dependencies missing? Can anybody say which they should be? Please.

In file included from /usr/src/contrib/llvm/lib/Support/Signals.cpp:213:
/usr/src/contrib/llvm/lib/Support/Unix/Signals.inc:51:11: fatal error: 'execinfo.h' file not found
# include BACKTRACE_HEADER         // For backtrace().
          ^~~~~~~~~~~~~~~~
/usr/src/lib/clang/include/llvm/Config/config.h:20:26: note: expanded from macro 'BACKTRACE_HEADER'                                                                                            
#define BACKTRACE_HEADER <execinfo.h>
                         ^~~~~~~~~~~~
1 error generated.

#12

Sounds like something is missing from the install. But that file should be somewhere in the /usr/src tree instead of looking for it in the “system” tree.


#13

Actually, that file can be found in the src tree in contrib/libexecinfo/execinfo.h

What next? … :thinking:


#14

Hmm. To me that implies Makefile options for the build are not looking in the correct place for that header file. Now you’re getting into bsd mk magic.


#15
# pkg which /usr/include/execinfo.h
/usr/include/execinfo.h was installed by package OS-libexecinfo-development-13.0.20190111130505

# pkg install "OS-*-development"

H/T Rod:
<URL:https://discourse.trueos.org/t/project-trident-1812-release-discusion-here/3540/53?u=jgroenveld>

John
groenveld@acm.org

#16

Thank you! That was it.

First, I installed the missing package, and then the compilation proceeded until the next missing package. Now I’m installing all the development packages.

(Note: you forgot to add -g to the command: pkg install -g "OS-*-development")


#17

Help, again…

objcopy --only-keep-debug sendmail.full sendmail.debug
objcopy --strip-debug --add-gnu-debuglink=sendmail.debug  sendmail.full sendmail
gzip -cn /usr/src/contrib/sendmail/src/mailq.1 > mailq.1.gz
gzip -cn /usr/src/contrib/sendmail/src/newaliases.1 > newaliases.1.gz
gzip -cn /usr/src/contrib/sendmail/src/aliases.5 > aliases.5.gz
gzip -cn /usr/src/contrib/sendmail/src/sendmail.8 > sendmail.8.gz
===> usr.sbin/sendmail/confs (all)
===> usr.sbin/sendmail/mail (all)
cp -f /usr/src/usr.sbin/sendmail/sendmailetc/freebsd.mc sergio-sys.mc
/usr/bin/m4 -D_CF_DIR_=/usr/src/contrib/sendmail/cf/   /usr/src/contrib/sendmail/cf/m4/cf.m4 sergio-sys.mc > sergio-sys.cf
cp -f /usr/src/usr.sbin/sendmail/sendmailetc/freebsd.submit.mc sergio-sys.submit.mc
/usr/bin/m4 -D_CF_DIR_=/usr/src/contrib/sendmail/cf/   /usr/src/contrib/sendmail/cf/m4/cf.m4 sergio-sys.submit.mc > sergio-sys.submit.cf
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases
mailwrapper: cannot exec /usr/libexec/sendmail/sendmail: No such file or directory
*** Error code 71

# pkg info | grep sendmail
OS-sendmail-development-13.0.20190111130505 Sendmail Utilities (Development Files)
OS-sendmail-lib32-development-13.0.20190111130505 Sendmail Utilities (32-bit Libraries, Development Files)
sendmail-8.15.2_16             Reliable, highly configurable mail transfer agent with utilities

What is possibly missing here?


#18
# pkg which  /usr/libexec/sendmail/sendmail 
/usr/libexec/sendmail/sendmail was installed by package OS-sendmail-13.0.20190111130505

John
groenveld@acm.org

#19

Thank you, very much.

One more help, please…

gzip -cn /usr/src/contrib/sendmail/src/sendmail.8 > sendmail.8.gz
===> usr.sbin/sendmail/confs (all)
===> usr.sbin/sendmail/mail (all)
cp -f /usr/src/usr.sbin/sendmail/sendmailetc/freebsd.mc sergio-sys.mc
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 sergio-sys.mc > sergio-sys.cf
cp -f /usr/src/usr.sbin/sendmail/sendmailetc/freebsd.submit.mc sergio-sys.submit.mc
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 sergio-sys.submit.mc > sergio-sys.submit.cf
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases
/etc/mail/sendmail.cf: line 0: cannot open: No such file or directory
*** Error code 72

Stop.
make[5]: stopped in /usr/src/usr.sbin/sendmail/mail
*** Error code 1

# pkg info | grep sendmail
OS-sendmail-13.0.20190111130505 Sendmail Utilities
OS-sendmail-development-13.0.20190111130505 Sendmail Utilities (Development Files)
OS-sendmail-lib32-development-13.0.20190111130505 Sendmail Utilities (32-bit Libraries, Development Files)
sendmail-8.15.2_16             Reliable, highly configurable mail transfer agent with utilities

#20
# cd /etc/mail
# make freebsd.cf
# cp freebsd.cf sendmail.cf

John
groenveld@acm.org