Subject: Re: bootable cdrom
To: None <port-sparc64@NetBSD.org>
From: None <sigsegv@rambler.ru>
List: port-sparc64
Date: 02/11/2005 23:28:19
sigsegv@rambler.ru wrote:
> sigsegv@rambler.ru wrote:
> 
>> Martin Husemann wrote:
>>
>>> I'm not sure I understood your question. To make a bootable single-arch
>>> CD, just go to src/etc and do "make iso-image". If you cross-compiled,
>>> be sure to use ${TOOLDIR}/bin/nbmake-${ARCH} instead of make.
>>>
>>> If you want to create a CD bootable on multiple archs, you may want 
>>> to look
>>> at src/distrib/cdrom.
>>>
>>> Martin
>>>
>>
>> I've tried that, but it fails with something like 'loaded file is not 
>> executable'
>> What I'm trying to do is install 32-bit sparc port (that I've just 
>> built myself) on a 64-bit sun4u machine from a cdrom. Is this 
>> supported, or I'm trying to do something totally insane?
>>
> 
> Maybe I'm going the wrong way about it, on sparc64 web page is says:
> 
> "NetBSD/sparc64 supports both 32-bit and 64-bit kernels. A 32-bit kernel 
> runs all NetBSD/sparc binaries"
> 
> So I guess the question would be: what's the best and correct way to 
> build 32-bit kernel for sparc64 architecture and what's the best way to 
> integrate it with 32-bit userland? Anyone tried this before?
> 

OK after searching on the Internet and experimenting, this is what I had 
to do to create bootable cdrom, containing 32-bit sparc distribution 
sets. This may be worth a how-to or something in FAQs section on sparc64 
web pages.


Obtain the following:

1) MAKEDEV script for sparc64 port, save it as MAKEDEV.sparc64
2) boot.fs boot image for sparc64 port, save it as boot.fs.sparc64
3) Install cdrecord from pkgsrc


Build 32-bit sparc release:

cd /opt/src && ./build.sh -u -m sparc -x -X /opt/xsrc \
         -O /opt/obj.sparc -T /opt/tools.sparc \
         release


Create bootable cdrom, containing 32-bit sparc sets:

mkdir /opt/obj.sparc/releasedir/sparc/tools \
&& cp MAKEDEV.sparc64 /opt/obj.sparc/releasedir/sparc/tools \
&& mkisofs -U -R -o ./sparc.iso /opt/obj.sparc/releasedir \
&& /opt/src/distrib/common/sunbootcd.sh sparc.iso - - - - boot.fs.sparc64 \
&& cdrecord -v dev=/dev/cd0d ./sparc.iso


Boot from cdrom and begin installation via sysinst
When asked where to obtain distribution sets, select cdrom and change:

sparc64/binary/sets to sparc/binary/sets

Once installation is complete, don't reboot, but drop into command line

Mount root filesystem and cdrom:

#depending on which disk you've installed
mount /dev/wd1a /mnt
mount -t cd9660 /dev/cd0a /mnt2


Rebuild devices under /dev (I'm not sure if this is necessary, but 
others recommend doing it):

rm -rf /mnt/dev/[a-z]*
cp /mnt2/sparc/tools/MAKEDEV.sparc64 /mnt/dev/MAKEDEV
cd /mnt/dev
./MAKEDEV all


Install suitable kernel for sun4u architecture, otherwise machine will 
not boot:

cd /mnt2/sparc/binary/kernel
gzip -dc netbsd-GENERIC_SUN4U.gz > /mnt/netbsd


Reboot and try out 32-bit sparc installation:

halt
ok boot disk2:a netbsd

The system seems to boot OK, even though owfboot in root filesystem is a 
64-bit file