Re: bootable CDs for mipsel [was: Reading fibmap]
On Sun, Apr 28, 2002 at 06:45:39PM +0200, Florian Lohoff wrote:
> On Sun, Apr 28, 2002 at 06:26:00PM +0200, Karsten Merker wrote:
> > - bootfile: the file in the cdimage (e.g. /mnt/cdboot/tftpimage-r3k-kn02.raw)
> > - cdimage: the cdimage file itself
> > - kernel_entry: the value of the kernel_entry label, which is
> > for r3k-kn02: 0x80040464
> > for r4k-kn04: 0x8004046c
>
> This can change from compile to compile - Better to extract the symbol
> from the binary - Should be possible for ecoffs and ELFs.
Ok, I should have made that clearer - these are only the values for
the images in the current bf-3.0.22 in the archive. Of course they
have to be taken from the image actually in use.
> -----------------------------------------------------------------
> revamp:~# objdump -x /boot/vmlinux-2.4.16-r4k-ip22
>
> /boot/vmlinux-2.4.16-r4k-ip22: file format ecoff-bigmips
> /boot/vmlinux-2.4.16-r4k-ip22
> architecture: mips:3000, flags 0x00000002:
> EXEC_P
> start address 0x000000008800246c
Thanks for the hint - "objdump -f image" does in fact what we need.
I had tried "objdump -t image" which failed with a "no symbols".
I have tried to write a post-boot-mipsel script (by looking at
the post-boot-hppa script) that automatically generates the
bootsector with the information from objdump.
If I start the script by hand, everything works fine, but when
called from the Makfile target bin-image, it seems that it does
not get called with proper parameters. Maybe I am just too sleepy
now, but from a first glace at the Makefile, it looks to me as
if calling the post-boot-<arch> scripts from the bin-image target
could never have worked. I would be very grateful if somebody
with a bit knowledge about the debian-cd Makefile could take a look
at this - please compare the bin-image with the bin-images target.
I have attached my (currrent) post-boot-mipsel script to this mail.
Regards (and good night :-),
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.
#!/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 "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: