How to convert from i386 to amd64

Peter Wemm peter at wemm.org
Mon Jul 19 18:28:11 PDT 2004


On Monday 19 July 2004 05:33 pm, David O'Brien wrote:
> On Mon, Jul 12, 2004 at 04:17:30PM -0700, george+freebsd at m5p.com 
wrote:
> > The following are probably all frequently-asked questions, but I
> > haven't been able to find the answers yet.
> >
> > 1. How can I compile an amd64 kernel while running an i386 kernel? 
> > The CPU I'm on is and amd64, if that matters.
>
> This is not supported.  Down load the amd64 install CD from
> ftp.freebsd.org and do a normal install to get a 64-bit machine
> running.

If anybody is up for an adventure, this is how I used to do it.  No, I 
will not give specific details.  If you need to ask for a step-by-step, 
then you're already way out of your depth. :)

What I did, was build a 64 bit kernel, and cross build a userland.  I'd 
steal a spare partition (I used the swap partition and changed it from 
swap to 4.2bsd for the purpose back then), newfs/mount it as /mnt, and 
do a destdir install into /mnt.  Then, boot the 64 bit kernel, with a 
vfs.root.mountfrom=ufs:/dev/ad0s1b,  and then either mount the original 
obj/src stuff stuff and install it into the real root, or copy the 
files over.  I usually cheated and copied the files. :-)  Then, reboot 
and do a real 'make world' to finish off any loose ends.

And dont forget to turn the ad0s1b partition back into swap.

These days I just install from a CD or from a pxeboot/nfsroot 
environment.  It's a lot less hassle.  But, if you're doing it for fun 
and know how to dig yourself out of deep sh!t if you make a mistake, 
its worth doing once.  But only if its for fun.

And no, a 64 bit kernel will not happily boot a 32 bit userland.  I 
haven't tried it for ages, but I know there are problems with the 
mount(2) interface, sysctl(2), and so on.  The 32 bit ABI stuff is 
limited to syscalls that applications were likely to run into.  I never 
got around to even trying the things needed for things like running a 
full 32 bit OS.  This doesn't mean that it can't be done, just that I 
never got around to it.  nmount(2) should help, but things like 
mount_nfs ABI are just evil.  And a sysctl wrapper needs to be done.

-- 
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5


More information about the freebsd-amd64 mailing list