Using getext2fs instead of a loop mount

This commit is contained in:
Pierre Pronchery 2009-04-13 19:13:27 +00:00
parent 5900ff7266
commit d5ae0e66d3
3 changed files with 37 additions and 35 deletions

View File

@ -3,6 +3,7 @@
#variables
[ -z "$DU" ] && DU="du -h"
[ -z "$GZIP" ] && GZIP="gzip -9"
[ -z "$KERNEL" ]&& KERNEL="/boot/vmlinuz"
@ -14,3 +15,20 @@
[ -z "$TAR" ] && TAR="tar"
[ -z "$TUNE2FS" ]&& TUNE2FS="tune2fs"
[ -z "$UMOUNT" ]&& UMOUNT="$SUDO umount"
#functions
#private
#create_directories
_create_directories()
{
echo
echo -n "Creating missing directories:"
while true; do
echo -n " $1"
$MKDIR "$DESTDIR/$1" || exit 2
shift || break
done
echo
}

View File

@ -14,20 +14,6 @@ source "`dirname $0`/Apps/Devel/src/scripts/targets/Linux"
#functions
#private
#create_directories
_create_directories()
{
echo
echo -n "Creating missing directories:"
while true; do
echo -n " $1"
$MKDIR "$DESTDIR/$1" || exit 2
shift || break
done
echo
}
#image_ramdisk
_image_ramdisk()
{

View File

@ -5,6 +5,7 @@
#variables
#XXX insert i386-specific variables here (grub...)
[ -z "$GENEXT2FS" ] && GENEXT2FS="genext2fs"
#includes
@ -49,10 +50,8 @@ _image_iso()
#sanity check
check "$USAGE" DESTDIR KERNEL IMAGE_FILE IMAGE_KERNEL INSTALL MKDIR \
MKISOFS MOUNT RAMDISK TAR UMOUNT
MKISOFS RAMDISK TAR
$MKDIR "$DESTDIR" || exit 2
target "install" || exit 2
$MKDIR "$DESTDIR/boot/grub" || exit 2
$INSTALL -m 644 "/usr/lib/grub/i386-pc/stage2_eltorito" \
"$DESTDIR/boot/grub" || exit 2
@ -82,30 +81,29 @@ _image_ramdisk()
USAGE="Options for $IMAGE_TYPE on $TARGET:\n\
IMAGE_FILE Where to write the filesystem image\n\
IMAGE_SIZE Size of the filesystem image in kilobytes\n\
MKFS Command used to format the ramdisk image\n\
MOUNTPOINT Path where to temporarily mount the ramdisk image"
GENEXT2FS Command used to generate the ramdisk image"
#sanity check
check "$USAGE" DD DEVZERO DU GZIP IMAGE_FILE IMAGE_SIZE INSTALL LN \
MKDIR MKFS MOUNTPOINT MV UMOUNT
check "$USAGE" DD DESTDIR DEVZERO DU GENEXT2FS GZIP IMAGE_FILE \
IMAGE_SIZE INSTALL LN MKDIR MKFS MV
$MKDIR "$MOUNTPOINT"
$UMOUNT "$MOUNTPOINT"
$DD if="$DEVZERO" of="$IMAGE_FILE" count="$IMAGE_SIZE" || exit 2
$MKFS "$IMAGE_FILE" || exit 2
[ ! -z "$TUNE2FS" ] && $TUNE2FS -i 0 "$IMAGE_FILE"
#FIXME umount on subsequent failures
$MOUNT "$IMAGE_FILE" "$MOUNTPOINT" || exit 2
$MKDIR "$DESTDIR" || exit 2
target "install" || exit 2
#compile and install linuxrc
SUBDIRS="Apps/Unix/src/others/tools" target linuxrc || exit 2
TOOLS="Apps/Unix/src/others/tools"
SUBDIRS="$TOOLS" target linuxrc || exit 2
$INSTALL -m 755 "$TOOLS/linuxrc" "$DESTDIR/linuxrc" || exit 2
DESTDIR="$MOUNTPOINT" _create_directories "dev" "proc" "mnt/cdrom" \
"sbin"
$LN "../mnt/cdrom/usr/bin/sh" "$MOUNTPOINT/sbin/init"
$INSTALL -m 755 "Apps/Unix/src/others/tools/linuxrc" \
"$MOUNTPOINT/linuxrc" || exit 2
$UMOUNT "$MOUNTPOINT"
#setup init
_create_directories "dev" "proc" "mnt/cdrom" "sbin" || exit 2
$LN -s "../mnt/cdrom/usr/bin/sh" "$DESTDIR/sbin/init" || exit 2
echo
echo -n "Creating ramdisk:"
$GENEXT2FS -r 0 -b "$IMAGE_SIZE" -d "$DESTDIR" "$IMAGE_FILE"
echo
$DU "$IMAGE_FILE"
echo
echo -n "Compressing ramdisk:"