Using getext2fs instead of a loop mount
This commit is contained in:
parent
5900ff7266
commit
d5ae0e66d3
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#variables
|
||||||
[ -z "$DU" ] && DU="du -h"
|
[ -z "$DU" ] && DU="du -h"
|
||||||
[ -z "$GZIP" ] && GZIP="gzip -9"
|
[ -z "$GZIP" ] && GZIP="gzip -9"
|
||||||
[ -z "$KERNEL" ]&& KERNEL="/boot/vmlinuz"
|
[ -z "$KERNEL" ]&& KERNEL="/boot/vmlinuz"
|
||||||
|
@ -14,3 +15,20 @@
|
||||||
[ -z "$TAR" ] && TAR="tar"
|
[ -z "$TAR" ] && TAR="tar"
|
||||||
[ -z "$TUNE2FS" ]&& TUNE2FS="tune2fs"
|
[ -z "$TUNE2FS" ]&& TUNE2FS="tune2fs"
|
||||||
[ -z "$UMOUNT" ]&& UMOUNT="$SUDO umount"
|
[ -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
|
||||||
|
}
|
||||||
|
|
|
@ -14,20 +14,6 @@ source "`dirname $0`/Apps/Devel/src/scripts/targets/Linux"
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
#private
|
#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
|
||||||
_image_ramdisk()
|
_image_ramdisk()
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
#XXX insert i386-specific variables here (grub...)
|
#XXX insert i386-specific variables here (grub...)
|
||||||
|
[ -z "$GENEXT2FS" ] && GENEXT2FS="genext2fs"
|
||||||
|
|
||||||
|
|
||||||
#includes
|
#includes
|
||||||
|
@ -49,10 +50,8 @@ _image_iso()
|
||||||
|
|
||||||
#sanity check
|
#sanity check
|
||||||
check "$USAGE" DESTDIR KERNEL IMAGE_FILE IMAGE_KERNEL INSTALL MKDIR \
|
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
|
$MKDIR "$DESTDIR/boot/grub" || exit 2
|
||||||
$INSTALL -m 644 "/usr/lib/grub/i386-pc/stage2_eltorito" \
|
$INSTALL -m 644 "/usr/lib/grub/i386-pc/stage2_eltorito" \
|
||||||
"$DESTDIR/boot/grub" || exit 2
|
"$DESTDIR/boot/grub" || exit 2
|
||||||
|
@ -82,30 +81,29 @@ _image_ramdisk()
|
||||||
USAGE="Options for $IMAGE_TYPE on $TARGET:\n\
|
USAGE="Options for $IMAGE_TYPE on $TARGET:\n\
|
||||||
IMAGE_FILE Where to write the filesystem image\n\
|
IMAGE_FILE Where to write the filesystem image\n\
|
||||||
IMAGE_SIZE Size of the filesystem image in kilobytes\n\
|
IMAGE_SIZE Size of the filesystem image in kilobytes\n\
|
||||||
MKFS Command used to format the ramdisk image\n\
|
GENEXT2FS Command used to generate the ramdisk image"
|
||||||
MOUNTPOINT Path where to temporarily mount the ramdisk image"
|
|
||||||
|
|
||||||
#sanity check
|
#sanity check
|
||||||
check "$USAGE" DD DEVZERO DU GZIP IMAGE_FILE IMAGE_SIZE INSTALL LN \
|
check "$USAGE" DD DESTDIR DEVZERO DU GENEXT2FS GZIP IMAGE_FILE \
|
||||||
MKDIR MKFS MOUNTPOINT MV UMOUNT
|
IMAGE_SIZE INSTALL LN MKDIR MKFS MV
|
||||||
|
|
||||||
$MKDIR "$MOUNTPOINT"
|
$MKDIR "$DESTDIR" || exit 2
|
||||||
$UMOUNT "$MOUNTPOINT"
|
target "install" || exit 2
|
||||||
$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
|
|
||||||
|
|
||||||
#compile and install linuxrc
|
#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" \
|
#setup init
|
||||||
"sbin"
|
_create_directories "dev" "proc" "mnt/cdrom" "sbin" || exit 2
|
||||||
$LN "../mnt/cdrom/usr/bin/sh" "$MOUNTPOINT/sbin/init"
|
$LN -s "../mnt/cdrom/usr/bin/sh" "$DESTDIR/sbin/init" || exit 2
|
||||||
$INSTALL -m 755 "Apps/Unix/src/others/tools/linuxrc" \
|
|
||||||
"$MOUNTPOINT/linuxrc" || exit 2
|
echo
|
||||||
$UMOUNT "$MOUNTPOINT"
|
echo -n "Creating ramdisk:"
|
||||||
|
$GENEXT2FS -r 0 -b "$IMAGE_SIZE" -d "$DESTDIR" "$IMAGE_FILE"
|
||||||
|
echo
|
||||||
|
$DU "$IMAGE_FILE"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo -n "Compressing ramdisk:"
|
echo -n "Compressing ramdisk:"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user