Page MenuHomeFreeBSD

powerpc/loader: Install ubldr without stripping
ClosedPublic

Authored by jhibbits on Sep 20 2019, 3:30 AM.
Tags
None
Referenced Files
F103150614: D21725.diff
Thu, Nov 21, 3:52 PM
F103115713: D21725.id.diff
Thu, Nov 21, 5:37 AM
Unknown Object (File)
Tue, Nov 19, 7:46 PM
Unknown Object (File)
Sep 30 2024, 6:54 PM
Unknown Object (File)
Sep 18 2024, 8:20 AM
Unknown Object (File)
Sep 8 2024, 5:00 PM
Unknown Object (File)
Sep 8 2024, 10:41 AM
Unknown Object (File)
Sep 8 2024, 9:02 AM
Subscribers
None

Details

Summary

Install's strip capability, by way of strip(1), doesn't seem to work
correctly on msdosfs, and instead ends up truncating the resulting
binary to 0-length. As a workaround, don't strip ubldr(8). This
fixes installworld on Book-E ubldr-based platforms, which prior to this
would need to manually install ubldr separately after installworld, in
order to have a functional ubldr.

The same thing could be done on PowerNV platforms that use msdosfs /boot
volumes, since loader and loader.kboot, etc, all get truncated to 0 on
install. However, PowerNV does not use loader, instead loading from
petitboot, so it's not really necessary at this time.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Given that it's scoped to ppc and fixes breakage, I don't see any reason not to go ahead... I would quite like to know why the strip fails, though. Does strip(1) alone on a binary placed on msdosfs fail, or is it some of the other behavior implied by install -s?

This revision is now accepted and ready to land.Sep 20 2019, 3:48 AM

Ah, I was able to replicate this easily:

ftruncate(4,0x0)                                 = 0 (0x0)
lseek(4,0x0,SEEK_SET)                            = 0 (0x0)
write(4,"\^?ELF\^B\^A\^A\t\0\0\0\0\0\0\0"...,27256) = 27256 (0x6a78)
munmap(0x800b84000,27256)                        = 0 (0x0)
fstatat(AT_FDCWD,"cp",{ mode=-rwxr-xr-x ,inode=3220,size=27256,blksize=8192 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
rename("/tmp/ecp.6RbhdfzT","cp")                 ERR#18 'Cross-device link'
unlink("cp")                                     = 0 (0x0)
openat(AT_FDCWD,"cp",O_WRONLY|O_CREAT|O_TRUNC,0755) = 5 (0x5)
fstat(4,{ mode=-rw-r--r-- ,inode=655407,size=27256,blksize=27648 }) = 0 (0x0)
mmap(0x0,27256,PROT_READ,MAP_SHARED,4,0x0)       = 34371813376 (0x800b84000)
write(5,"\^?ELF\^B\^A\^A\t\0\0\0\0\0\0\0"...,27256) = 27256 (0x6a78)
munmap(0x800b84000,27256)                        = 0 (0x0)
unlink("/tmp/ecp.6RbhdfzT")                      = 0 (0x0)
close(4)                                         = 0 (0x0)
fchmod(5,0100755)                                = 0 (0x0)
close(3)                                         = 0 (0x0)
close(5)                                         = 0 (0x0)
exit(0x0)
process exit, rval = 0
root@viper:/mnt#

Copied /bin/cp to my ESP and ran strip(1) on it.

This revision was automatically updated to reflect the committed changes.