Allow xinstall and makefs to be crossbuilt on Linux and Mac
ClosedPublic

Authored by arichardson on Nov 30 2017, 5:01 PM.

Details

Summary

I need these tools in order to install the crossbuilt FreeBSD and create a
disk image. Linux does not have a st_flags in struct stat so unfortunately
I need a bunch of ugly ifdefs. The resulting binaries allow me to
sucessfully install a MIPS64 world and create a disk-image that boots.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
arichardson created this revision.Nov 30 2017, 5:01 PM
brooks accepted this revision.Nov 30 2017, 7:38 PM

LGTM, but I'd wait for @emaste to take a look as he's been working on makefs.

usr.bin/xinstall/xinstall.c
1003 ↗(On Diff #36010)

I'd preserve the blank line.

usr.sbin/makefs/ffs.c
322 ↗(On Diff #36010)

I'd GC this block in a separate commit. It's been "not yet" since 2008...

This revision is now accepted and ready to land.Nov 30 2017, 7:38 PM
emaste accepted this revision.Dec 5 2017, 9:04 PM
bdrewery accepted this revision.Dec 5 2017, 9:35 PM
This revision was automatically updated to reflect the committed changes.
imp added a comment.Tue, Jan 16, 9:55 PM

Why not the less ugly #ifdef UF_SETTABLE?

you wouldn't need the nbtool junk either.

In D13307#292355, @imp wrote:

Why not the less ugly #ifdef UF_SETTABLE?

you wouldn't need the nbtool junk either.

I didn't know there was a macro I could check that works across operating systems to check for st_flags availability. It seems like macOS has the UF_SETTABLE in sys/stat.h and Linux doesn't so I could remove the nbtool changes. I'll post a follow up patch tomorrow.

imp added a comment.Tue, Jan 16, 10:32 PM
In D13307#292355, @imp wrote:

Why not the less ugly #ifdef UF_SETTABLE?

you wouldn't need the nbtool junk either.

I didn't know there was a macro I could check that works across operating systems to check for st_flags availability. It seems like macOS has the UF_SETTABLE in sys/stat.h and Linux doesn't so I could remove the nbtool changes. I'll post a follow up patch tomorrow.

Excellent! Glad I could suggest something. I think there used to be ifdefs there like that back in the net2 / bsd4.4 days...

Also, --include nbtool_config.h could help as well on the !FreeBSD platforms.