Page MenuHomeFreeBSD

powerpc/loader: Install ubldr without stripping
ClosedPublic

Authored by jhibbits on Sep 20 2019, 3:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 6:48 AM
Unknown Object (File)
Wed, Apr 17, 4:56 AM
Unknown Object (File)
Wed, Apr 17, 4:53 AM
Unknown Object (File)
Wed, Apr 17, 3:03 AM
Unknown Object (File)
Dec 22 2023, 11:35 PM
Unknown Object (File)
Dec 11 2023, 12:25 AM
Unknown Object (File)
Oct 10 2023, 8:52 PM
Unknown Object (File)
Sep 27 2023, 10:44 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.