cvs commit: src Makefile.inc1
yar at comp.chem.msu.su
Fri Nov 2 06:09:46 PDT 2007
On Wed, Oct 31, 2007 at 11:12:28AM -0600, Warner Losh wrote:
> > 3) With a bit of hackery around rtld(8), it becomes possible to do destructive
> > cross-installs, e.g., i386->amd64 over the live system.
> > but this can lead to security issues.) That's why a destructive
> > cross-install isn't possible w/o hackery yet.
> Does this mean I can now 'sidegrade' my FreeBSD/amd64 box to
> FreeBSD/i386? or is only the 32-bit -> 64-bit direction supported.
The approach to the issue in the makefiles is rather general, so
it should be OK to 'sidegrade' between any two arch'es. However,
some arch'es can be mutually incompatible WRT the boot disk format,
e.g., MBR vs GPT. Moreover, even the same boot disk format may
need different boot blocks. With all these difficulties in mind,
i386 and amd64 present the simplest case as they share the same
boot disk format and boot blocks.
I see no fundamental obstacles to going from amd64 to i386 or vice
versa, but I don't have a free amd64 machine to play with, so I was
able only to test that the i386->amd64 installation finished OK --
I couldn't see if the resulting system would boot.
The exact procedure I used was as follows:
mv /rescue /rescue.sav
make installkernel TARGET_ARCH=amd64 DESTDIR=/
make -DNO_RTLD installworld TARGET_ARCH=amd64 DESTDIR=/
chflags noschg ld-elf.so.1
mv ld-elf.so.1 ld-elf.so.1.old
cp /usr/obj/amd64/usr/src/libexec/rtld-elf/ld-elf.so.1 .
chmod 555 ld-elf.so.1
chflags schg ld-elf.so.1
`cp -R /rescue /rescue.sav' would create a separate file for each
link to rescue(8), so mv is much better.
DESTDIR=/ is there to convince our build subsystem that you do know
what you're doing. It won't let you install for a different arch
unless DESTDIR is set.
`exec sh' switches to /rescue.sav/sh, thus releasing the old ld-elf.so
if the shell was the only user process using it. If you dare
follow the procedure from multi-user mode, you'll still need to mv
the old ld-elf.so out of the way, as attempts to overwrite it will
fail with ETXTBSY.
The 32-bit loader ld-eld32.so is installed for amd64 via a special
target in src/Makefile.inc1 and it isn't affected by -DNO_RTLD, so
you don't have to copy it manually when 'sidegrading' to amd64,
it'll be there just after installworld.
More information about the cvs-src