Page MenuHomeFreeBSD

Use a template assembly file for firmware object files.
ClosedPublic

Authored by jhb on Dec 11 2020, 9:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 1:19 PM
Unknown Object (File)
Wed, Mar 6, 8:23 AM
Unknown Object (File)
Jan 15 2024, 6:40 AM
Unknown Object (File)
Jan 13 2024, 12:16 AM
Unknown Object (File)
Dec 25 2023, 4:23 AM
Unknown Object (File)
Dec 22 2023, 11:11 PM
Unknown Object (File)
Dec 21 2023, 7:40 AM
Unknown Object (File)
Dec 12 2023, 6:21 PM

Details

Summary

Similar to r366897, this uses the .incbin directive to pull in a
firmware file's contents into a .fwo file. The same scheme for
computing symbol names from the filename is used as before to maximize
compatiblity and not require rebuilding existing .fwo files for
NO_CLEAN builds. Using ld -o binary requires extra hacks in linkers
to either specify ABI options (e.g. soft- vs hard-float) or to ignore
ABI incompatiblities when linking certain objects (e.g. object files
with only data). Using the compiler driver avoids the need for these
hacks as the compiler driver is able to set all the appropriate ABI
options.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35359
Build 32285: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Dec 11 2020, 9:25 PM
This revision is now accepted and ready to land.Dec 11 2020, 10:26 PM

I had looked to see if I could use a common assembly file between this and embedfs.S I recently added, but there were enough subtle differences I kept them separate.

markj added inline comments.
sys/conf/kmod.mk
196

The indentation on this line looks off by one space.

sys/kern/firmw.S
44

In embedfs.S you wrote %object. Is that equivalent? The GNU as docs seem to imply that it is but it's not super clear.

sys/kern/firmw.S
44

Oh, hmm. They are equivalent, but I should instead use '%' so that this builds ok on ARM. Let me verify that it is broken on ARM and that using '%' fixes it.

jhb marked 2 inline comments as done.Dec 16 2020, 5:49 PM
  • Various fixes to pass tinderbox.
This revision now requires review to proceed.Dec 17 2020, 6:30 PM
sys/conf/kmod.mk
190

I added firmw.S as a dependency here. There's not a simple way to do it for sys/conf/files. I think I'd have to manually update all the entires in sys/conf/files to get it to work. :( I should perhaps do that, but it's a bit tedious.

sys/kern/firmw.S
40

I had missed this .globl originally.

This revision is now accepted and ready to land.Dec 17 2020, 7:40 PM

(earlier I thought the breaking change was https://reviews.freebsd.org/D27579 )

Apparently this change will crash a machine after inserting wireless USB (if_rsu, RTL8191S, vendor/device ID 0x0bda:0x8172) hardware.
r368738 / de66c99a works fine, so does if_rtwn_usb (RTL8188EU, vendor/device ID 0x0bda:0x8179) based hardware booting a kernel built from r368739.

I can provide a backtrace; do you want me to open a PR? https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252163