SPARC iso9660 boot loader loading alternative OS?

John Baldwin jhb at freebsd.org
Tue Oct 25 10:31:24 PDT 2005


On Tuesday 25 October 2005 04:21 am, Jakub Jermar wrote:
> Hi,
>
> I am looking for a suitable bootloader for my school
> operating system kernel. I came across to FreeBSD and tried
> to produce a bootable CD.
>
> I downloaded 5.4-RELEASE-sparc64-bootonly.iso, replaced
> FreeBSD kernel with my own and produced iso9660 image like this:
>
> mkisofs -f -G root/boot/boot1 -B ... -r -o image.iso root/
>
> When I try to boot it, I get a message like this:
>  >> FreeBSD/sparc64 boot block
>
>     Boot path:   /sbus at 3,0/SUNW,fas at 3,8800000/sd at 6,0:f
>     Boot loader: /boot/loader
> Not ufs
> mount: can't read superblock
> panic: mount
> Program terminated
> ok
>
> I guess the ISO image is missing something. Can you help me
> and say what am I doing wrong?

The cdboot doesn't actually load the /boot/loader from the CD, it 
loads /boot/loader out of a UFS image on the CD and the loader loads the 
kernel.  You can look in src/release/sparc64 to find the script that creates 
the sparc64 ISO images.

Alternatively, here's some csh shell script code that I use to build release 
ISOs:

#!/bin/csh
#
# Script to build an ISO image

# check for required variables
if ( ! $?DISC_NUMBER ) then
	echo "Disc Number not specified"
	exit 1
endif
if ( ! $?WORK_DIR ) then
	echo "Release work directory not set"
	exit 1
endif
if ( ! $?RELEASE ) then
	echo "Release Name not set"
	exit 1
endif
if ( ! $?CD_DIR ) then
	echo "Destination directory not set"
	exit 1
endif

# set variables
if ( ! $?ARCH ) set ARCH=`uname -m`
setenv APPLICATION "FreeBSD ${RELEASE}"
setenv CD_BOOT_FLAGS ""
set VOLUME_ID="${APPLICATION} Disc ${DISC_NUMBER}"
set DISC=disc${DISC_NUMBER}
if ( ! $?ISO_SUFFIX ) then
	set ISO_SUFFIX=""
endif
if ( $?ISO_ARCH_NAME ) then
	set ISO=${CD_DIR}/${RELEASE}-${DISC}-${ARCH}${ISO_SUFFIX}.iso
else
	set ISO=${CD_DIR}/${RELEASE}-${DISC}${ISO_SUFFIX}.iso
endif
if ( ! $?PUBLISHER ) then
	setenv PUBLISHER "John Baldwin / http://www.FreeBSD.org/~jhb"
endif
if ( ! $?PREPARER ) then
	setenv PREPARER "John Baldwin / jhb at FreeBSD.org"
endif

# setup boot options
if ( $ARCH == i386 ) then
	setenv CD_BOOT_FLAGS "-b boot/cdboot -no-emul-boot"
else if ( $ARCH == sparc64 ) then
	set BOOTFS=/tmp/bootfs_image.$$
	set MNT=/tmp/bootfs_mount.$$
	dd if=/dev/zero of=${BOOTFS} bs=512 count=1024
	set MD=`mdconfig -a -t vnode -f ${BOOTFS}`
	disklabel -Brw ${MD} auto
	newfs /dev/${MD}c
	mkdir -p ${MNT}
	mount /dev/${MD}c ${MNT}
	mkdir ${MNT}/boot
	cp ${WORK_DIR}/R/cdrom/${DISC}/boot/loader ${MNT}/boot
	umount ${MNT}
	rmdir ${MNT}
	mdconfig -d -u ${MD:s/md//}
	setenv CD_BOOT_FLAGS "-B ,,,,${BOOTFS}"
endif

echo "---> Generating ISO" `basename ${ISO}`
mkdir -p ${CD_DIR}
mkisofs -J -p "${PREPARER}" -P "${PUBLISHER}" -r -A "${APPLICATION}" \
    ${CD_BOOT_FLAGS} -V "${VOLUME_ID}" -o ${ISO} ${WORK_DIR}/R/cdrom/${DISC} 
$*

if ( $ARCH == alpha ) then
	setcdboot ${ISO} boot/cdboot
else if ( $ARCH == sparc64 ) then
	rm -f ${BOOTFS}
endif

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-sparc64 mailing list