Re: bootable CDs for mipsel [was: Reading fibmap]
On Wed, May 01, 2002 at 01:02:17AM +0200, Raphael Hertzog wrote:
> Le Tue, Apr 30, 2002 at 11:48:55PM +0200, Karsten Merker écrivait:
>
> That would be cool. There's another thing that does worry me. All cd
> images should be buildable on i386 without root rights.
>
> That is: if you can avoid having to use the loopback mount, it would be
> great.
Unfortunately, as far as I can tell, this is impossible - at least
with the way mkdecbootcd works currently. mkdecbootcd has to generate
a list of the block numbers that the file to boot uses on the target
filesystem (in our case: ISO-9660). This is done using an ioctl from
/usr/include/linux/fs.h which is dependent on the filesystem it is used
on and on the blocksize of that filesystem, so the image has to be
mounted. The only way to do this without loop-mounting the image would
be to do the complete ISO-9660-handling, which is done by the kernel
filesystem layer now, in userspace, which I am currently not able to
do due to lack of knowledge about the ISO-9660/RockRidge internals.
I have appended a new version of my patch with the case differention
between native and non-native builds removed and a hint regarding
binutils-multiarch added. I have rebuilt CD 2 with the new patch,
works fine :-).
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 Wed May 1 10:26:00 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 Wed May 1 10:46:31 2002
@@ -1,11 +1,50 @@
-#!/bin/sh
-
-# Mipsel doesn't have bootable CD support yet.
+#!/bin/bash
+#
+# boot-mipsel - (C) 2002 by Karsten Merker <merker@debian.org>
#
-# This file must however exist so that debian-cd doesn't complain about
-# lack of "bootable" support.
+# You may copy, modify and distribute this under the terms of the GNU
+# General Public License as published by the Free Software Foundation;
+# either version 2 of the License, or (at your option) any later version.
#
-# -- Raphaël Hertzog
+# Using this script on any architecture other than mipsel requires
+# having binutils-multiarch installed, as it uses objcopy (a part
+# of binutils) which is platform dependent. The binutils-multiarch
+# package contains an objcopy which is capable of dealing with other
+# arches' binary formats.
+#
+# $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
+#
+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
+
+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 Wed May 1 10:49:15 2002
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# post-boot-mipsel - (C) 2002 by Karsten Merker <merker@debian.org>
+#
+# Do post-image-building tasks for mipsel, to make CDs bootable.
+#
+# You may copy, modify and distribute this under the terms of the GNU
+# General Public License as published by the Free Software Foundation;
+# either version 2 of the License, or (at your option) any later version.
+#
+# Using this script on any architecture other than mipsel requires
+# having binutils-multiarch installed, as it uses objdump (a part
+# of binutils) which is platform dependent. The binutils-multiarch
+# package contains an objdump which is capable of dealing with other
+# arches' binary formats.
+#
+# $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]=""
+
+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: