]> git.pld-linux.org Git - projects/geninitrd.git/blob - geninitrd
Mount /dev on initramfs too
[projects/geninitrd.git] / geninitrd
1 #!/bin/sh
2
3 # geninitrd
4 #
5 #       by PLD Linux Team
6 #
7 # based on mkinitrd from RedHat Linux
8 #
9
10 GENINITRD_RCSID='$Revision$ $Date::                            $'
11 R=${GENINITRD_RCSID#* *}; VERSION=${R%% *}
12 PROGRAM=${0##*/}
13
14 . /etc/rc.d/init.d/functions
15 . /lib/geninitrd/functions
16 . /etc/sysconfig/system
17
18 # list of geninitrd modules which need setup routine after commandline args parsing
19 GENINITRD_MODS=""
20 COMPRESS=yes
21 STRIP=/usr/bin/strip
22 target=""
23 kernel=""
24 force=""
25 verbose=""
26 MODULES=""
27 img_vers=""
28 fstab=/etc/fstab
29 modext=.o
30 rootdev_nr=0
31 # device node for rootfs from fstab
32 rootdev=""
33
34 # internal variables
35 # is /dev on tmpfs
36 dev_mounted=no
37 # is /proc mounted
38 proc_mounted=no
39 # is /sys mounted
40 sys_mounted=no
41 # is /tmp mounted on tmpfs
42 tmp_mounted=no
43
44 # are /dev nodes already created from /proc/devices info?
45 proc_partitions=no
46
47 usage() {
48         echo "Usage: $PROGRAM [--version] [-v] [-f] [--ifneeded] [--preload <module>]"
49         echo "       [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]"
50         echo "       [--compress=yes|xz|lzma|bzip2|gzip|lzo]"
51         echo "       [--nostrip ] [--strip PATH/strip] [--strip=PATH/strip]"
52         echo "       [--initrdfs=rom|initramfs|ext2|cram] [--modules-conf=<modules.conf>]"
53         echo "       [--with-bootsplash] [--without-bootsplash]"
54         echo "       [--with-fbsplash] [--without-fbsplash]"
55         echo "       [--with-fbcondecor] [--without-fbcondecor]"
56         echo "       [--lvmtoolsversion=1|2] [--with-udev] [--without-udev]"
57         echo "       [--with-suspend] [--without-suspend]"
58         echo "       [--with-tuxonice] [--without-tuxonice]"
59         echo "       [--without-dmraid]"
60         echo "       [--with-multipath=DEVPATH] [--without-multipath]"
61         echo "       [--without-blkid] [--without-luks]"
62         echo "       <initrd-image> <kernel-version>"
63         echo ""
64         echo "Example:"
65
66         local kdir kver dir=${target:-/boot}
67         for kdir in /lib/modules/*; do
68                 [ -d $kdir ] || continue
69                 kver=${kdir##*/}
70                 echo "  $0 -f --initrdfs=rom $dir/initrd-$kver.gz $kver $verbose"
71         done
72 }
73
74 msg() {
75         echo "$PROGRAM: $*"
76 }
77
78 warn() {
79         msg "WARNING: $*" >&2
80 }
81
82 debug() {
83         [ -n "$verbose" ] && msg "$*" >&2
84 }
85
86 # aborts program abnormally
87 die() {
88         local rc=${2:-1}
89         msg "ERROR: $1" >&2
90         exit $rc
91 }
92
93 # find program from specified paths
94 find_tool() {
95         local x
96         for x in "$@"; do
97                 if [ -x "$x" ]; then
98                         echo $x
99                         debug "find_tool: found $x"
100                         return 0
101                 fi
102         done
103         debug "find_tool: did not found any of: $@"
104         return 1
105 }
106
107 # loads geninitrd modules
108 geninitrd_load_mods() {
109         local mod
110         for mod in "$@"; do
111                 if [ ! -f /lib/geninitrd/mod-$mod.sh ]; then
112                         die "$mod geninitrd module can't be loaded"
113                 fi
114                 . /lib/geninitrd/mod-$mod.sh
115
116                 GENINITRD_MODS="$GENINITRD_MODS $mod"
117         done
118 }
119
120 # setup geninitrd modules
121 geninitrd_setup_mods() {
122         local mod rcsid
123
124         for mod in $GENINITRD_MODS; do
125                 eval rcsid=$(echo \$$mod | LC_ALL=C tr '[a-z]' '[A-Z]')_RCSID
126                 debug "# $rcsid (mod-$mod)"
127
128                 # some mods want init
129                 if type setup_mod_$mod > /dev/null; then
130                         eval setup_mod_$mod
131                 fi
132         done
133 }
134
135 # append text to /linuxrc
136 # takes STDIN as input
137 add_linuxrc() {
138         cat >> "$RCFILE"
139 }
140
141 # generate code to mount /dev on tmpfs and create initial nodes
142 # can be called multiple times. /dev is cleaned up (umounted) automatically at
143 # the end of script.
144 mount_dev() {
145         # we already generated tmpfs code; return
146         if is_yes "$dev_mounted"; then
147                 return
148         fi
149
150         dev_mounted=yes
151
152         busybox_applet mount mknod mkdir
153         add_linuxrc <<-EOF
154                 : 'Creating /dev'
155                 mount -o mode=0755 -t tmpfs none /dev
156                 mknod /dev/console c 5 1
157                 mknod /dev/null c 1 3
158                 mknod /dev/zero c 1 5
159                 mknod /dev/random c 1 8
160                 mknod /dev/snapshot c 10 231
161                 mknod /dev/urandom c 1 9
162                 mkdir /dev/pts
163                 mkdir /dev/shm
164         EOF
165 }
166
167 # generate code to mount /proc on initrd
168 # can be called multiple times
169 mount_proc() {
170         if is_yes "$proc_mounted"; then
171                 return
172         fi
173
174         proc_mounted=yes
175     if [ "$INITRDFS" = "initramfs" ]; then
176                 # /proc is mounted with initramfs 2.6.22.14 kernel
177                 # XXX: remove when it is clear why proc was already mounted
178                 echo "[ -f /proc/cmdline ] || mount -t proc none /proc" | add_linuxrc
179         else
180                 echo "mount -t proc none /proc" | add_linuxrc
181         fi
182 }
183
184 # generate code to mount /sys on initrd
185 # can be called multiple times
186 mount_sys() {
187         if is_yes "$sys_mounted"; then
188                 return
189         fi
190
191         sys_mounted=yes
192         echo "mount -t sysfs none /sys" | add_linuxrc
193 }
194
195 # generate code to mount /tmp on initrd
196 # can be called multiple times
197 mount_tmp() {
198     if [ "$INITRDFS" = "initramfs" ]; then
199                 # initramfs is read-write filesystem, no need for tmpfs
200                 return
201         fi
202
203         if is_yes "$tmp_mounted"; then
204                 return
205         fi
206
207         tmp_mounted=yes
208         echo "mount -t tmpfs none /tmp" | add_linuxrc
209 }
210
211 # unmount all mountpoints mounted by geninitrd
212 umount_all() {
213
214         add_linuxrc <<-'EOF'
215         : Last shell before umounting all and giving control over to real init.
216         debugshell
217         EOF
218
219         if is_yes "$dev_mounted"; then
220                 echo 'umount /dev' | add_linuxrc
221                 dev_mounted=no
222         fi
223         if is_yes "$sys_mounted"; then
224                 echo 'umount /sys' | add_linuxrc
225                 sys_mounted=no
226         fi
227         if is_yes "$tmp_mounted"; then
228                 echo 'umount /tmp' | add_linuxrc
229                 tmp_mounted=no
230         fi
231         if is_yes "$proc_mounted"; then
232                 echo 'umount /proc' | add_linuxrc
233                 proc_mounted=no
234         fi
235 }
236
237
238 # Checks if busybox has support for APPLET(s)
239 # Exits from geninitrd if the support is not present.
240 #
241 # NB! XXX do not output to STDOUT, it will appear in initrd images in some cases!
242 busybox_applet() {
243         local err=0 applet
244
245         if [ -z "$busybox_functions" ]; then
246                 local tmp=$($busybox 2>&1)
247
248                 # BusyBox v1.1.3 says applet not found if it's not called 'busybox'.
249                 if [[ "$tmp" = *applet\ not\ found* ]]; then
250                         local t=$(mktemp -d)
251                         ln -s $busybox $t/busybox
252                         local tmp=$($t/busybox 2>&1)
253                         rm -rf $t
254                 fi
255
256                 busybox_functions=$(echo "$tmp" | \
257                         sed -ne '/Currently defined functions:/,$p' | \
258                         xargs | sed -e 's,.*Currently defined functions: ,,'
259                 )
260         fi
261         for applet in $*; do
262                 local have
263                 # try cache
264                 eval have='$'busybox_have_$applet
265                 if [ -z "$have" ]; then
266                         have=$(echo "$busybox_functions" | egrep -c "( |^)$applet(,|$)")
267                         if [ "$have" = 0 ]; then
268                                 warn "This setup requires busybox-initrd compiled with applet '$applet' support"
269                                 err=1
270                         fi
271                         eval busybox_have_$applet=$have
272                 fi
273         done
274         if [ $err = 1 ]; then
275                 die "Aborted"
276         fi
277 }
278
279 # Extract the .config file from a kernel image
280 # uses extract-ikconfig from kernel sources (scripts/extract-ikconfig)
281 ikconfig() {
282         local kofile=$(modinfo -k $kernel -n configs 2> /dev/null)
283         if [ -n "$kofile" ]; then
284                 /lib/geninitrd/extract-ikconfig $kofile
285                 return
286         fi
287
288         # see if config available as separate file
289         if [ -f /boot/config-$kernel ]; then
290            cat /boot/config-$kernel
291            return
292         fi
293
294         # finally try vmlinuz itself
295         /lib/geninitrd/extract-ikconfig /boot/vmlinuz-$kernel
296 }
297
298 # Finds module dependencies
299 #
300 # @param        $module
301 #
302 # Outputs full path to module and it's dependencies
303 find_depmod() {
304         local module="$1"
305         local skiperrors=0
306
307         # if module is prefixed with dash, we should ignore errors if the module
308         # can't be found.
309         if [ ${module#-} != $module ]; then
310                 skiperrors=1
311                 module=${module#-}
312         fi
313
314         # This works when user has module-init-tools installed even on 2.4 kernels
315         local modprobe
316         modprobe=$(modprobe --set-version $kernel --show-depends $module --ignore-install 2>&1)
317
318         if [ $? != 0 ]; then
319                 if [ $skiperrors = 1 ]; then
320                         return 0
321                 fi
322                 echo >&2 "$modprobe"
323
324                 if ! is_no "$EXIT_IF_MISSING"; then
325                         die "$module: module not found for $kernel kernel"
326                 fi
327
328                 warn "$module: module not found for $kernel kernel"
329                 warn "If $module isn't compiled in kernel then this initrd may not start your system."
330         fi
331
332         echo "$modprobe" | \
333         while read insmod modpath options; do
334                 [ "$insmod" = "insmod" ] && echo $modpath
335         done
336         return 0
337 }
338
339 find_firmware() {
340         local module="$1"
341
342         # no firmware support in 2.4 kernels
343         if [ "$kernel_version_long" -lt "002005048" ]; then
344                 return
345         fi
346         echo -n $(NEW_MODINFO=1 modinfo -k $kernel -F firmware $module 2>/dev/null | xargs)
347 }
348
349 # @param        $module
350 find_module() {
351         local mod depmod module=$1
352
353         depmod=$(find_depmod $module) || exit 1
354         for mod in $depmod; do
355                 mod=${mod#/lib/modules/$kernel/}
356
357                 # add each module only once
358                 local m have=0
359                 for m in $MODULES; do
360                         [ $m = $mod ] && have=1
361                 done
362                 if [ $have = 0 ]; then
363                         MODULES="$MODULES $mod"
364                 fi
365         done
366 }
367
368 # install a file to temporary mount image.
369 # it will operate recursively (copying directories)
370 # and will symlink destinations if source is symlink.
371 inst() {
372         if [ $# -lt 2 ]; then
373                 die 'Usage: inst <file> [<file>] <destination>'
374         fi
375
376         local src i=0 c=$(($# - 1))
377         while [ $i -lt $c ]; do
378                 src="$src $1"
379                 i=$((i + 1))
380                 shift
381         done
382         local dest=$1
383         set -- $src
384         local parentDir=$(dirname $DESTDIR$dest)
385         [ ! -d "$parentDir" ] && (debug "+ mkdir -p $parentDir"; mkdir -p $parentDir)
386         debug "+ cp $* $DESTDIR$dest"
387         cp -HR "$@" "$DESTDIR$dest"
388 }
389
390 inst_d() {
391         if [ $# = 0 ]; then
392                 die 'Usage: inst_d <destination> <destination>'
393         fi
394         for dir in "$@"; do
395                 install -d "$DESTDIR$dir"
396         done
397 }
398
399 # install executable and it's shared libraries
400 inst_exec() {
401         if [ $# -lt 2 ]; then
402                 die "Invalid params ($@), Usage: inst_exec <file>[, <file>] <destination>"
403         fi
404         local src i=0 c=$(($# - 1))
405         while [ $i -lt $c ]; do
406                 src="$src $1"
407                 i=$((i + 1))
408                 shift
409         done
410         local dest=$1
411         set -- $src
412
413         inst "$@" $dest
414
415         local lib libs=$(ldd "$@" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
416         for lib in $libs; do
417                 if [ ! -f "$DESTDIR/$_lib/${lib##*/}" ]; then
418                         inst_d /$_lib
419                         inst_exec $lib /$_lib
420                 fi
421         done
422
423         # hack for uclibc linked binaries requiring this fixed path
424         # XXX: shouldn't rpath be used here instead so th
425         if [ -f $DESTDIR/$_lib/libc.so.0 ]; then
426                 local lib=$DESTDIR/$_lib/libc.so.0
427                 lib=$(ldd "$lib" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
428                 local libdir=$(cd $(dirname "$lib"); pwd)
429                 if [ ! -e $DESTDIR$libdir ]; then
430                         libdir=$(dirname "$libdir")
431                         inst_d $libdir
432                         debug "+ ln -s /$_lib $DESTDIR$libdir"
433                         ln -s /$_lib $DESTDIR$libdir
434                 fi
435         fi
436 }
437
438 # output modules.conf / modprobe.conf
439 modprobe_conf() {
440         echo "$modprobe_conf_cache"
441 }
442
443 #
444 # defaults to modprobe -c if not told otherwise, this means include statements
445 # work from there.
446 cache_modprobe_conf() {
447         if [ "$kernel_version" -lt "002005" ]; then
448                 modulefile=/etc/modules.conf
449                 if [ ! -f "$modulefile" -a -f /etc/conf.modules ]; then
450                         modulefile=/etc/conf.modules
451                 fi
452         fi
453
454         if [ -n "$modulefile" ]; then
455                 debug "Using $modulefile for modules config"
456                 modprobe_conf_cache=$(cat $modulefile)
457         else
458                 debug "Using modprobe -c to get modules config"
459                 modprobe_conf_cache=$(modprobe -c --set-version $kernel)
460         fi
461 }
462
463 # find modules for $devpath
464 find_modules_for_devpath() {
465         local devpath="$1"
466         if [ -z "$devpath" ]; then
467                 die "No argument passed to find_modules_for_devpath() - is your /etc/fstab correct?"
468         fi
469
470         if [[ "$devpath" = /dev/dm-* ]]; then
471                 # /dev/dm-3 -> /dev/mapper/sil_ahbgadcbchfc3
472                 devpath=$(dm_node "$devpath")
473         fi
474
475         if [ -L "$devpath" ] && ! is_lvm "$devpath" && ! is_luks "$devpath"; then
476                 # sanitize things like:
477                 # /dev/block/104:2 -> /dev/cciss/c0d0p2
478                 devpath=$(readlink -f "$devpath")
479         fi
480
481         debug "Finding modules for device path $devpath"
482
483         if is_luks "$devpath"; then
484                 find_modules_luks "$devpath"
485                 return
486         fi
487
488         if is_nfs "$devpath"; then
489                 find_modules_nfs "$devpath"
490                 return
491         fi
492
493         if is_md "$devpath"; then
494                 find_modules_md "$devpath"
495                 return
496         fi
497
498         if is_multipath "$devpath"; then
499                 if find_modules_multipath "$devpath"; then
500                         return
501                 fi
502
503                 # fallback
504         fi
505
506         if is_dmraid "$devpath"; then
507                 if find_modules_dmraid "$devpath"; then
508                         return
509                 fi
510                 # fallback
511         fi
512
513         if is_scsi "$devpath"; then
514                 find_modules_scsi "$devpath"
515                 return
516         fi
517
518         if is_ide "$devpath"; then
519                 find_modules_ide "$devpath"
520                 return
521         fi
522
523         if [[ "$devpath" == /dev/rd/* ]]; then
524                 find_module "DAC960"
525                 rootdev_add=/dev/rd/
526                 return
527         fi
528
529         if [[ "$devpath" == /dev/ida/* ]]; then
530                 find_module "cpqarray"
531                 rootdev_add=/dev/ida/
532                 return
533         fi
534
535         if [[ "$devpath" == /dev/cciss/* ]]; then
536                 find_module "cciss"
537                 rootdev_add=/dev/cciss/
538                 return
539         fi
540
541         if [[ "$devpath" == /dev/ataraid/* ]]; then
542                 find_modules_ide
543                 find_module "ataraid"
544                 ataraidmodules=$(modprobe_conf | awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }')
545                 if [ -n "$ataraidmodules" ]; then
546                         # FIXME: think about modules compiled in kernel
547                         die "ataraid_hostadapter alias not defined in modprobe.conf! Please set it and run $PROGRAM again."
548                 fi
549                 for n in $ataraidmodules; do
550                         find_module "$n"
551                 done
552                 rootdev_add=/dev/ataraid/
553                 return
554         fi
555
556         # check to see if we need to set up a loopback filesystem
557         if [[ "$devpath" == /dev/loop*  ]]; then
558                 die "Sorry, root on loop device isn't supported."
559                 # TODO: rewrite for bsp and make nfs ready
560                 if [ ! -x /sbin/losetup ]; then
561                         die "losetup is missing"
562                 fi
563                 key="^# $(echo $devpath | awk -F/ '{print($3);}' | tr '[a-z]' '[A-Z]'):"
564                 if ! is_yes "`awk '/'$key'/ { print( "yes"); }' $fstab`"; then
565                         die "The root filesystem is on a $devpath, but there is no magic entry in $fstab for this device. Consult the $PROGRAM man page for more information"
566                 fi
567
568                 line="`awk '/'$key'/ { print $0; }' $fstab`"
569                 loopDev="$(echo $line | awk '{print $3}')"
570                 loopFs="$(echo $line | awk '{print $4}')"
571                 loopFile="$(echo $line | awk '{print $5}')"
572
573                 BASICMODULES="$BASICMODULES -loop"
574                 find_module "-$loopFs"
575                 BASICMODULES="$BASICMODULES -${loopFs}"
576                 return
577         fi
578
579         if is_lvm "$devpath"; then
580                 find_modules_lvm "$devpath"
581                 return
582         fi
583 }
584
585 firmware_install_module() {
586         local module="$1"
587         local firmware_files="$2"
588
589         debug "Adding Firmwares ($firmware_files) to initrd for module $module"
590         # firmware not yet installed
591         if [ ! -f "$DESTDIR/lib/firmware/firmware.sh" ]; then
592                 inst_d /lib/firmware
593 cat << 'EOF' >> "$DESTDIR/lib/firmware/firmware.sh"
594 #!/bin/sh -e
595 echo 1 > /sys$DEVPATH/loading
596 cat "/lib/firmware/$FIRMWARE" > /sys$DEVPATH/data
597 echo 0 > /sys$DEVPATH/loading
598 exit 0
599 EOF
600                 chmod 755 "$DESTDIR/lib/firmware/firmware.sh"
601         fi
602
603         for firmware in $firmware_files; do
604                 if [ -f "/lib/firmware/$kernel/$firmware" ]; then
605                         FIRMWAREDIR=${firmware%/*}
606                         [ "$FIRMWAREDIR" != "$firmware" ] && inst_d /lib/firmware/$FIRMWAREDIR
607                         inst /lib/firmware/$kernel/$firmware /lib/firmware/$firmware
608                 elif [ -f "/lib/firmware/$firmware" ]; then
609                         FIRMWAREDIR=${firmware%/*}
610                         [ "$FIRMWAREDIR" != "$firmware" ] && inst_d /lib/firmware/$FIRMWAREDIR
611                         inst /lib/firmware/$firmware /lib/firmware/$firmware
612                 else
613                         warn "Possible missing firmware file /lib/firmware/$firmware or /lib/firmware/$kernel/$firmware for module $module."
614                 fi
615         done
616
617         mount_sys
618         echo "echo -n "/lib/firmware/firmware.sh" > /proc/sys/kernel/hotplug" | add_linuxrc
619 }
620
621 modules_install() {
622         local modules="$1"
623         local mod
624
625         for mod in $modules; do
626                 MODULEDIR=${mod%/*}
627                 inst_d "/lib/modules/$kernel/$MODULEDIR"
628                 cp -a "/lib/modules/$kernel/$mod" "$DESTDIR/lib/modules/$kernel/$mod"
629                 gunzip "$DESTDIR/lib/modules/$kernel/$mod" 2> /dev/null
630                 if [ "$STRIP" ] && [ -x "$STRIP" ]; then
631                         $STRIP -g --remove-section=.comment "$DESTDIR/lib/modules/$kernel/${mod%.gz}"
632                 fi
633         done
634 }
635
636 modules_add_linuxrc() {
637         local mod modpath
638
639         for mod in "$@"; do
640                 # module path without optional compression
641                 modpath=${mod%.gz}
642
643                 # name of the module
644                 local module=${modpath##*/}; module=${module%$modext}
645                 local options=$(modprobe_conf | awk -vmodule="$module" '{ if ($1 == "options" && $2 == module) { for(i=3;i<=NF;i++) printf("%s ",$i); }}' | xargs)
646                 local genericname=$(echo $module | tr - _)
647                 local usleep=$(eval echo \$MODULE_${genericname}_USLEEP)
648                 local firmware=$(eval echo \$MODULE_${genericname}_FIRMWARE)
649
650                 if [ "$module" = "scsi_mod" -a "$kernel_version_long" -ge "002006030" ]; then
651                         options="scan=sync $options"
652                 fi
653
654                 if [ -n "$verbose" ]; then
655                         s=""
656                         if [ "$options" ]; then
657                                 s="$s with options [$options]"
658                         fi
659                         if [ "$usleep" ]; then
660                                 s="$s and $usleep usleep"
661                         fi
662                         debug "Loading module [$module]$s"
663                 fi
664
665                 if [ -n "$firmware" ]; then
666                         firmware_install_module "$module" "$firmware"
667                 else
668                         for file in $(find_firmware "$module"); do
669                                 firmware_install_module "$module" "$file"
670                         done
671                 fi
672
673                 echo "insmod /lib/modules/$kernel/$modpath $options" | add_linuxrc
674                 if [ -n "$usleep" ]; then
675                         echo "usleep $usleep" | add_linuxrc
676                 fi
677                 if [ "$module" = "scsi_wait_scan" ]; then
678                         if [ "$(busybox_applet rmmod 2>/dev/null; echo $?)" = 0 ]; then
679                                 echo "rmmod scsi_wait_scan" | add_linuxrc
680                         fi
681                 fi
682
683         done
684 }
685
686 # Generates /dev nodes based on /proc/partitions information.
687 # Needs /proc mounted.
688 # Can be called multiple times.
689 initrd_gen_devices() {
690         if is_yes "$proc_partitions"; then
691                 return
692         fi
693         proc_partitions=yes
694
695         mount_dev
696         add_linuxrc <<-'EOF'
697                 : 'Making device nodes'
698                 cat /proc/partitions | (
699                         # ignore first two lines: header, empty line
700                         read b; read b
701
702                         while read major minor blocks dev rest; do
703                                 node=/dev/$dev
704                                 mkdir -p ${node%/*}
705                                 [ -e $node ] || mknod $node b $major $minor
706                         done
707                 )
708         EOF
709 }
710
711
712 initrd_gen_setrootdev() {
713         debug "Adding rootfs finding based on kernel cmdline root= option support."
714         busybox_applet ls
715         add_linuxrc <<-'EOF'
716                 if [ "${ROOT##/dev/}" != "${ROOT}" ]; then
717                         rootnr="$(busybox awk -v rootnode="${ROOT##/dev/}" '$4 == rootnode { print 256 * $1 + $2 }' /proc/partitions)"
718                         # fallback to ls
719                         if [ -z "$rootnr" ]; then
720                                 rootnr="$(busybox ls -lL ${ROOT} | busybox awk '{if (/^b/) { print 256 * $3 + $4; }}')"
721                         fi
722                         if [ -n "$rootnr" ]; then
723                                 echo "$rootnr" > /proc/sys/kernel/real-root-dev
724                         fi
725                 fi
726         EOF
727 }
728
729 initrd_gen_initramfs_switchroot() {
730         inst_d /newroot
731         if [ "$rootdev" = "/dev/nfs" ]; then
732                 echo "rootfs on NFS root=/dev/nfs"
733         else
734                 [ ! -e "$DESTDIR/$rootdev" ] && inst $rootdev $rootdev
735         fi
736
737         # parse 'root=xxx' kernel commandline
738         # We support passing root as hda3 /dev/hda3 0303 0x0303 and 303
739         add_linuxrc <<-'EOF'
740                 device=/dev/no_partition_found
741                 eval "$(busybox awk -v c="$ROOT" '
742                         BEGIN {
743                                 num_pattern_short = "[0-9a-f][0-9a-f][0-9a-f]";
744                                 num_pattern = "[0-9a-f]" num_pattern_short;
745                                 dev_pattern = "[hms][a-z][a-z]([0-9])+";
746                                 partition = "no_partition_found";
747                                 min = -1; maj = -1;
748
749                                 sub("^0x", "", c);
750                                 if (c ~ "^" num_pattern_short "$") sub("^", "0", c);
751                                 if (c ~ "^" num_pattern  "$") {
752                                         maj = sprintf("%s",substr(c,1,2));
753                                         min = sprintf("%s",substr(c,3));
754                                 }
755                                 if (c ~ "^\/dev\/" dev_pattern "$") sub("^/dev/","", c);
756                                 if (c ~ "^" dev_pattern "$") partition = c;
757                         }
758
759                         $4 ~ partition { maj = $1; min = $2; }
760                         $1 ~ maj && $2 ~ min { partition = $4; }
761
762                         END {
763                                 if (maj >= 0 && min >= 0) {
764                                         printf("device=/dev/%s; maj=%s; min=%s;\n", partition, maj, min);
765                                 }
766                         }
767                         ' /proc/partitions)"
768                 if [ "$device" != '/dev/no_partition_found' -a ! -b $device ]; then
769                         mknod $device b $maj $min
770                 fi
771         EOF
772
773         add_linuxrc <<-EOF
774                 rootdev=$rootdev
775                 rootfs=$rootFs
776         EOF
777
778         add_linuxrc <<-'EOF'
779                 if [ "$device" = '/dev/no_partition_found' ]; then
780                         device=$rootdev
781                 fi
782
783                 [ -n "$ROOTFSFLAGS" ] && ROOTFSFLAGS="-o $ROOTFSFLAGS"
784
785                 mount -t $rootfs -r $device $ROOTFSFLAGS /newroot || echo "Mount of rootfs failed."
786                 init="$(echo "$CMDLINE" | busybox awk '/init=\// { gsub(/.*init=/,NIL,$0); gsub(/ .*/,NIL,$0); print }')"
787                 if [ -z "$init" -o ! -x "/newroot$init" ]; then
788                         init=/sbin/init
789                 fi
790         EOF
791
792         umount_all
793         busybox_applet switch_root
794         add_linuxrc <<-'EOF'
795                 exec switch_root /newroot $init ${1:+"$@"}
796
797                 echo "Error! initramfs should not reach this place."
798                 echo "It probably means you've got old version of busybox, with broken"
799                 echo "initramfs support. Trying to boot anyway, but won't promise anything."
800
801                 exec chroot /newroot $init ${1:+"$@"}
802
803                 echo "Failed to chroot!"
804                 debugshell
805         EOF
806         # we need /init being real file, not symlink, otherwise the initramfs will
807         # not be ran by pid 1 which is required for switch_root
808         mv $DESTDIR/linuxrc $DESTDIR/init
809         ln -s init $DESTDIR/linuxrc
810 }
811
812 # find if $symbol exists in System.map $mapfile
813 sym_exists() {
814         local mapfile="$1"
815         local symbol="$2"
816         if [ ! -f $mapfile ]; then
817                 # missing mapfile (not a pld kernel?)
818                 return 1
819         fi
820
821         awk -vc=1 -vsymbol="$symbol" '$2 == "T" && $3 == symbol {c = 0} END {exit c}' $mapfile
822 }
823
824 # find best compressor (or forced one) for initrd
825 find_compressor() {
826         local mode="$1"
827         # fastest initrd decompression speed is first
828         local compressors='lzo gzip xz lzma bzip2'
829
830         # a specified one, take it
831         if ! is_yes "$mode"; then
832                 compressors="$mode"
833         fi
834
835         debug "finding compressor: $compressors (via $mode)"
836         # check for compressor validity
837         local c prog map=/boot/System.map-$kernel
838         for c in $compressors; do
839                 case $c in
840                 xz)
841                         sym=unxz
842                         prog=/usr/bin/xz
843                         ;;
844                 lzma)
845                         sym=unlzma
846                         prog=/usr/bin/xz
847                         ;;
848                 bzip2)
849                         sym=bzip2
850                         prog=/usr/bin/bzip2
851                         ;;
852                 gzip)
853                         sym=gunzip
854                         prog=/bin/gzip
855                         ;;
856                 lzo)
857                         sym=unlzo
858                         prog=/usr/bin/lzop
859                         ;;
860                 none|no)
861                         # any existing sym will work
862                         sym=initrd_load
863                         prog=/bin/cat
864                         ;;
865                 *)
866                         die "Unknown compressor $c"
867                         ;;
868                 esac
869                 if sym_exists $map $sym && [ -x $prog ]; then
870                         echo $c
871                         return
872                 fi
873         done
874
875         debug "using gzip for compressor (fallback)"
876         echo gzip
877 }
878
879 # compresses kernel image image
880 # in function so we could retry with other compressor on failure
881 compress_image() {
882         local compressor="$1" IMAGE="$2" target="$3" tmp
883         tmp=$(mktemp "$target".XXXXXX) || die "mktemp failed"
884
885         case "$compressor" in
886         xz)
887                 # don't use -9 here since kernel won't understand it
888                 xz --format=xz --check=crc32 --lzma2=preset=6e,dict=1MiB < "$IMAGE" > "$tmp" || return $?
889                 ;;
890         lzma)
891                 xz --format=lzma -9 < "$IMAGE" > "$tmp" || return $?
892                 ;;
893         bzip2)
894                 bzip2 -9 < "$IMAGE" > "$tmp" || return $?
895                 ;;
896         gzip)
897                 gzip -9 < "$IMAGE" > "$tmp" || return $?
898                 ;;
899         lzo)
900                 lzop -9 < "$IMAGE" > "$tmp" || return $?
901                 ;;
902         none|no)
903                 cat < "$IMAGE" > "$tmp" || return $?
904                 ;;
905         esac
906
907         mv -f "$tmp" "$target"
908 }
909
910 if [ -r /etc/sysconfig/geninitrd ]; then
911         . /etc/sysconfig/geninitrd
912 fi
913
914 if [ ! -f /proc/mounts ]; then
915         warn "/proc filesystem not mounted, may cause wrong results or failure."
916 fi
917
918 geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd
919
920 while [ $# -gt 0 ]; do
921         case $1 in
922         --fstab=*)
923                 fstab=${1#--fstab=}
924                 ;;
925         --fstab)
926                 fstab=$2
927                 shift
928                 ;;
929         --modules-conf=*)
930                 modulefile=${1#--modules-conf=}
931                 ;;
932         --modules-conf)
933                 modulefile=$2
934                 shift
935                 ;;
936         --with-bootsplash)
937                 BOOT_SPLASH=yes
938                 ;;
939         --without-bootsplash)
940                 BOOT_SPLASH=no
941                 ;;
942         --with-fbsplash)
943                 FB_SPLASH=yes
944                 ;;
945         --without-fbsplash)
946                 FB_SPLASH=no
947                 ;;
948         --with-fbcondecor)
949                 FB_CON_DECOR=yes
950                 ;;
951         --without-fbcondecor)
952                 FB_CON_DECOR=no
953                 ;;
954         --with-suspend)
955                 USE_SUSPEND=yes
956                 ;;
957         --without-suspend)
958                 USE_SUSPEND=no
959                 ;;
960         --with-suspend2 | --with-tuxonice)
961                 USE_TUXONICE=yes
962                 ;;
963         --without-suspend2 | --without-tuxonice)
964                 USE_TUXONICE=no
965                 ;;
966         --lvmversion=*)
967                 LVMTOOLSVERSION=${1#--lvmversion=}
968                 ;;
969         --lvmtoolsversion=*)
970                 LVMTOOLSVERSION=${1#--lvmtoolsversion=}
971                 ;;
972         --lvmtoolsversion|--lvmversion)
973                 LVMTOOLSVERSION=$2
974                 shift
975                 ;;
976         --without-udev)
977                 USE_UDEV=no
978                 ;;
979         --with-udev)
980                 USE_UDEV=yes
981                 ;;
982         --without-dmraid)
983                 USE_DMRAID=no
984                 ;;
985         --without-multipath)
986                 USE_MULTIPATH=no
987                 ;;
988         --with-multipath=*)
989                 USE_MULTIPATH=${1#--with-multipath=}
990                 ;;
991         --without-blkid)
992                 USE_BLKID=no
993                 ;;
994         --without-luks)
995                 USE_LUKS=no
996                 ;;
997         --with=*)
998                 BASICMODULES="$BASICMODULES ${1#--with=}"
999                 ;;
1000         --with)
1001                 BASICMODULES="$BASICMODULES $2"
1002                 shift
1003                 ;;
1004         --version)
1005                 echo "$PROGRAM: version $VERSION"
1006                 exit 0
1007                 ;;
1008         -v)
1009                 verbose=-v
1010                 ;;
1011         --compress)
1012                 COMPRESS=$2
1013                 ;;
1014         --compress=*)
1015                 COMPRESS="${1#--compress=}"
1016                 ;;
1017         --nocompress)
1018                 COMPRESS=no
1019                 ;;
1020         --nostrip)
1021                 STRIP=
1022                 ;;
1023         --strip=*)
1024                 STRIP="${1#--strip=}"
1025                 ;;
1026         --strip)
1027                 STRIP=$2
1028                 shift
1029                 ;;
1030         --ifneeded)
1031                 ifneeded=1
1032                 ;;
1033         -f)
1034                 force=1
1035                 ;;
1036         --preload=*)
1037                 PREMODS="$PREMODS ${1#--preload=}"
1038                 ;;
1039         --preload)
1040                 PREMODS="$PREMODS $2"
1041                 shift
1042                 ;;
1043         --fs=* | --fs)
1044                 die "--fs option is obsoleted. Use --initrdfs instead"
1045                 ;;
1046         --initrdfs=*)
1047                 INITRDFS=${1#--initrdfs=}
1048                 ;;
1049         --initrdfs)
1050                 INITRDFS=$2
1051                 shift
1052                 ;;
1053         --image-version)
1054                 img_vers=yes
1055                 ;;
1056         --ide-only-root)
1057                 ide_only_root="yes"
1058                 ;;
1059         *)
1060                 if [ -z "$target" ]; then
1061                         target="$1"
1062                 elif [ -z "$kernel" ]; then
1063                         kernel="$1"
1064                 else
1065                         usage
1066                         exit 1
1067                 fi
1068                 ;;
1069         esac
1070
1071         shift
1072 done
1073
1074 if [ -z "$target" -o -z "$kernel" ]; then
1075         usage
1076         exit 1
1077 fi
1078
1079 # main()
1080 if [ "$(id -u)" != 0 ]; then
1081         die "You need to be root to generate initrd"
1082 fi
1083
1084 if [ -d /lib64 -a -d /usr/lib64 ]; then
1085         _lib=lib64
1086 else
1087         _lib=lib
1088 fi
1089
1090 initrd_dir=/usr/$_lib/initrd
1091 kernel_version=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d",$1,$2)}')
1092 kernel_version_long=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d%03d",$1,$2,$3)}')
1093
1094 debug "# $GENINITRD_RCSID (geninitrd)"
1095 debug "Using _lib: $_lib"
1096 debug "Using initrd_dir: $initrd_dir"
1097
1098 busybox=$(find_tool $initrd_dir/busybox $initrd_dir/initrd-busybox /bin/initrd-busybox) || die "Couldn't find busybox suitable for initrd"
1099
1100 # we setup mods after parsing command line args
1101 geninitrd_setup_mods
1102
1103 if [ ! -f /boot/vmlinuz-"$kernel" ]; then
1104         warn "/boot/vmlinuz-$kernel doesn't exist, is your /boot mounted?"
1105 fi
1106
1107 if [ -z "$INITRDFS" ]; then
1108         if [ -n "$FS" ]; then
1109                 # FS= can came only via /etc/sysconfig/geninitrd likely?
1110                 die "FS configuration option is obsoleted. Use INITRDFS instead"
1111         fi
1112
1113         # default value
1114         if [ "$kernel_version" -ge "002005" ]; then
1115                 INITRDFS="initramfs"
1116         else
1117                 INITRDFS="rom"
1118         fi
1119 fi
1120
1121 case "$INITRDFS" in
1122   ext2)
1123         [ -x /sbin/mke2fs ] || die "/sbin/mke2fs is missing"
1124         ;;
1125   rom|romfs)
1126         [ -x /sbin/genromfs ] || die "/sbin/genromfs is missing"
1127         ;;
1128   cram|cramfs)
1129         [ -x /sbin/mkcramfs ] || die "/sbin/mkcramfs is missing"
1130         ;;
1131   initramfs)
1132         [ -x /bin/cpio ] || die "/bin/cpio is missing"
1133         [ -x /usr/bin/find ] || die "/usr/bin/find is missing"
1134         ;;
1135   *)
1136         die "Filesystem $INITRDFS on initrd is not supported"
1137         ;;
1138 esac
1139
1140 if [ -L "$target" ]; then
1141         target=$(readlink -f "$target")
1142 fi
1143
1144 if [ -n "$img_vers" ]; then
1145         target="$target-$kernel"
1146 fi
1147
1148 if [ -z "$force" -a -f "$target" ]; then
1149         die "$target already exists."
1150 fi
1151
1152 if [ ! -d "/lib/modules/$kernel" ]; then
1153         die "/lib/modules/$kernel is not a directory."
1154 fi
1155
1156 if [ "$kernel_version" -ge "002005" ]; then
1157         modext=".ko"
1158 fi
1159
1160 cache_modprobe_conf
1161
1162 for n in $PREMODS; do
1163         find_module "$n"
1164 done
1165
1166 if [ "$FBMODULE" ]; then
1167         find_module "$FBMODULE"
1168 fi
1169
1170 # autodetect USB keyboards
1171 find_modules_usbkbd
1172
1173 # allow forcing loading SCSI and/or IDE modules
1174 # XXX: where ADDSCSI cames from? drop?
1175 if is_yes "$ADDSCSI"; then
1176         find_modules_scsi
1177 fi
1178
1179 # autodetect SATA modules
1180 find_modules_sata
1181
1182 # XXX: where ADDIDE cames from? drop?
1183 if is_yes "$ADDIDE"; then
1184         find_modules_ide
1185 fi
1186
1187 if is_yes "$USE_SUSPEND"; then
1188         find_modules_suspend
1189 fi
1190
1191 find_root "$fstab" || exit
1192 debug "Using $rootdev as device for rootfs"
1193
1194 find_modules_for_devpath "$rootdev"
1195
1196 # if USE_MULTIPATH is path to device, scan that too
1197 # this is to bootstrap multipath setup into initrd.
1198 if ! is_no "$USE_MULTIPATH" && ! is_yes "$USE_MULTIPATH"; then
1199         find_modules_multipath $USE_MULTIPATH
1200 fi
1201
1202 find_module "-$rootFs"
1203
1204 for n in $BASICMODULES; do
1205         find_module "$n"
1206 done
1207
1208 if is_yes "$USE_TUXONICE"; then
1209         find_module "-lzf"
1210 fi
1211
1212 find_modules_fbsplash
1213
1214 if [ -n "$ifneeded" -a -z "$MODULES" ]; then
1215         debug "No modules are needed -- not building initrd image."
1216         exit 0
1217 fi
1218
1219 debug "Building initrd..."
1220 DESTDIR=$(mktemp -d -t initrd.XXXXXX) || die "mktemp failed"
1221 RCFILE="$DESTDIR/linuxrc"
1222 > "$RCFILE"
1223 chmod a+rx "$RCFILE"
1224 ln -s linuxrc $DESTDIR/init
1225
1226 # create dirs that we really need
1227 inst_d /{lib,bin,etc,dev{,/pts,/shm},loopfs,var,proc,sys}
1228
1229 modules_install "$MODULES"
1230
1231 # mknod'ing the devices instead of copying them works both with and
1232 # without devfs...
1233 mknod "$DESTDIR/dev/console" c 5 1
1234 mknod "$DESTDIR/dev/null" c 1 3
1235 mknod "$DESTDIR/dev/zero" c 1 5
1236 mknod "$DESTDIR/dev/random" c 1 8
1237 mknod "$DESTDIR/dev/urandom" c 1 9
1238
1239 inst_exec $busybox /bin/busybox
1240 ln -s busybox $DESTDIR/bin/sh
1241 # for older busyboxes who had /bin/initrd-busybox as EXEPATH
1242 ln -s busybox $DESTDIR/bin/initrd-busybox
1243
1244 add_linuxrc <<EOF
1245 #!/bin/sh
1246 # initrd generated by:
1247 # $GENINITRD_RCSID
1248
1249 EOF
1250 mount_proc
1251 add_linuxrc <<-'EOF'
1252         read CMDLINE < /proc/cmdline; export CMDLINE
1253
1254         for arg in $CMDLINE; do
1255                 if [ "${arg}" = "debuginitrd" ]; then
1256                         DEBUGINITRD=yes
1257                 fi
1258                 if [ "${arg##debuginitrd=}" != "${arg}" ]; then
1259                         DEBUGINITRD=${arg##debuginitrd=}
1260                 fi
1261                 if [ "${arg##root=}" != "${arg}" ]; then
1262                         ROOT=${arg##root=}
1263                 fi
1264                 if [ "${arg##rootfsflags=}" != "${arg}" ]; then
1265                         ROOTFSFLAGS=${arg##rootfsflags=}
1266                 fi
1267         done
1268
1269         # make debugshell() invoke subshell if $DEBUGINITRD=sh
1270         if [ "$DEBUGINITRD" = "sh" ]; then
1271                 debugshell() {
1272 EOF
1273 if is_yes "$RUN_SULOGIN_ON_ERR"; then
1274 add_linuxrc <<-'EOF'
1275         echo "debug shell disabled by /etc/sysconfig/system:RUN_SULOGIN_ON_ERR setting"
1276 EOF
1277 else
1278 add_linuxrc <<-'EOF'
1279         sh
1280 EOF
1281 fi
1282 add_linuxrc <<-'EOF'
1283                 }
1284         else
1285                 debugshell() {
1286                         :
1287                 }
1288         fi
1289
1290         if [ "$DEBUGINITRD" ]; then
1291                 set -x
1292         fi
1293 EOF
1294
1295 modules_add_linuxrc $MODULES
1296
1297 # TODO: rewrite for busybox
1298 #if [ -n "$loopDev" ]; then
1299 #       if [ ! -d /initrd ]; then
1300 #               mkdir /initrd
1301 #       fi
1302 #
1303 #       cp -a "$loopDev" "$DESTDIR/dev"
1304 #       cp -a "$rootdev" "$DESTDIR/dev"
1305 #       echo "echo Mounting device containing loopback root filesystem" >> "$RCFILE"
1306 #       echo "mount -t $loopFs $loopDev /loopfs" >> "$RCFILE"
1307 #       echo "echo Setting up loopback device $rootdev" >> $RCFILE
1308 #       echo "losetup $rootdev /loopfs$loopFile" >> "$RCFILE"
1309 #fi
1310
1311 if is_yes "$USE_UDEV"; then
1312         initrd_gen_udev
1313 fi
1314
1315 find_modules_uvesafb
1316 initrd_gen_uvesafb
1317
1318 initrd_gen_luks
1319 initrd_gen_dmraid
1320 initrd_gen_multipath
1321 initrd_gen_blkid
1322
1323 if is_yes "$have_nfs"; then
1324         initrd_gen_nfs
1325 else
1326         initrd_gen_md
1327         initrd_gen_lvm
1328         initrd_gen_luks
1329         initrd_gen_setrootdev
1330 fi
1331
1332 initrd_gen_tuxonice
1333 initrd_gen_suspend
1334
1335 # additional devs always needed
1336 [ ! -e "$DESTDIR/$rootdev_add" ] && inst $rootdev_add /dev
1337
1338 initrd_gen_stop_udevd
1339 initrd_gen_stop_uvesafb
1340
1341 if [ "$INITRDFS" = "initramfs" ]; then
1342         initrd_gen_initramfs_switchroot
1343 else
1344         umount_all
1345 fi
1346
1347 initrd_gen_fbsplash
1348 initrd_gen_fbcondecor
1349
1350 IMAGE=$(mktemp -t initrd.img-XXXXXX) || die "mktemp failed"
1351
1352 IMAGESIZE=$(du -ks $DESTDIR | awk '{print int(($1+1023+512)/1024)*1024}')
1353 debug "image size: $IMAGESIZE KiB ($DESTDIR)"
1354
1355 debug "Creating $INITRDFS image $IMAGE"
1356 case "$INITRDFS" in
1357   ext2)
1358         dd if=/dev/zero of="$IMAGE" bs=1k count="$IMAGESIZE" 2> /dev/null
1359         # NOTE: ext2 label is max 16 chars
1360         mke2fs -q -F -b 1024 -m 0 -L "PLD/$kernel" "$IMAGE" 2>/dev/null 1>&2
1361         tune2fs -i 0 "$IMAGE" >/dev/null 2>&1
1362
1363         local tmpmnt=$(mktemp -d -t initrd.mnt-XXXXXX)
1364         debug "Mounting ext2 image $IMAGE to $tmpmnt"
1365         mount -o loop -t ext2 "$IMAGE" "$tmpmnt" || die "mount failed, check dmesg(1)"
1366         # We don't need this directory, so let's save space
1367         rm -rf "$tmpmnt"/lost+found
1368
1369         debug "Copy recursively $DESTDIR -> $tmpmnt"
1370         cp -a $DESTDIR/* $tmpmnt
1371         umount "$IMAGE"
1372         rmdir "$tmpmnt"
1373
1374         ;;
1375   rom|romfs)
1376         genromfs -f "$IMAGE" -d "$DESTDIR" -V "PLD Linux/$kernel (geninitrd/$VERSION)"
1377         ;;
1378   cram|cramfs)
1379         mkcramfs "$DESTDIR" "$IMAGE"
1380         ;;
1381   initramfs)
1382         (cd $DESTDIR; find . | cpio --quiet -H newc -o > "$IMAGE")
1383         ;;
1384   *)
1385         die "Filesystem $INITRDFS not supported by $PROGRAM"
1386 esac
1387
1388 CONFIG_BLK_DEV_RAM_SIZE=$(ikconfig | awk -F= '/^CONFIG_BLK_DEV_RAM_SIZE/{print $2}')
1389 if [ -z "$CONFIG_BLK_DEV_RAM_SIZE" ]; then
1390         CONFIG_BLK_DEV_RAM_SIZE=4096
1391 fi
1392
1393 if [ "$IMAGESIZE" -gt $CONFIG_BLK_DEV_RAM_SIZE ]; then
1394         warn "Your image size is larger than $CONFIG_BLK_DEV_RAM_SIZE, Be sure to boot kernel with ramdisk_size=$IMAGESIZE!"
1395 fi
1396
1397 if ! is_no "$COMPRESS"; then
1398         compressor=$(find_compressor "$COMPRESS")
1399         debug "Compressing $target with $compressor"
1400
1401         # TODO: the image name (specified from kernel.spec) already contains
1402         # extension, which is .gz most of the time.
1403         compress_image "$compressor" "$IMAGE" "$target" || {
1404                 if [ $compressor != gzip ]; then
1405                         warn "Could not compress with $compressor, retrying with gzip"
1406                         compress_image gzip "$IMAGE" "$target" || die "compress failed with gzip" $?
1407                 else
1408                         die "Could not compress image with $compressor"
1409                 fi
1410         }
1411 else
1412         cp -a "$IMAGE" "$target"
1413 fi
1414
1415 # XXX. check if bootsplash can output data to tmp dir not directly to initramfs image.
1416 initrd_gen_bootsplash "$target"
1417
1418 rm -rf "$DESTDIR" "$IMAGE"
1419
1420 # vim:ts=4:sw=4:noet:fdm=marker
This page took 0.188701 seconds and 4 git commands to generate.