Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Dec 2004 08:48:54 -0800
From:      Peter Wemm <peter@wemm.org>
To:        freebsd-amd64@freebsd.org, Michael Lednev <liettneff@bk.ru>
Subject:   Re: Kernel Build errors
Message-ID:  <200412030848.54478.peter@wemm.org>
In-Reply-To: <924403133.20041203162619@bk.ru>
References:  <20041203122454.A6A12790094@ws1-14.us4.outblaze.com> <924403133.20041203162619@bk.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 03 December 2004 05:26 am, Michael Lednev wrote:
> Hello Egor,
>
> Friday, December 3, 2004, 3:24:54 PM, you wrote:
>
> ED> # cd /usr/src/
> ED> # make clean
> ED> # rm -r /usr/obj/*
> ED> # make TARGET_TECH=amd64 buildworld
> ED> # make TARGET_TECH=amd64 buildkernel
> ED> # make TARGET_TECH=amd64 installkernel
>
> hmmm, just like written in handbook ;)
>
> ED> New kernel freezes at startup right after enumerating hard
> drives... ED> Should I install world? How? Thanks in advance!
>
> unfortuately amd64 kernels cannot work with i386 world so you
> definetly need to install amd64 one. the easiest way to accomplish
> this is to make clean install from cd.

If you are feeling adventurous, this is what I do to convert an i386 
install to an amd64 system:

* build an amd64 kernel, install it as kernel.amd64
* turn off swap and newfs /dev/ad0s1b (swap partition). dont forget 
rc.conf and fstab
* mount /dev/ad0s1b /mnt
* make installworld DESTDIR=/mnt  (this puts an amd64 userland in the 
temporary filesystem that lives in the swap partition)
* copy /etc/fstab to /mnt/etc/fstab (and a few others that I dont 
remember)
* reboot
* break into loader prompt
* type:     set vfs.root.mountfrom="ufs:/dev/ad0s1b"
* boot -s kernel.amd64

If everything works, then I mount /home (I use /home/src and /home/obj) 
and make symlinks from the scratch /usr/src and /usr/obj to /home.  I 
mount the old root partition, old /var and /usr etc 
as /mnt, /mnt/usr, /mnt/var, etc.  Then do another 'make installworld 
DESTDIR=/mnt".

Reboot again, still with the amd64 kernel but with the normal root fs.  
Once its up, turn swap back on and reset rc.conf.

Caveat: this is an overview, not a detailed recipe.  I have not done 
this for something like 12 months, so the chances that I've forgotten a 
key point are fairly good.  Don't try this if you're not going to be 
able to get yourself out of a mess.

Historical note:  Sun used the 'fs in swap' thing for their OS boot 
tapes.  They'd boot the tape and copy a dd'ed image into swap and mount 
it.  It probably predates that though, but that was the first I heard 
of it.

BTW: the reason why this is necessary is that the 32 bit emulation is 
aimed at application level syscalls and kernel interfaces.  The moment 
that we get into OS-level binaries, we get exposed to things like the 
mount interface, sysctl binary data and so on.  The task of translating 
that is huge.  Not to mention that static binaries (like /sbin/init) 
won't run due to the i386_userldt syscalls.
 
-- 
Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412030848.54478.peter>