[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bootable CDs for mipsel [was: Reading fibmap]



On Tue, Apr 30, 2002 at 06:03:03PM +0200, Florian Lohoff wrote:
> On Tue, Apr 30, 2002 at 04:57:28PM +0100, Philip Hands wrote:
> > On Sun, 2002-04-28 at 17:26, Karsten Merker wrote:
> > > I have attached a /usr/share/debian-cd/tools/boot/woody/boot-mipsel
> > ...
> > > Running this script requires objcopy (part of binutils), or, when
> > > not running on mipsel, mipsel-linux-objcopy (objcopy ist platform
> > > specific, so for creating a bootable mipsel CD on i386 you need
> > > installed mipsel-cross-binutils).
> > 
> > So, where can I find this (for i386)?  
> > 
> 
> There is no solution yet ... Ignore bootable cds for mips and mipsel 
> for now - We have to do some work on the boot-loaders.

Flo - this is not true. With the appended small patch to debian-cd
2.2.14 (which also corrects a bug in current debian-cd regarding 
the handling of the post-boot-scripts, which affects bootable CDs 
on alpha, hppa and ppc, please see bug #145318) building bootable 
mipsel CDs works like a charm. 
I have built a full set of woody CDs for mipsel with it using 
"make bin-images", and as an additional test I have built the 
first two CDs (the bootable ones) with "make bin-image CD=x". 
Booting works fine (tested only on r4k-kn04 as I have no
firmware-supported cdrom drive for my r3k-kn02 box).
I would appreciate very much if the debian-cd folks would accept
my patch.

Regards,
Karsten
-- 
#include <standard_disclaimer>
Nach Paragraph 28 Abs. 3 Bundesdatenschutzgesetz widerspreche ich der Nutzung
oder Uebermittlung meiner Daten fuer Werbezwecke oder fuer die Markt- oder
Meinungsforschung.
diff -Nur debian-cd-2.2.14/Makefile debian-cd-2.2.14.patched/Makefile
--- debian-cd-2.2.14/Makefile	Tue Apr 23 23:29:33 2002
+++ debian-cd-2.2.14.patched/Makefile	Tue Apr 30 16:47:35 2002
@@ -893,10 +893,11 @@
 	 volid=`cat $(CD).volid`; rm -f $(OUT)/$(CODENAME)-$(ARCH)-$(CD).raw; \
 	 $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \
 	  -o $(OUT)/$(CODENAME)-$(ARCH)-$(CD).raw $$opts CD$(CD); \
-	 if [ -f $(BASEDIR)/tools/boot/$(CODENAME)/post-boot-$(ARCH) ]; then \
-		$(BASEDIR)/tools/boot/$(CODENAME)/post-boot-$(ARCH) $$n $$dir \
-		 $(OUT)/$(CODENAME)-$(ARCH)-$$n.raw; \
-	 fi
+         if [ -f $(BASEDIR)/tools/boot/$(CODENAME)/post-boot-$(ARCH) ]; then \
+                $(BASEDIR)/tools/boot/$(CODENAME)/post-boot-$(ARCH) $(CD) $(BDIR)/CD$(CD) \
+                 $(OUT)/$(CODENAME)-$(ARCH)-$(CD).raw; \
+         fi
+
 src-image: ok src-md5list $(OUT)
 	@echo "Generating the source iso image n°$(CD) ..."
 	@test -n "$(CD)" || (echo "Give me a CD=<num> parameter !" && false)
diff -Nur debian-cd-2.2.14/tools/boot/woody/boot-mipsel debian-cd-2.2.14.patched/tools/boot/woody/boot-mipsel
--- debian-cd-2.2.14/tools/boot/woody/boot-mipsel	Mon Apr 22 21:45:50 2002
+++ debian-cd-2.2.14.patched/tools/boot/woody/boot-mipsel	Tue Apr 30 16:47:54 2002
@@ -1,11 +1,49 @@
-#!/bin/sh
-
-# Mipsel doesn't have bootable CD support yet.
+#!/bin/bash
+#
+# boot-mipsel
 #
-# This file must however exist so that debian-cd doesn't complain about
-# lack of "bootable" support.
+# $1 is the CD number
+# $2 is the temporary CD build dir
+
+N=$1
+CDROOT=$2
+
+# Strip NONUS part of disk number
+# NN will be 1...N so it can be used as an index
 #
-# -- Raphaël Hertzog
+NN=`echo $N | sed -e 's/_NONUS//'`
+
+cd $CDROOT/..
+
+:> $1.mkisofs_opts
+
+KTYPE[1]="r3k-kn02"
+KTYPE[2]="r4k-kn04"
+KTYPE[3]=""
+KTYPE[4]=""
+KTYPE[5]=""
+KTYPE[6]=""
+KTYPE[7]=""
+KTYPE[8]=""
+
+
+# Only disks 1 and 2 bootable
+if [ $NN != 1 -a $NN != 2 ]; then
+	exit 0
+fi
+
+mkdir -p $CDROOT/cdboot
+
+# If we are running natively, use objcopy, else use mipsel-linux-objcopy
+# from the cross-binutils
+HOSTARCH=`dpkg --print-installation-architecture`
+if [ $HOSTARCH = "mipsel" ]; then
+	OBJCOPY=objcopy
+else
+	OBJCOPY=mipsel-linux-objcopy
+fi
+
+$OBJCOPY -O binary CD1/dists/$CODENAME/main/disks-$ARCH/current/tftpimage-${KTYPE[$NN]} $CDROOT/cdboot/tftpimage-${KTYPE[$NN]}.raw
 
 exit 0
 
diff -Nur debian-cd-2.2.14/tools/boot/woody/post-boot-mipsel debian-cd-2.2.14.patched/tools/boot/woody/post-boot-mipsel
--- debian-cd-2.2.14/tools/boot/woody/post-boot-mipsel	Thu Jan  1 01:00:00 1970
+++ debian-cd-2.2.14.patched/tools/boot/woody/post-boot-mipsel	Tue Apr 30 16:51:27 2002
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# post-boot-mipsel
+#
+# Do post-image-building tasks for mipsel, to make CDs bootable.
+#
+# $1 is the CD number
+# $2 is the temporary CD build dir
+# $3 is the image file
+
+set -e
+
+N=$1
+CDROOT=$2
+CDIMAGE=$3
+
+echo "post-boot-mipsel called"
+echo "pwd=${PWD}, N=$N, CDROOT=${CDROOT}, CDIMAGE=${CDIMAGE}"
+
+
+# Strip NONUS part of disk number
+# NN will be 1...N so it can be used as an index
+#
+NN=`echo $N | sed -e 's/_NONUS//'`
+
+cd $CDROOT/..
+
+# Only disks 1 and 2 bootable
+if [ $NN != 1 -a $NN != 2 ]; then
+        exit 0
+fi
+
+KTYPE[1]="r3k-kn02"
+KTYPE[2]="r4k-kn04"
+KTYPE[3]=""
+KTYPE[4]=""
+KTYPE[5]=""
+KTYPE[6]=""
+KTYPE[7]=""
+KTYPE[8]=""
+
+# If we are running natively, use objdump, else use mipsel-linux-objdump
+# from the cross-binutils
+HOSTARCH=`dpkg --print-installation-architecture`
+if [ $HOSTARCH = "mipsel" ]; then
+        OBJDUMP=objdump
+else
+        OBJDUMP=mipsel-linux-objdump
+fi
+
+
+mkdir -p /tmp/debian-cd-loop.$$
+mount -o ro,loop ${CDIMAGE} /tmp/debian-cd-loop.$$
+KERNEL_ENTRY=`$OBJDUMP -f CD1/dists/$CODENAME/main/disks-$ARCH/current/tftpimage-${KTYPE[$NN]} | grep "start address" | cut -f 3 -d " "`
+echo "kernel_entry=$KERNEL_ENTRY"
+mkdecbootcd /tmp/debian-cd-loop.$$/cdboot/tftpimage-${KTYPE[$NN]}.raw ${CDIMAGE} $KERNEL_ENTRY
+umount /tmp/debian-cd-loop.$$
+rmdir /tmp/debian-cd-loop.$$
+
+exit 0

Reply to: