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
F105959289: D27579.diff
Mon, Dec 23, 3:21 AM
Unknown Object (File)
Wed, Dec 11, 10:36 PM
Unknown Object (File)
Wed, Dec 11, 5:02 PM
Unknown Object (File)
Wed, Dec 11, 1:57 PM
Unknown Object (File)
Oct 7 2024, 3:40 AM
Unknown Object (File)
Oct 5 2024, 1:46 PM
Unknown Object (File)
Oct 5 2024, 11:32 AM
Unknown Object (File)
Oct 4 2024, 12:34 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 35486
Build 32392: 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
45

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
45

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
39

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