Bug 218166 - kernel xref (linker.hints) does not work on BeagleBone Black snapshot image: /boot/kernel/linker.hints is missing
Summary: kernel xref (linker.hints) does not work on BeagleBone Black snapshot image: ...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-27 17:20 UTC by Ed Maste
Modified: 2022-04-21 16:45 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer freebsd_triage 2017-03-27 17:20:59 UTC
According to the handbook (https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/usb-disks.html) `kldload cfumass` should be sufficient to load the cfumass module for mass storage target use, however the kernel reports that icl and ctl are not available:

root@beaglebone:~ # kldload cfumass
KLD ctl.ko: depends on icl - not available or version mismatch
KLD cfumass.ko: depends on ctl - not available or version mismatch
kldload: can't load cfumass: No such file or directory
root@beaglebone:~ # 

It requires manually loading iscsi first:

root@beaglebone:~ # kldload iscsi
root@beaglebone:~ # kldload cfumass
root@beaglebone:~ #
Comment 1 Edward Tomasz Napierala freebsd_committer freebsd_triage 2017-04-05 20:49:45 UTC
Something's fishy here.  I've seen it before, but was never able to reproduce it.

Can you help me a bit?  Where did the current kernel come from?  Was it installed by "make installkernel"?  Does it happen after you do a "make installkernel" again?  What FreeBSD version you're running this on, and on what hardware?
Comment 2 Edward Tomasz Napierala freebsd_committer freebsd_triage 2017-04-05 20:50:38 UTC
(Also note that it probably won't appear anymore due to the cfiscsi(4) refactoring done by Ngie; still, there's something weird with KLD dependencies and would be nice to figure it out.)
Comment 3 Ed Maste freebsd_committer freebsd_triage 2017-04-05 20:53:15 UTC
I used the most recent BBB SD-card snapshot image, built a new kernel via make buildkernel, renamed /boot/kernel/ to kernel.old, and just scp'd the new kernel & required modules into /boot/kernel/.
Comment 4 Edward Tomasz Napierala freebsd_committer freebsd_triage 2017-04-05 21:37:53 UTC
Do you have up to date /boot/kernel/linker.hints file?
Comment 5 Ed Maste freebsd_committer freebsd_triage 2017-04-06 17:13:11 UTC
Probably not. I will test again once new snapshot images are ready, and close if it's now working.
Comment 6 Alexander Motin freebsd_committer freebsd_triage 2017-04-24 12:57:13 UTC
It was a problem of CTL iSCSI frontend, that made impossible to load CTL without loading iscsi/icl module first.  ngie@ fixed it recently in r316212.
Comment 7 Ed Maste freebsd_committer freebsd_triage 2017-04-25 01:42:55 UTC
Something's still not right. This is tested on a BeagleBone Black using the re@ snapshot at r317181. /boot/loader.conf contains:

cfumass_load="YES"

Using ctladm reports:

root@beaglebone:~ # ctladm create -b block -o file=/image
KLD cfiscsi.ko: depends on icl - not available or version mismatch
ctladm: couldn't load cfiscsi: No such file or directory
LUN created successfully
backend:       block
device type:   0
LUN size:      16777216 bytes
blocksize      512 bytes
LUN ID:        0
Serial Number: MYSERIAL   0
Device ID;     MYDEVID   0
root@beaglebone:~ # kldstat
Id Refs Address    Size     Name
 1   21 0xc0200000 9132f4   kernel
 2    1 0xc0b14000 d540     cfumass.ko
 3    2 0xc0b22000 549f8    ctl.ko

Trying to load cfiscsi directly reports:

root@beaglebone:~ # kldload cfiscsi
KLD cfiscsi.ko: depends on icl - not available or version mismatch

But manually loading iscsi first works:

root@beaglebone:~ # kldload iscsi
root@beaglebone:~ # kldload cfiscsi
Comment 8 Ed Maste freebsd_committer freebsd_triage 2017-04-27 20:21:09 UTC
It appears the linker.hints file on the BBB image is not correct - it's fixed after running kldxref on the BBB. Maybe it's an issue with cross-kldxref?
Comment 9 Edward Tomasz Napierala freebsd_committer freebsd_triage 2018-02-27 12:31:27 UTC
I took another look at this - it also happens with 12.0 RPI-B image - and it seems the /boot/kernel/linker.hints is simply missing:

% ls /media/rootfs/boot/kernel/*hints*
zsh: no matches found: /media/rootfs/boot/kernel/*hints*

The same seems to be the case for the BEAGLEBONE images.
Comment 10 Edward Tomasz Napierala freebsd_committer freebsd_triage 2018-02-27 16:04:41 UTC
Digging deeper...

1. The "kldload cfumass" works fine without the linker.hints file.  A way to reproduce the problem is to "kldload cfiscsi" instead.

2. It seems it's impossible to create arm6 hints file on amd64.  Running "kldxrefs -v" results in this:

% doas kldxref -v /media/rootfs/boot/kernel                                         
/media/rootfs/boot/kernel/accf_data.ko       
kldxref: elf_open(/media/rootfs/boot/kernel/accf_data.ko): Inappropriate file type or format       
/media/rootfs/boot/kernel/accf_dns.ko         
kldxref: elf_open(/media/rootfs/boot/kernel/accf_dns.ko): Inappropriate file type or format      

... and so on, and so on.  The linker.hints file doesn't get created.
Comment 11 Edward Tomasz Napierala freebsd_committer freebsd_triage 2018-02-27 16:29:54 UTC
As suggested by jhibbits@, the fix might be simply to set "kldxref_enable=YES".
Comment 12 Edward Tomasz Napierala freebsd_committer freebsd_triage 2018-02-27 16:35:35 UTC
See https://reviews.freebsd.org/D14534.
Comment 13 Piotr Pawel Stefaniak freebsd_committer freebsd_triage 2022-04-21 16:45:58 UTC
(In reply to Edward Tomasz Napierala from comment #12)
That's been committed long time ago. Are we good to close this?