Philip Prindeville wrote:
Darrick Hartman (lists) wrote:
Syncing disks.
+ losetup -d /dev/loop0
+ ln -sf /dev/loop0 /dev/loop
+ losetup /dev/loop0 disk.img
+ losetup -o 32256 /dev/loop1 disk.img
ioctl: LOOP_SET_FD: Device or resource busy
+ mke2fs -O sparse_super -L ASTROOT -m0 -q /dev/loop1
/dev/loop1 is mounted; will not make a filesystem here!
+ mkdir -p /mnt/image
+ mount -t ext2 /dev/loop1 /mnt/image
mount: /dev/loop1 already mounted or /mnt/image busy
mount: according to mtab, /dev/loop1 is already mounted on /mnt/image
Looks like you have a self-explanatory error. Unmount whatever you have
mounted on /dev/loop, /dev/loop0 and /dev/loop1 then try again.
Darrick
Sure... but why is the script mounting it twice?
-Philip
Hmmm.... I tweaked the script a little bit, but there are still some
problems with it.
The script is attached. As is run of it as sudo -c "sh -x
./makeimage2.sh 128" makeimage.log
-Philip
Script started on Fri 21 Sep 2007 01:23:47 AM MDT
+
PATH=/sbin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/philipp/bin:/sbin:/usr/sbin:/usr/local/sbin
+ ARCH=i586
+ '[' '!' 0 = 0 ']'
+ '[' '!' 128 ']'
+ SIZE=128
+ '[' '!' -f build_i586/root/etc/rc ']'
+ '[' -f disk.img ']'
+ '[' -d /dev/loop ']'
+ LOOPD=/dev/loop
+ clear
[H[2J+ echo '
This script will create a bootable AstLinux image from the
development environment in this directory. Every care has been
taken to prevent damage to your host operating system, house, etc.
HOWEVER, IT IS ALWAYS POSSIBLE FOR SOMETHING TO GO WRONG. I CAN
NOT GUARANTEE THAT THIS SCRIPT WILL NOT DESTROY YOUR MACHINE OR
ANY DATA ON IT
'
This script will create a bootable AstLinux image from the
development environment in this directory. Every care has been
taken to prevent damage to your host operating system, house, etc.
HOWEVER, IT IS ALWAYS POSSIBLE FOR SOMETHING TO GO WRONG. I CAN
NOT GUARANTEE THAT THIS SCRIPT WILL NOT DESTROY YOUR MACHINE OR
ANY DATA ON IT
+ echo 'Press enter to continue, or CTRL+C to exit'
Press enter to continue, or CTRL+C to exit
+ read
+ echo 'Would you like me to aggresively strip everything in your image?
This can save as much as 10mb.'
Would you like me to aggresively strip everything in your image?
This can save as much as 10mb.
+ echo 'Please answer yes or no'
Please answer yes or no
+ read -p 'Strip: ' RESPONSE
Strip: no
+ '[' no = yes ']'
+ echo 'Stripping declined'
Stripping declined
+ echo '
You will need to write down the number of cylinders, heads, and
sectors for fdisk. Bad things happen if you mess this up!
'
You will need to write down the number of cylinders, heads, and
sectors for fdisk. Bad things happen if you mess this up!
+ ./bximage -q -hd -mode=flat -size=128 disk.img
========================================================================
bximage
Disk Image Creation Tool for Bochs
$Id: bximage.c,v 1.31 2005/11/20 20:26:35 vruppert Exp $
========================================================================
I will create a 'flat' hard disk image with
cyl=260
heads=16
sectors per track=63
total sectors=262080
total size=127.97 megabytes
Writing: [] Done.
I wrote 134184960 bytes to disk.img.
The following line should appear in your bochsrc:
ata0-master: type=disk, path="disk.img", mode=flat, cylinders=260, heads=16,
spt=63
+ losetup /dev/loop0 disk.img
+ CYL=260
+ sfdisk /dev/loop0 -H16 -S63
Checking that no-one is using this disk right now ...
BLKRRPART: Invalid argument
OK
Disk /dev/loop0: cannot get geometry
Disk /dev/loop0: 260 cylinders, 16 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/loop0: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/loop0p1 * 0+ 259 260- 131039+ 5 Extended
/dev/loop0p2 0 - 0 0 0 Empty
/dev/loop0p3 0 - 0 0 0 Empty
/dev/loop0p4 0 - 0 0 0 Empty
Successfully wrote the new partition table
Re-reading the partition table ...
BLKRRPART: Invalid argument
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
+ dd if=/dev/zero of=/dev/loop0 bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000161 seconds, 3.2 MB/s
+ losetup -d /dev/loop0
+ losetup -o 32256 /dev/loop1 disk.img
+ mke2fs -O sparse_super -L ASTROOT -m0 -q /dev/loop1
+ mkdir -p /mnt/image
+ mount -t ext2 /dev/loop1 /mnt/image
+ cp -a build_i586/root/bin build_i586/root/boot build_i586/root/dev
build_i586/root/etc build_i586/root/home build_i586/root/lib
build_i586/root/lost+found build_i586/root/mnt build_i586/root/oldroot
build_i586/root/opt build_i586/root/proc build_i586/root/root
build_i586/root/sbin build_i586/root/stat build_i586/root/sys
build_i586/root/tftpboot build_i586/root/tmp build_i586/root/usr
build_i586/root/var /mnt/image/
+ tar -xz -C /mnt/image/ -f target/generic/dev.tar.gz
+ tar -xz -C /mnt/image/stat/ -f target/generic/dev.tar.gz
+ chown -Rh root:root /mnt/image
+ chmod 4755 /mnt/image/bin/busybox
+ echo 'Do it...'
Do it...
+ grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> device (hd0) /dev/loop1
grub> root (hd0,0)
Unknown partition table signature
Error 5: Partition table invalid or corrupt
grub> setup (hd0)
Error 12: Invalid device requested
grub> quit
+ umount /mnt/image
+ losetup -d /dev/loop1
+ echo Done.
Done.
Script done on Fri 21 Sep 2007 01:24:00 AM MDT
#!/bin/bash
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
ARCH=i586
if [ ! $UID = 0 ]
then
echo "You need to be root to run this script (for now)"
exit 1
fi
if [ ! $1 ]
then
echo "Usage:
$0 [imagesize in megabytes]
"
exit 1
fi
SIZE=$1
if [ ! -f build_$ARCH/root/etc/rc ]
then
echo "It doesn't look like you have built AstLinux yet.
You need to run make first. For more help please visit
http://www.astlinux.org
"
exit 1
fi
if [ -f disk.img ]
then
echo "You already have a disk.img - exiting"
exit 0
fi
if [ -d /dev/loop ]
then
LOOPD=/dev/loop/
else
LOOPD=/dev/loop
fi
clear
echo "
This script will create a bootable AstLinux image from the
development environment in this directory. Every care has been
taken to prevent damage to your host operating system, house, etc.
HOWEVER, IT IS ALWAYS POSSIBLE FOR SOMETHING TO GO WRONG. I CAN
NOT GUARANTEE THAT THIS SCRIPT WILL NOT DESTROY YOUR MACHINE OR
ANY DATA ON IT
"
echo "Press enter to continue, or CTRL+C to exit"
read
echo "Would you like me to aggresively strip everything in your image?
This can save as much as 10mb."
echo "Please answer yes or no"
read -p "Strip: " RESPONSE
if [ "$RESPONSE" = "yes" ]
then
STRIP=build_$ARCH/staging_dir/bin/$ARCH-linux-strip
for i in lib usr/lib
do
find build_$ARCH/root/$i -name \*.la -o -name \*.a | xargs rm
build_$ARCH/root/$i/
done
for i in bin sbin usr/bin usr/sbin lib usr/lib usr/lib/asterisk/modules
do
find build_$ARCH/root/$i -type f | xargs $STRIP -g build_$ARCH/root/$i/
done
else
echo "Stripping declined"
fi
# dd if=/dev/zero of=disk.img bs=1024k count=$SIZE
echo "
You will need to write down the number of cylinders, heads, and
sectors for fdisk. Bad things happen if you mess this up!
"
./bximage -q -hd -mode=flat -size=$SIZE disk.img
losetup ${LOOPD}0 disk.img
CYL=$(( $SIZE * 1048576 / ( 63 * 16 * 512 ) ))
sfdisk ${LOOPD}0 -H16 -S63 <<EOF
,$CYL,5,*
;
EOF
dd if=/dev/zero of=${LOOPD}0 bs=512 count=1
losetup -d ${LOOPD}0
# ln -sf ${LOOPD}0 /dev/loop
# losetup ${LOOPD}0 disk.img
losetup -o 32256 ${LOOPD}1 disk.img
mke2fs -O sparse_super -L ASTROOT -m0 -q ${LOOPD}1
mkdir -p /mnt/image
mount -t ext2 ${LOOPD}1 /mnt/image
cp -a build_$ARCH/root/* /mnt/image/
tar -xz -C /mnt/image/ -f target/generic/dev.tar.gz
tar -xz -C /mnt/image/stat/ -f target/generic/dev.tar.gz
chown -Rh root:root /mnt/image
chmod 4755 /mnt/image/bin/busybox
echo "Do it..."
grub <<EOF
device (hd0) ${LOOPD}1
root (hd0,0)
setup (hd0)
quit
EOF
umount /mnt/image
# losetup -d ${LOOPD}0
losetup -d ${LOOPD}1
echo Done.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users
Donations to support AstLinux are graciously accepted via PayPal to [EMAIL
PROTECTED]