[readonly/geninitrd/BUSYBOX: 4/113] - added cramfs support (untested)

draenog draenog at pld-linux.org
Sat Nov 2 19:10:21 CET 2013


commit 8b1e4ac70b133a425f323b3d0150b4c44729a12d
Author: Artur Frysiak <artur at frysiak.net>
Date:   Tue Nov 14 14:19:58 2000 +0000

    - added cramfs support (untested)
    
    
    svn-id: @1156

 geninitrd   | 60 +++++++++++++++++++++++++++++++++++++++++++-----------------
 geninitrd.8 | 16 ++++++++--------
 2 files changed, 51 insertions(+), 25 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index e0f673a..6c4e745 100755
--- a/geninitrd
+++ b/geninitrd
@@ -50,7 +50,7 @@ fstab="/etc/fstab"
 usage () {
     echo "usage: `basename $0` [--version] [-v] [-f] [--ifneeded] [--preload <module>]" >&2
     echo "       [--omit-scsi-modules] [--omit-raid-modules] [--omit-ide-modules] [--with=<module>]" >&2
-    echo "       [--image-version] [--fstab=<fstab>] [--nocompress] [--fs=rom|ext2]" >&2
+    echo "       [--image-version] [--fstab=<fstab>] [--nocompress] [--fs=rom|ext2|cram]" >&2
     echo "       <initrd-image> <kernel-version>" >&2
     echo "       (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)" >&2
     exit 1
@@ -207,9 +207,30 @@ while [ $# -gt 0 ]; do
     shift
 done
 
-if [ "$FS" != "ext2" -a "$FS" != "rom" ] ; then
-    echo "Only ext2 and rom fs are supported!"
-fi
+case "$FS" in
+	ext2)
+		if [ ! -x /sbin/losetup ]; then
+			echo "losetup is missing"
+			exit 1
+		fi
+		;;
+	rom)
+		if [ ! -x /sbin/genromfs ]; then
+			echo "genromfs is missing"
+			exit 1
+		fi
+		;;
+	cram)
+		if [ ! -x /sbin/mkcramfs ]; then
+			echo "mkcramfs is missing"
+			exit 1
+		fi
+		 ;;
+	*)
+		echo "Filesystem $FS not supported"
+		exit 1
+		;;
+esac
 
 if [ -z "$target" -o -z "$kernel" ]; then
     usage
@@ -366,12 +387,9 @@ else
 	mkdir -p $MNTPOINT
 fi
 
-mkdir -p $MNTIMAGE
-mkdir -p $MNTIMAGE/lib
-mkdir -p $MNTIMAGE/bin
-mkdir -p $MNTIMAGE/etc
-mkdir -p $MNTIMAGE/dev
-mkdir -p $MNTIMAGE/loopfs
+
+mkdir -p $MNTIMAGE/{lib,bin,etc,dev,loopfs}
+
 
 # We don't need this directory, so let's save space
 rm -rf $MNTPOINT/lost+found
@@ -425,13 +443,21 @@ chmod +x $RCFILE
 
 (cd $MNTIMAGE; tar cf - .) | (cd $MNTPOINT; tar xf -)
 
-if [ "$FS" = "ext2" ] ; then
-	mount $MNTPOINT
-	losetup -d $LODEV
-else
-	genromfs -f "$IMAGE" -d "$MNTPOINT" -V "PLD initrd for kernel $kernel"
-	
-fi
+case "$FS" in
+	ext2)
+		mount $MNTPOINT
+		losetup -d $LODEV
+		;;
+	rom)
+		genromfs -f "$IMAGE" -d "$MNTPOINT" -V "PLD initrd for kernel $kernel"
+		;;
+	cram)
+		mkcramfs "$MNTPOINT" "$IMAGE"
+		COMPRESS=no
+		;;
+	*)
+		echo "Filesystem $FS not supported by $0";
+esac		
 
 if is_yes "$COMPRESS" ; then
     gzip -9 < $IMAGE > $target
diff --git a/geninitrd.8 b/geninitrd.8
index cc1abb5..e6790b5 100644
--- a/geninitrd.8
+++ b/geninitrd.8
@@ -1,12 +1,12 @@
-.TH MKINITRD 8 "Sat Mar 27 1999"
+.TH MKINITRD 8 "Thu Nov 14 2000"
 .UC 4
 .SH NAME
 mkinitrd \- creates initial ramdisk images for preloading modules
 .SH SYNOPSIS
 \fBmkinitrd\fR [-fv] [--with=\fImodule\fR] [--preload=\fImodule\fR] 
-         [--omit-scsi-modules] [--omit-raid-modules]
-	 [--omit-ide-modules] [--version] [--fstab=\fIfstab\fR]
-	 [--fs=rom|ext2] \fIimage\fR \fIkernel-version\fR
+[--omit-scsi-modules] [--omit-raid-modules]
+[--omit-ide-modules] [--version] [--fstab=\fIfstab\fR]
+[--fs=rom|ext2|cram] \fIimage\fR \fIkernel-version\fR
 .SH DESCRIPTION
 \fBmkinitrd\fR creates filesystem images which are suitable for use
 as Linux initial ramdisk (initrd) images. Such images are often
@@ -27,7 +27,7 @@ If the root device is on a loop device (such as /dev/loop0), \fBmkinitrd\fR
 will attempt to build an initrd which sets up the loopback file properly.
 To do this, the fstab must contain a comment of the form:
 
-    # LOOP0: /dev/hda1 vfat /linux/rootfs
+# LOOP0: /dev/hda1 vfat /linux/rootfs
 
 LOOP0 must be the name of the loop device which needs to be configured, in
 all capital lettes. The parameters after the color are the device which 
@@ -86,9 +86,9 @@ gets loaded after any SCSI modules which are specified in
 necessary.
 
 .TP
-\fB-\-fs=\fBext2\fR|\fBrom\fR
-Filesystem type to be used for the image. Only the romfs should always be
-kompiled into kernel.
+\fB-\-fs=\fBext2\fR|\fBrom\fR|\fBcram\fR
+Filesystem type to be used for the image. Only selected filesystem
+should always be compiled into kernel.
 
 .SH FILES
 .PD 0
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/0999a53e93eedcf489380684b998ce04aaddf11c



More information about the pld-cvs-commit mailing list