]> git.pld-linux.org Git - projects/geninitrd.git/blobdiff - geninitrd
no need to mess with magic values, let the "magic" be value
[projects/geninitrd.git] / geninitrd
index 73b339f574f6f6742ce9417d4be13d3be9e564f8..bd4f92e69a5749f9f023fcf9927c609acd87a76c 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -7,8 +7,8 @@
 # based on mkinitrd from RedHat Linux
 #
 
-RCSID='$Revision$ $Date$'
-R=${RCSID#* *}; VERSION=${R%% *}
+GENINITRD_RCSID='$Revision$ $Date::                            $'
+R=${GENINITRD_RCSID#* *}; VERSION=${R%% *}
 PROGRAM=${0##*/}
 
 . /etc/rc.d/init.d/functions
@@ -18,6 +18,7 @@ PROGRAM=${0##*/}
 # list of geninitrd modules which need setup routine after commandline args parsing
 GENINITRD_MODS=""
 COMPRESS=yes
+STRIP=/usr/bin/strip
 target=""
 kernel=""
 force=""
@@ -47,6 +48,7 @@ usage() {
        echo "Usage: $PROGRAM [--version] [-v] [-f] [--ifneeded] [--preload <module>]"
        echo "       [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]"
        echo "       [--compress=yes|xz|lzma|bzip2|gzip|lzo]"
+       echo "       [--nostrip ] [--strip PATH/strip] [--strip=PATH/strip]"
        echo "       [--initrdfs=rom|initramfs|ext2|cram] [--modules-conf=<modules.conf>]"
        echo "       [--with-bootsplash] [--without-bootsplash]"
        echo "       [--with-fbsplash] [--without-fbsplash]"
@@ -61,13 +63,12 @@ usage() {
        echo ""
        echo "Example:"
 
-       local kdir kver
+       local kdir kver dir=${target:-/boot}
        for kdir in /lib/modules/*; do
                [ -d $kdir ] || continue
                kver=${kdir##*/}
-               echo "  $PROGRAM -f --initrdfs=rom /boot/initrd-$kver.gz $kver"
-       done
-       exit 0
+               echo "  $0 -f --initrdfs=initramfs $dir/initrd-$kver.gz $kver $verbose"
+       done | sort -V
 }
 
 msg() {
@@ -99,7 +100,7 @@ find_tool() {
                        return 0
                fi
        done
-       debug "find_tool: did not found any of: $@"
+       debug "find_tool: did not find any of: $@"
        return 1
 }
 
@@ -112,19 +113,22 @@ geninitrd_load_mods() {
                fi
                . /lib/geninitrd/mod-$mod.sh
 
-               if type setup_mod_$mod > /dev/null; then
-                       # add to list which need init
-                       GENINITRD_MODS="$GENINITRD_MODS $mod"
-               fi
+               GENINITRD_MODS="$GENINITRD_MODS $mod"
        done
 }
 
 # setup geninitrd modules
 geninitrd_setup_mods() {
-       local mod
+       local mod rcsid
 
        for mod in $GENINITRD_MODS; do
-               eval setup_mod_$mod
+               eval rcsid=$(echo \$$mod | LC_ALL=C tr '[a-z]' '[A-Z]')_RCSID
+               debug "# $rcsid (mod-$mod)"
+
+               # some mods want init
+               if type setup_mod_$mod > /dev/null; then
+                       eval setup_mod_$mod
+               fi
        done
 }
 
@@ -138,11 +142,6 @@ add_linuxrc() {
 # can be called multiple times. /dev is cleaned up (umounted) automatically at
 # the end of script.
 mount_dev() {
-    if [ "$INITRDFS" = "initramfs" ]; then
-               # initramfs is read-write filesystem, no need for tmpfs
-               return
-       fi
-
        # we already generated tmpfs code; return
        if is_yes "$dev_mounted"; then
                return
@@ -153,12 +152,17 @@ mount_dev() {
        busybox_applet mount mknod mkdir
        add_linuxrc <<-EOF
                : 'Creating /dev'
-               mount -o mode=0755 -t tmpfs none /dev
-               mknod /dev/console c 5 1
-               mknod /dev/null c 1 3
-               mknod /dev/zero c 1 5
-               mknod /dev/random c 1 8
-               mknod /dev/urandom c 1 9
+               if ! mount -t devtmpfs -o mode=0755,nosuid devtmpfs /dev > /dev/null 2>&1; then
+                       mount -o mode=0755,nosuid -t tmpfs tmpfs /dev
+                       mknod /dev/console c 5 1
+                       mknod /dev/null c 1 3
+                       mknod /dev/zero c 1 5
+                       mknod /dev/random c 1 8
+                       mknod /dev/snapshot c 10 231
+                       mknod /dev/urandom c 1 9
+                       mknod /dev/ptmx c 5 2
+                       mknod /dev/kmsg c 1 11
+               fi
                mkdir /dev/pts
                mkdir /dev/shm
        EOF
@@ -208,6 +212,17 @@ mount_tmp() {
        echo "mount -t tmpfs none /tmp" | add_linuxrc
 }
 
+# generate code to mount /run on initrd
+# can be called multiple times
+mount_run() {
+       if is_yes "$run_mounted"; then
+               return
+       fi
+
+       run_mounted=yes
+       echo "mount -t tmpfs run /run" | add_linuxrc
+}
+
 # unmount all mountpoints mounted by geninitrd
 umount_all() {
 
@@ -216,6 +231,11 @@ umount_all() {
        debugshell
        EOF
 
+       if is_yes "$run_mounted"; then
+               echo 'mount --bind /run /newroot/run' | add_linuxrc
+               echo 'umount /run' | add_linuxrc
+               run_mounted=no
+       fi
        if is_yes "$dev_mounted"; then
                echo 'umount /dev' | add_linuxrc
                dev_mounted=no
@@ -282,10 +302,17 @@ ikconfig() {
        local kofile=$(modinfo -k $kernel -n configs 2> /dev/null)
        if [ -n "$kofile" ]; then
                /lib/geninitrd/extract-ikconfig $kofile
-       else
-               # try vmlinuz itself
-               /lib/geninitrd/extract-ikconfig /boot/vmlinuz-$kernel
+               return
        fi
+
+       # see if config available as separate file
+       if [ -f /boot/config-$kernel ]; then
+          cat /boot/config-$kernel
+          return
+       fi
+
+       # finally try vmlinuz itself
+       /lib/geninitrd/extract-ikconfig /boot/vmlinuz-$kernel
 }
 
 # Finds module dependencies
@@ -310,7 +337,7 @@ find_depmod() {
 
        if [ $? != 0 ]; then
                if [ $skiperrors = 1 ]; then
-                       return
+                       return 0
                fi
                echo >&2 "$modprobe"
 
@@ -326,6 +353,7 @@ find_depmod() {
        while read insmod modpath options; do
                [ "$insmod" = "insmod" ] && echo $modpath
        done
+       return 0
 }
 
 find_firmware() {
@@ -404,12 +432,20 @@ inst_exec() {
 
        inst "$@" $dest
 
-       local lib libs=$(ldd "$@" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
-       for lib in $libs; do
-               if [ ! -f "$DESTDIR/$_lib/${lib##*/}" ]; then
-                       inst_d /$_lib
-                       inst_exec $lib /$_lib
-               fi
+       local obj lib libs
+       for obj in "$@"; do
+               case "$obj" in
+                       /lib/ld-linux.so.2 | /lib64/ld-linux-x86-64.so.2)
+                       continue
+               esac
+
+               libs=$(ldd "$obj" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
+               for lib in $libs; do
+                       if [ ! -f "$DESTDIR/$_lib/${lib##*/}" ]; then
+                               inst_d /$_lib
+                               inst_exec $lib /$_lib
+                       fi
+               done
        done
 
        # hack for uclibc linked binaries requiring this fixed path
@@ -432,6 +468,14 @@ modprobe_conf() {
        echo "$modprobe_conf_cache"
 }
 
+# return options for MODULE
+# @param $1 module name
+modprobe_options() {
+       local module=$1
+       local options=$(modprobe_conf | awk -vmodule="$module" '{ if ($1 == "options" && $2 == module) { for(i=3;i<=NF;i++) printf("%s ",$i); }}')
+       echo ${options# }
+}
+
 #
 # defaults to modprobe -c if not told otherwise, this means include statements
 # work from there.
@@ -445,10 +489,11 @@ cache_modprobe_conf() {
 
        if [ -n "$modulefile" ]; then
                debug "Using $modulefile for modules config"
-               modprobe_conf_cache=$(cat $modulefile)
+               modprobe_conf_cache=$(cat $modulefile | awk '!/^[\t ]*#/ { print }')
+
        else
                debug "Using modprobe -c to get modules config"
-               modprobe_conf_cache=$(modprobe -c --set-version $kernel)
+               modprobe_conf_cache=$(modprobe -c --set-version $kernel | awk '!/^[\t ]*#/ { print }')
        fi
 }
 
@@ -464,7 +509,7 @@ find_modules_for_devpath() {
                devpath=$(dm_node "$devpath")
        fi
 
-       if [ -L "$devpath" ] && ! is_lvm "$devpath"; then
+       if [ -L "$devpath" ] && ! is_lvm "$devpath" && ! is_luks "$devpath"; then
                # sanitize things like:
                # /dev/block/104:2 -> /dev/cciss/c0d0p2
                devpath=$(readlink -f "$devpath")
@@ -525,15 +570,23 @@ find_modules_for_devpath() {
        fi
 
        if [[ "$devpath" == /dev/cciss/* ]]; then
-               find_module "cciss"
                rootdev_add=/dev/cciss/
+
+               # load hpsa for future kernels, cciss for backwards compat
+               if [ "$kernel_version_long" -ge "003000000" ]; then
+                       find_module "hpsa" "-cciss"
+                       find_modules_scsi "$devpath"
+               else
+                       find_module "cciss"
+               fi
+
                return
        fi
 
        if [[ "$devpath" == /dev/ataraid/* ]]; then
                find_modules_ide
                find_module "ataraid"
-               ataraidmodules=$(modprobe_conf | awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }')
+               ataraidmodules=$(modprobe_conf | awk '/ataraid_hostadapter/ { print $3 }')
                if [ -n "$ataraidmodules" ]; then
                        # FIXME: think about modules compiled in kernel
                        die "ataraid_hostadapter alias not defined in modprobe.conf! Please set it and run $PROGRAM again."
@@ -590,6 +643,9 @@ echo 0 > /sys$DEVPATH/loading
 exit 0
 EOF
                chmod 755 "$DESTDIR/lib/firmware/firmware.sh"
+
+               # setup firmware loader agent
+               echo "echo -n "/lib/firmware/firmware.sh" > /proc/sys/kernel/hotplug" | add_linuxrc
        fi
 
        for firmware in $firmware_files; do
@@ -602,12 +658,11 @@ EOF
                        [ "$FIRMWAREDIR" != "$firmware" ] && inst_d /lib/firmware/$FIRMWAREDIR
                        inst /lib/firmware/$firmware /lib/firmware/$firmware
                else
-                       die "firmware file /lib/firmware/$firmware nor /lib/firmware/$kernel/$firmware found."
+                       warn "Possible missing firmware file /lib/firmware/$firmware or /lib/firmware/$kernel/$firmware for module $module."
                fi
        done
 
        mount_sys
-       echo "echo -n "/lib/firmware/firmware.sh" > /proc/sys/kernel/hotplug" | add_linuxrc
 }
 
 modules_install() {
@@ -619,6 +674,9 @@ modules_install() {
                inst_d "/lib/modules/$kernel/$MODULEDIR"
                cp -a "/lib/modules/$kernel/$mod" "$DESTDIR/lib/modules/$kernel/$mod"
                gunzip "$DESTDIR/lib/modules/$kernel/$mod" 2> /dev/null
+               if [ "$STRIP" ] && [ -x "$STRIP" ]; then
+                       $STRIP -g --remove-section=.comment "$DESTDIR/lib/modules/$kernel/${mod%.gz}"
+               fi
        done
 }
 
@@ -631,7 +689,7 @@ modules_add_linuxrc() {
 
                # name of the module
                local module=${modpath##*/}; module=${module%$modext}
-               local options=$(modprobe_conf | awk -vmodule="$module" '{ if ($1 == "options" && $2 == module) { for(i=3;i<=NF;i++) printf("%s ",$i); }}' | xargs)
+               local options=$(modprobe_options "$module")
                local genericname=$(echo $module | tr - _)
                local usleep=$(eval echo \$MODULE_${genericname}_USLEEP)
                local firmware=$(eval echo \$MODULE_${genericname}_FIRMWARE)
@@ -700,9 +758,14 @@ initrd_gen_devices() {
 
 initrd_gen_setrootdev() {
        debug "Adding rootfs finding based on kernel cmdline root= option support."
+       busybox_applet ls
        add_linuxrc <<-'EOF'
                if [ "${ROOT##/dev/}" != "${ROOT}" ]; then
                        rootnr="$(busybox awk -v rootnode="${ROOT##/dev/}" '$4 == rootnode { print 256 * $1 + $2 }' /proc/partitions)"
+                       # fallback to ls
+                       if [ -z "$rootnr" ]; then
+                               rootnr="$(busybox ls -lL ${ROOT} | busybox awk '{if (/^b/) { print 256 * $3 + $4; }}')"
+                       fi
                        if [ -n "$rootnr" ]; then
                                echo "$rootnr" > /proc/sys/kernel/real-root-dev
                        fi
@@ -721,53 +784,50 @@ initrd_gen_initramfs_switchroot() {
        # parse 'root=xxx' kernel commandline
        # We support passing root as hda3 /dev/hda3 0303 0x0303 and 303
        add_linuxrc <<-'EOF'
-               device=/dev/no_partition_found
+               device=
                eval "$(busybox awk -v c="$ROOT" '
                        BEGIN {
                                num_pattern_short = "[0-9a-f][0-9a-f][0-9a-f]";
                                num_pattern = "[0-9a-f]" num_pattern_short;
                                dev_pattern = "[hms][a-z][a-z]([0-9])+";
-                               partition = "no_partition_found";
+                               partition = "";
                                min = -1; maj = -1;
 
                                sub("^0x", "", c);
                                if (c ~ "^" num_pattern_short "$") sub("^", "0", c);
                                if (c ~ "^" num_pattern  "$") {
-                                       maj = sprintf("%s",substr(c,1,2));
-                                       min = sprintf("%s",substr(c,3));
+                                       maj = sprintf("%d",substr(c,1,2));
+                                       min = sprintf("%d",substr(c,3));
                                }
                                if (c ~ "^\/dev\/" dev_pattern "$") sub("^/dev/","", c);
                                if (c ~ "^" dev_pattern "$") partition = c;
                        }
 
-                       $4 ~ partition { maj = $1; min = $2; }
-                       $1 ~ maj && $2 ~ min { partition = $4; }
+                       partition && $4 == partition { maj = $1; min = $2; }
+                       $1 == maj && $2 == min { partition = $4; }
 
                        END {
                                if (maj >= 0 && min >= 0) {
-                                       printf("device=/dev/%s; maj=%s; min=%s;\n", partition, maj, min);
+                                       printf("maj=%s; min=%s;\n", maj, min);
+                               }
+                               if (partition) {
+                                       printf("device=/dev/%s;\n", partition);
                                }
                        }
                        ' /proc/partitions)"
-               if [ "$device" != '/dev/no_partition_found' -a ! -b $device ]; then
-                       mknod $device b $maj $min
-               fi
-       EOF
 
-       add_linuxrc <<-EOF
-               rootdev=$rootdev
-               rootfs=$rootFs
-       EOF
+               if [ -z "$device" ]; then
+                       device=$ROOT
+               fi
 
-       add_linuxrc <<-'EOF'
-               if [ "$device" = '/dev/no_partition_found' ]; then
-                       device=$rootdev
+               if [ "$device" -a ! -b $device ]; then
+                       mknod $device b $maj $min
                fi
 
-               [ -n "$ROOTFSFLAG" ] && ROOTFSFLAGS="-o $ROOTFSFLAGS"
+               [ -n "$ROOTFSFLAGS" ] && ROOTFSFLAGS="-o $ROOTFSFLAGS"
 
-               mount -t $rootfs -r $device $ROOTFSFLAGS /newroot
-               init="$(echo "$CMDLINE" | busybox awk '/init=\// { gsub(/.*init=/,NIL,$0); gsub(/ .*/,NIL,$0); print }')"
+               mount -t $ROOTFS -r $device $ROOTFSFLAGS /newroot || echo "Mount of rootfs failed."
+               init=$INIT
                if [ -z "$init" -o ! -x "/newroot$init" ]; then
                        init=/sbin/init
                fi
@@ -776,6 +836,7 @@ initrd_gen_initramfs_switchroot() {
        umount_all
        busybox_applet switch_root
        add_linuxrc <<-'EOF'
+               [ ! -e /newroot/dev/console ] && mknod -m 660 /newroot/dev/console c 5 1
                exec switch_root /newroot $init ${1:+"$@"}
 
                echo "Error! initramfs should not reach this place."
@@ -899,7 +960,7 @@ if [ ! -f /proc/mounts ]; then
        warn "/proc filesystem not mounted, may cause wrong results or failure."
 fi
 
-geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi
+geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd
 
 while [ $# -gt 0 ]; do
        case $1 in
@@ -1001,6 +1062,16 @@ while [ $# -gt 0 ]; do
        --nocompress)
                COMPRESS=no
                ;;
+       --nostrip)
+               STRIP=
+               ;;
+       --strip=*)
+               STRIP="${1#--strip=}"
+               ;;
+       --strip)
+               STRIP=$2
+               shift
+               ;;
        --ifneeded)
                ifneeded=1
                ;;
@@ -1036,7 +1107,7 @@ while [ $# -gt 0 ]; do
                elif [ -z "$kernel" ]; then
                        kernel="$1"
                else
-                       usage >&2
+                       usage
                        exit 1
                fi
                ;;
@@ -1046,7 +1117,7 @@ while [ $# -gt 0 ]; do
 done
 
 if [ -z "$target" -o -z "$kernel" ]; then
-       usage >&2
+       usage
        exit 1
 fi
 
@@ -1062,10 +1133,10 @@ else
 fi
 
 initrd_dir=/usr/$_lib/initrd
-kernel_version=$(echo "$kernel" | awk -F. '{print sprintf("%03d%03d",$1,$2)}')
-kernel_version_long=$(echo "$kernel" | awk -F. '{print sprintf("%03d%03d%03d",$1,$2,$3)}')
+kernel_version=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d",$1,$2)}')
+kernel_version_long=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d%03d",$1,$2,$3)}')
 
-debug "# $RCSID"
+debug "# $GENINITRD_RCSID (geninitrd)"
 debug "Using _lib: $_lib"
 debug "Using initrd_dir: $initrd_dir"
 
@@ -1141,6 +1212,9 @@ if [ "$FBMODULE" ]; then
        find_module "$FBMODULE"
 fi
 
+# autodetect USB keyboards
+find_modules_usbkbd
+
 # allow forcing loading SCSI and/or IDE modules
 # XXX: where ADDSCSI cames from? drop?
 if is_yes "$ADDSCSI"; then
@@ -1195,7 +1269,7 @@ chmod a+rx "$RCFILE"
 ln -s linuxrc $DESTDIR/init
 
 # create dirs that we really need
-inst_d /{lib,bin,etc,dev{,/pts,/shm},loopfs,var,proc,sys}
+inst_d /{lib,bin,etc,dev{,/pts,/shm},loopfs,var,proc,run,sys}
 
 modules_install "$MODULES"
 
@@ -1215,12 +1289,17 @@ ln -s busybox $DESTDIR/bin/initrd-busybox
 add_linuxrc <<EOF
 #!/bin/sh
 # initrd generated by:
-# $RCSID
+# $GENINITRD_RCSID
 
 EOF
 mount_proc
+add_linuxrc <<-EOF
+       # builtin defaults from geninitrd
+       ROOT=$rootdev
+       ROOTFS=$rootFs
+EOF
 add_linuxrc <<-'EOF'
-       read CMDLINE < /proc/cmdline; export CMDLINE
+       read CMDLINE < /proc/cmdline
 
        for arg in $CMDLINE; do
                if [ "${arg}" = "debuginitrd" ]; then
@@ -1235,6 +1314,9 @@ add_linuxrc <<-'EOF'
                if [ "${arg##rootfsflags=}" != "${arg}" ]; then
                        ROOTFSFLAGS=${arg##rootfsflags=}
                fi
+               if [ "${arg##init=}" != "${arg}" ]; then
+                       INIT=${arg##init=}
+               fi
        done
 
        # make debugshell() invoke subshell if $DEBUGINITRD=sh
@@ -1243,7 +1325,7 @@ add_linuxrc <<-'EOF'
 EOF
 if is_yes "$RUN_SULOGIN_ON_ERR"; then
 add_linuxrc <<-'EOF'
-       echo "debug shell disabled by /etc/sysconfig/system:RUN_SULOGIN_ON_ERR setting"
+       echo "debug shell disabled by /etc/sysconfig/system: RUN_SULOGIN_ON_ERR setting"
 EOF
 else
 add_linuxrc <<-'EOF'
@@ -1307,6 +1389,39 @@ initrd_gen_suspend
 [ ! -e "$DESTDIR/$rootdev_add" ] && inst $rootdev_add /dev
 
 initrd_gen_stop_udevd
+initrd_gen_stop_uvesafb
+
+# clean up env
+add_linuxrc <<-'EOF'
+       ifs=$IFS
+       IFS="
+       "
+       for i in $(export -p); do
+               i=${i#declare -x } # ksh/bash
+               i=${i#export } # busybox
+
+               case "$i" in
+               *=*)
+                       : ;;
+               *)
+                       continue ;;
+               esac
+
+               i=${i%%=*}
+
+               [ -z "$i" ] && continue
+
+               case "$i" in
+                       ROOT|PATH|HOME|TERM)
+                               :
+                               ;;
+                       *)
+                               unset $i
+                               ;;
+               esac
+       done
+       IFS=$ifs
+EOF
 
 if [ "$INITRDFS" = "initramfs" ]; then
        initrd_gen_initramfs_switchroot
@@ -1319,16 +1434,20 @@ initrd_gen_fbcondecor
 
 IMAGE=$(mktemp -t initrd.img-XXXXXX) || die "mktemp failed"
 
+IMAGESIZE=$(du -ks $DESTDIR | awk '{print int(($1+1023+512)/1024)*1024}')
+debug "image size: $IMAGESIZE KiB ($DESTDIR)"
+
 debug "Creating $INITRDFS image $IMAGE"
 case "$INITRDFS" in
   ext2)
        dd if=/dev/zero of="$IMAGE" bs=1k count="$IMAGESIZE" 2> /dev/null
-       mke2fs -q -F -b 1024 -m 0 "$IMAGE" 2>/dev/null 1>&2
+       # NOTE: ext2 label is max 16 chars
+       mke2fs -q -F -b 1024 -m 0 -L "PLD/$kernel" "$IMAGE" 2>/dev/null 1>&2
        tune2fs -i 0 "$IMAGE" >/dev/null 2>&1
 
        local tmpmnt=$(mktemp -d -t initrd.mnt-XXXXXX)
        debug "Mounting ext2 image $IMAGE to $tmpmnt"
-       mount -o loop -t ext2 "$IMAGE" "$tmpmnt"
+       mount -o loop -t ext2 "$IMAGE" "$tmpmnt" || die "mount failed, check dmesg(1)"
        # We don't need this directory, so let's save space
        rm -rf "$tmpmnt"/lost+found
 
@@ -1339,7 +1458,7 @@ case "$INITRDFS" in
 
        ;;
   rom|romfs)
-       genromfs -f "$IMAGE" -d "$DESTDIR" -V "PLD Linux/$kernel initrd"
+       genromfs -f "$IMAGE" -d "$DESTDIR" -V "PLD Linux/$kernel (geninitrd/$VERSION)"
        ;;
   cram|cramfs)
        mkcramfs "$DESTDIR" "$IMAGE"
@@ -1354,10 +1473,9 @@ esac
 CONFIG_BLK_DEV_RAM_SIZE=$(ikconfig | awk -F= '/^CONFIG_BLK_DEV_RAM_SIZE/{print $2}')
 if [ -z "$CONFIG_BLK_DEV_RAM_SIZE" ]; then
        CONFIG_BLK_DEV_RAM_SIZE=4096
+       warn "No CONFIG_BLK_DEV_RAM_SIZE detected, fallback to $CONFIG_BLK_DEV_RAM_SIZE"
 fi
 
-IMAGESIZE=$(du -ks $DESTDIR | awk '{print int(($1+1023+512)/1024)*1024}')
-debug  "image size: $IMAGESIZE KiB ($DESTDIR)"
 if [ "$IMAGESIZE" -gt $CONFIG_BLK_DEV_RAM_SIZE ]; then
        warn "Your image size is larger than $CONFIG_BLK_DEV_RAM_SIZE, Be sure to boot kernel with ramdisk_size=$IMAGESIZE!"
 fi
This page took 0.119391 seconds and 4 git commands to generate.