7 # based on mkinitrd from RedHat
13 VERSION="`echo "$RCSID"|awk '{print $3}'`"
15 . /etc/rc.d/init.d/functions
18 # INITRDFS is set later (catch obsoleted FS option)
27 # it should be safe to remove scsi_mod from here, but I'm not sure...
28 PRESCSIMODS="-scsi_mod unknown -sd_mod"
29 PREIDEMODS="-ide-core unknown -ide-detect -ide-disk"
30 PREIDEMODSOLD="-ide-probe -ide-probe-mod -ide-disk"
42 # default bootsplash is off, if it have to be on, install bootsplash package
44 # default same as bootsplash, if on install splashutils and some splashutils theme
47 # is /dev on tmpfs. internal variable
50 if [ -f /etc/udev/udev.conf -a -x /sbin/initrd-udev ]; then
55 if [ -x /sbin/dmraid-initrd ]; then
60 echo "usage: `basename $0` [--version] [-v] [-f] [--ifneeded] [--preload <module>]"
61 echo " [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]"
62 echo " [--initrdfs=rom|ext2|cram] [--modules-conf=<modules.conf>]"
63 echo " [--with-raidstart] [--without-raidstart] [--with-insmod-static]"
64 echo " [--without-bootsplash] [--without-fbsplash]"
65 echo " [--lvmtoolsversion=1|2] [--with-udev] [--without-udev]"
66 echo " [--without-suspend] [--without-suspend2] [--without-dmraid]"
67 echo " <initrd-image> <kernel-version>"
68 echo " (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)"
73 [ -n "$verbose" ] && echo "$*"
77 typeset mods module f level depfile first
79 depfile=/lib/modules/$kernel/modules.dep
81 if [ -f $depfile ] ; then
84 echo >&2 "Error: no $depfile ! Run depmod and rerun geninitrd."
88 # prepend / if no path given, append $modext.gz if not given,
91 module=$(echo "$2" | \
92 awk '/\// {print;next} {print "/" $0}' | \
93 awk '/\./ {print;next} {print $0 "'$modext'.gz"}' |
94 awk '{gsub("/","\\/");print}')
97 /'"$module"':(.*)/ { gsub(/:/," "); gsub(/\\/," "); print; here = 1; next }
99 /(.*)/ { gsub(/\\/," "); if (here) print }
102 # fallback to $modext
103 if [ "$mods" = "" ] ; then
104 module=$(echo "$module" | \
105 awk '{gsub("\'$modext'\.gz$","\'$modext'",$0);print}')
109 /'"$module"':(.*)/ { gsub(/:/," "); gsub(/\\/," "); print; here = 1; next }
111 /(.*)/ { gsub(/\\/," "); if (here) print }
114 if [ "$mods" = "" ] ; then
115 if [ "$1" != silent ] ; then
116 echo >&2 "$origmodule: module not found in $depfile"
118 if ! is_no "$EXIT_IF_MISSING" ; then
121 echo >&2 "If $origmodule isn't compiled in kernel then this initrd may not start your system."
126 if [ "$level" = "" ] ; then
130 if [ $level -gt 20 ] ; then
131 echo >&2 "$origmodule: cycle in $depfile"
137 if [ "$first" = "" ] ; then
140 find_depmod $1 $f $level
151 if [ ! -f "/lib/modules/$kernel/$fmPath" ]; then
152 if [ -n "$skiperrors" ]; then
156 echo >&2 "module $fmPath present in modules.dep, but not in filesystem (kernel = $kernel)"
160 # only need to add each module once
162 tmpFmPath=$(echo $fmPath | awk '{gsub(/\//,"\\/");print}')
163 if echo "$MODULES" | awk '/'"$tmpFmPath"'/ {exit 1}' ; then
164 MODULES="$MODULES $fmPath"
172 if [ ${modName#-} != ${modName} ]; then
178 if [ "$modName" = "pluto" ]; then
182 if [ "$modName" = "fcal" ]; then
187 if [ -n "$skiperrors" ]; then
188 allModulesToFind=$(find_depmod silent $modName)
190 allModulesToFind=$(find_depmod normal $modName)
196 for mod in $allModulesToFind; do
197 mod=$(echo $mod | awk '{sub(/^\/lib\/modules\/[^\/]*\//, ""); print}')
198 addmodule $mod "$skiperrors"
203 if [ "$#" != "2" ];then
204 echo "usage: inst <file> <destination>"
212 /sbin/e2label $1 2> /dev/null
216 /sbin/tune2fs -l $1 2> /dev/null | awk -F: '/UUID:/ {gsub(" ",""); print $2}'
220 /usr/sbin/xfs_db -x -p xfs_admin -c label -r "$1"|awk -F= '{sub("^\"","", $2); sub("\"$", "", $2); print $2}'
225 /usr/sbin/xfs_admin -u "$1" 2>/dev/null | awk -F= '{print $2}' | xargs
229 eval `awk '/^[\t ]*#/ {next} {if ( $2 == "/" ) {print "rootdev=\"" $1 "\"\nrootFs=\"" $3 "\""}}' $fstab`
232 if [ -x /sbin/findfs -a \( "$rootFs." = "ext2." -o "$rootFs." = "ext3." \) ] ; then
233 rootdev2="`/sbin/findfs $rootdev 2>/dev/null`"
234 if [ -n "$rootdev2" ] ; then
239 if [ "$rootdev_found." != "1." ] ; then
242 if [ ! -x /sbin/e2label ] ; then
243 echo >&2 "/sbin/e2label is missing"
246 get_label="get_label_ext2"
249 if [ ! -x /usr/sbin/xfs_db ] ; then
250 echo >&2 "/usr/sbin/xfs_db is missing"
253 get_label="get_label_xfs"
256 echo >&2 "LABEL on $rootFs in not supported by geninitrd"
260 if [ ! -r /proc/partitions ] ; then
261 echo >&2 '/proc/partitions is not readable'
264 label=${rootdev#"LABEL="}
265 for dev in `awk 'BEGIN {getline;getline} {print "/dev/" $4}' /proc/partitions` ; do
266 if [ -r $dev ] && [ "$label" = "`$get_label $dev`" ] ; then
267 debug "Using $dev as device for rootfs"
273 if [ "$rootdev_found." != "1." ] ; then
274 echo >&2 "geninitrd can't find real device for LABEL=$label"
280 if [ -x /sbin/findfs -a \( "$rootFs." = "ext2." -o "$rootFs." = "ext3." \) ] ; then
281 rootdev2="`/sbin/findfs $rootdev 2>/dev/null`"
282 if [ -n "$rootdev2" ] ; then
287 if [ "$rootdev_found." != "1." ] ; then
290 if [ ! -x /sbin/tune2fs ] ; then
291 echo >&2 "/sbin/tune2fs is missing"
294 get_uuid="get_uuid_ext2"
297 if [ ! -x /usr/sbin/xfs_admin ] ; then
298 echo >&2 "/usr/sbin/xfs_admin is missing"
301 get_uuid="get_uuid_xfs"
304 echo >&2 "UUID on $rootFs in not supported by geninitrd"
308 if [ ! -r /proc/partitions ] ; then
309 echo >&2 '/proc/partitions is not readable'
312 uuid=${rootdev#"UUID="}
313 for dev in $(awk 'BEGIN {getline;getline} {print "/dev/" $4}' /proc/partitions); do
314 if [ -r $dev ] && [ "$uuid" = "`$get_uuid $dev`" ] ; then
315 debug "Using $dev as device for rootfs"
321 if [ "$rootdev_found" != 1 ] ; then
322 echo >&2 "geninitrd can't find real device for UUID=$uuid"
331 find_modules_softraid() {
332 if [ -f /etc/mdadm.conf ]; then
333 debug "Finding RAID details using mdadm for rootdev=$1"
334 eval `/sbin/mdadm -v --examine --scan --config=/etc/mdadm.conf | awk -v rootdev="$1" '
339 rootdev_devfs = rootdev;
340 if (rootdev ~ /\/dev\/md\/[0-9]/) {
341 gsub(/\/dev\/md\//,"/dev/md",rootdev_devfs);
346 if (($2 == rootdev) || ($2 == rootdev_devfs)) {
348 gsub(/level=/,NUL,raidlevel);
349 if (raidlevel ~ /^raid([0-6]|10)/) {
350 gsub(/raid/,NUL,raidlevel);
354 if (x ~ /devices=/) {
356 gsub(".*devices=", NUL, dev_list);
357 gsub(",", " ", dev_list);
363 print "raidfound=" found;
364 print "raidlevel=" raidlevel;
365 print "dev_list=\"" dev_list "\"";
369 if [ "$raidfound" != "yes" -a -f /etc/raidtab ]; then
370 echo >&2 "ERROR: raidtools are not longer supported. Please migrate to mdadm setup!"
374 if is_yes "$raidfound" ; then
377 findmodule "raid$raidlevel"
383 echo >&2 "raid level $number (in mdadm config) not recognized"
387 echo >&2 "ERROR: RAID devices not found for \"$1\", check your configuration!"
391 rootdev_nr=$(( $rootdev_nr + 1 ))
392 eval "rootdev${rootdev_nr}=\"$1\""
393 eval "dev_list${rootdev_nr}=\"${dev_list}\""
395 for device in $dev_list; do
396 find_modules_for $device
400 find_modules_scsi() {
401 for n in $PRESCSIMODS; do
402 if [ "X$n" = "Xunknown" ] ; then
403 if [ -f "$modulefile" ]; then
404 scsimodules="`awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
405 for n in $scsimodules; do
406 # for now allow scsi modules to come from anywhere. There are some
407 # RAID controllers with drivers in block
420 rootdev="$(echo "$1" | awk ' { gsub(/\/dev\//,NUL); gsub(/[0-9].*/, NUL); print $0 } ')"
421 if [ "$pack_version_long" -lt "002004021" ]; then
422 debug "Finding IDE modules for kernels <= 2.4.20"
423 for n in $PREIDEMODSOLD; do
428 for n in $PREIDEMODS; do
429 if [ "X$n" = "Xunknown" ] ; then
430 if [ -f "$modulefile" ]; then
431 debug "Finding IDE modules using ide_hostadapter"
432 idemodules="`awk '/ide_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
433 for na in $idemodules; do
439 if [ "$tryauto" -eq 1 ]; then
441 if [ -r /usr/share/pci-database/ide.pci -a -r /proc/bus/pci/devices ]; then
442 debug "Finding IDE modules using PCI ID database"
443 # Finding IDE modules using PCI ID database {{{
444 if is_yes "${ide_only_root}"; then
445 if [ -f /sys/block/${rootdev}/device/../../vendor -a -f /sys/block/${rootdev}/device/../../device ]; then
446 vendorid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../vendor)"
447 deviceid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../device)"
448 searchpciid="${vendorid}${deviceid}"
449 elif [ -f /proc/ide/${rootdev}/../config ]; then
450 searchpciid="$(awk ' /pci bus/ { print $7$9 } ' /proc/ide/${rootdev}/../config)"
454 if [ -z "${searchpciid}" ]; then
455 searchpciid="$(awk ' { print $2 } ' /proc/bus/pci/devices)"
460 for nb in $searchpciid; do
461 eval `awk -v pciid="$nb" '{
467 compmod = $1 ""; # make sure comparison type will be string
468 # cause pci IDs are hexadecimal numeric
469 if (compmod == pciid) {
471 # min_kernel=$3; # now in ide.pci $3,$4 = vendor and device name
478 print "module=" module "\nmin_kernel=" min_kernel "\nmax_kernel=\"" max_kernel "\"\n";
479 }' /usr/share/pci-database/ide.pci`
480 [ -n "$module" ] && idemodules="$idemodules $module"
482 if is_yes "$(awk ' /ide=reverse/ { print "yes" } ' /proc/cmdline)"; then
484 for nc in idemodules; do
485 new_idemodules="$nc $new_idemodules"
487 idemodules="${new_idemodules}"
490 if [ -z "$idemodules" ]; then
491 echo "WARNING: rootfs on IDE device but no related modules found, loading ide-generic."
492 idemodules="ide-generic"
496 for nd in $idemodules; do
502 [ -r /usr/share/pci-database/ide.pci ] || echo "WARNING: /usr/share/pci-database/ide.pci missing."
503 [ -r /proc/bus/pci/devices ] || echo "WARNING: /proc/bus/pci/devices missing."
504 echo "Automatic IDE modules finding not available."
515 # resolve /dev/dm-0 to lvm2 node
516 # which they got from /proc/partitions when rootfs is UUID=
517 _lvm2_node_resolve() {
520 # redirect output to tmpfile so we won't get subshell
522 tmp=$(mktemp) || exit 1
524 lvdisplay -c 2>/dev/null|awk -F: '{print $1}' > $tmp
526 count=$(ls -Ll $dev $node | awk '{print $5, $6}' | sort -u | wc -l)
527 if [ "$count" = 1 ]; then
534 if [ -z "$ret" ]; then
540 # return true if node is lvm node
543 if [ ! -e "$node" ]; then
544 echo >&2 "WARNING: check_lvm(): node $node doesn't exist!"
548 # block-major-58 is lvm1
549 ls -lL "$node" 2> /dev/null | awk '{if (/^b/) { if ($5 == "58,") { exit 0; } else { exit 1; } } else { exit 1; }}'
553 debug "$node is LVM1 node"
558 node=$(_lvm2_node_resolve $node)
559 /sbin/lvm lvdisplay "$node" > /dev/null 2>&1
561 if [ $rc -gt 127 ]; then
562 # lvdisplay terminated by signal! most likely it segfaulted.
563 echo >&2 "ERROR: Unexpected exit from 'lvdisplay $node': $rc - are your lvm tools broken?"
568 debug "$node is lvm2 node"
570 debug "$node is not any lvm node"
577 echo "ERROR: no argument passed to find_modules_for() - is your /etc/fstab correct?" >&2
581 if is_yes "`echo "$1" | awk '/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:|\/dev\/nfs)/ { print "yes"; }'`"; then
582 if [ ! -x /usr/bin/pcidev -a -z "$NFS_ETH_MODULES" ] ; then
583 echo "ERROR: root on NFS but /usr/bin/pcidev not found." >&2
584 echo "Please install correct pci-database package and rerun $0." >&2
587 [ -z "$NFS_ETH_MODULES" ] && NFS_ETH_MODULES=$(/usr/bin/pcidev /m net | xargs)
588 for m in $NFS_ETH_MODULES; do
594 echo "Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel" >&2
595 echo "or you will have problems like init(xx) being child process of swapper(1)." >&2
596 elif is_yes "`echo "$1" | awk '/^\/dev\/md/ { print "yes"; }'`"; then
597 find_modules_softraid "$1"
598 elif is_yes "$(echo "$1" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')" ; then
600 elif is_yes "`echo "$1" | awk '/^\/dev\/(hd|ide)/ { print "yes"; }'`" ; then
601 find_modules_ide "$1"
602 elif is_yes "`echo "$1" | awk '/\/dev\/rd\// { print "yes"; }'`" ; then
604 elif is_yes "`echo "$1" | awk '/\/dev\/ida\// { print "yes"; }'`" ; then
605 findmodule "cpqarray"
606 elif is_yes "`echo "$1" | awk '/\/dev\/cciss\// { print "yes"; }'`" ; then
608 elif is_yes "`echo "$1" | awk '/\/dev\/ataraid\// { print "yes"; }'`"; then
611 ataraidmodules="`awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
612 if -n "$ataraidmodules" ; then
613 # FIXME: think about modules compiled in kernel
614 echo "ERROR: ataraid_hostadapter alias not defined in $modulefile !"
615 echo "Please set it and run $0 again."
618 for n in $ataraidmodules; do
621 # check to see if we need to set up a loopback filesystem
622 elif is_yes "`echo "$1" | awk -F/ '{print($3);}' | awk '/loop/ { print "yes"; }'`" ; then
623 echo >&2 "Sorry, root on loop device isn't supported."
625 # TODO: rewrite for bsp and make nfs ready
626 if [ ! -x /sbin/losetup ]; then
627 echo "losetup is missing"
630 key="^# $(echo $1 | awk -F/ '{print($3);}' | tr '[a-z]' '[A-Z]'):"
631 if ! is_yes "`awk '/'$key'/ { print( "yes"); }' $fstab`" ; then
632 echo >&2 "The root filesystem is on a $1, but there is no magic entry in $fstab"
633 echo >&2 "for this device. Consult the geninitrd man page for more information"
637 line="`awk '/'$key'/ { print $0; }' $fstab`"
638 loopDev="$(echo $line | awk '{print $3}')"
639 loopFs="$(echo $line | awk '{print $4}')"
640 loopFile="$(echo $line | awk '{print $5}')"
642 BASICMODULES="$BASICMODULES -loop"
643 findmodule "-$loopFs"
644 BASICMODULES="$BASICMODULES -${loopFs}"
645 elif _check_lvm "$1"; then
646 node=$(_lvm2_node_resolve "$1")
648 if [ ! -f /sbin/initrd-lvm -o ! -x /sbin/lvdisplay -o ! -x /sbin/pvdisplay ] ; then
649 echo "ERROR: root on LVM but /sbin/initrd-lvm, /sbin/lvdisplay and /sbin/pvdisplay not found." >&2
650 echo "Please install lvm(2) and lvm(2)-initrd package and rerun $0." >&2
653 if [ -z "$LVMTOOLSVERSION" ] ; then
654 LVMTOOLSVERSION=$(/sbin/initrd-lvm vgchange --version 2>/dev/null|head -n 1|awk '{gsub("vgchange: Logical Volume Manager ",NIL); gsub("LVM version: ",NIL); gsub(/\..*/,NIL); print $1}')
655 if [ -z "$LVMTOOLSVERSION" ] ; then
656 echo "ERROR: Can't determine LVM tools version. Please set LVMTOOLSVERSION" >&2
657 echo "and rerun $0." >&2
661 if [ -z "$PVDEVICES" ] ; then
662 VGVOLUME=$(/sbin/lvdisplay -c "$node" 2> /dev/null | awk -F":" ' { print $2 } ')
663 PVDEVICES=$(/sbin/pvdisplay -c | awk -F":" -v vg="$VGVOLUME" ' BEGIN { devices="" } { if ($2 == vg) { devices = devices " " $1 } } END { print devices } ')
665 if [ -n "$PVDEVICES" ] ; then
666 for device in $PVDEVICES; do
667 find_modules_for $device
670 echo "ERROR: I wasn't able to find PV (via lvdisplay and pvdisplay)." >&2
671 echo "You can try to set PVDEVICES in /etc/sysconfig/geninitrd." >&2
674 if [ "$LVMTOOLSVERSION" = "2" ]; then
676 elif [ "$LVMTOOLSVERSION" = "1" ]; then
678 findmodule "-lvm-mod"
680 echo "ERROR: LVM version $LVMTOOLSVERSION is not supported yet." >&2
683 debug "LVM $LVMTOOLSVERSION enabled"
688 firmware_install_module_pre() {
693 debug "Adding Firmwares ($firmware_files) to initrd for module $module"
694 mkdir -p $MNTIMAGE/proc
695 mkdir -p $MNTIMAGE/sys
696 # firmware not yet installed
697 if [ ! -f "$MNTIMAGE/lib/firmware/firmware.sh" ]; then
698 mkdir -p $MNTIMAGE/lib/firmware
699 cat << 'EOF' >> "$MNTIMAGE/lib/firmware/firmware.sh"
701 echo 1 > /sys$DEVPATH/loading
702 cat "/lib/firmware/$FIRMWARE" > /sys$DEVPATH/data
703 echo 0 > /sys$DEVPATH/loading
706 chmod 755 "$MNTIMAGE/lib/firmware/firmware.sh"
709 for firmware in $firmware_files; do
710 inst "/lib/firmware/$firmware" "$MNTIMAGE/lib/firmware/$firmware"
713 echo "mount -t proc none /proc" >> "$linuxrc"
714 echo "mount -t sysfs none /sys" >> "$linuxrc"
715 echo "echo -n "/lib/firmware/firmware.sh" > /proc/sys/kernel/hotplug" >> "$linuxrc"
718 firmware_install_module_post() {
722 echo "umount /sys" >> "$linuxrc"
723 echo "umount /proc" >> "$linuxrc"
729 for mod in $modules; do
730 MODULEDIR="`dirname "$mod"`"
731 mkdir -p "$MNTIMAGE/lib/modules/$kernel/$MODULEDIR"
732 cp -a "/lib/modules/$kernel/$mod" "$MNTIMAGE/lib/modules/$kernel/$mod"
733 gunzip "$MNTIMAGE/lib/modules/$kernel/$mod" 2> /dev/null
737 modules_add_linuxrc() {
741 for mod in $modules; do
742 MODULE2="`dirname "$mod"`"
743 NAME2=`basename "$mod" .gz`
744 MODULE2=$MODULE2/$NAME2
745 module="`echo $mod | awk -F/ '{ $0=$NF } /'$modext'.*$/ { gsub(/'$modext'.*/, NIL, $0); } { print $0; }'`"
746 options="`awk '{ if($1 == "options" && $2 == "'${module}'") { for(i=3;i<=NF;i++) printf("%s ",$i); }}' "$modulefile"`"
748 generic_module=$(echo "${module}" | awk ' { gsub("-", "_", $0) } { print $0; } ')
749 sleep_var="$(eval echo \$MODULE_${generic_module}_USLEEP)"
750 firmware_var="$(eval echo \$MODULE_${generic_module}_FIRMWARE)"
752 if [ -n "$verbose" ]; then
753 echo -n "Loading module [$module] "
754 if [ -n "$options" ] ; then
755 echo -n "with options [$options]"
757 echo -n "without options"
759 if [ -n "$sleep_var" ]; then
760 echo " and $sleep_var usleep."
766 if [ -n "$firmware_var" ]; then
767 firmware_install_module_pre "$module" "$linuxrc" "$firmware_var"
769 echo "$insmod /lib/modules/$kernel/$MODULE2 $options" >> "$linuxrc"
770 if [ -n "${sleep_var}" ]; then
771 echo "usleep $sleep_var" >> "$linuxrc"
773 if [ -n "$firmware_var" ]; then
774 firmware_install_module_post "$module" "$linuxrc" "$firmware_var"
779 if [ -r /etc/sysconfig/geninitrd ] ; then
780 . /etc/sysconfig/geninitrd
783 if [ -r /etc/sysconfig/bootsplash ] ; then
784 . /etc/sysconfig/bootsplash
787 if [ -r /etc/sysconfig/fbsplash ] ; then
788 . /etc/sysconfig/fbsplash
791 if [ ! -x /bin/initrd-busybox ] ; then
792 echo "/bin/initrd-busybox is missing !"
796 while [ $# -gt 0 ]; do
799 fstab="`echo $1 | awk -F= '{print $2;}'`"
806 modulefile="`echo $1 | awk -F= '{print $2;}'`"
812 --use-raidstart|--with-raidstart)
818 --use-insmod-static|--with-insmod-static)
819 USEINSMODSTATIC="yes"
821 --without-insmod-static)
824 --without-bootsplash)
836 --lvmtoolsversion=|--lvmversion=)
837 LVMTOOLSVERSION="`echo $1 | awk -F= '{print $2;}'`"
839 --lvmtoolsversion|--lvmversion)
853 BASICMODULES="$BASICMODULES `echo $1 | awk -F= '{print $2;}'`"
856 BASICMODULES="$BASICMODULES $2"
860 echo "geninitrd: version $VERSION"
876 PREMODS="$PREMODS `echo $1 | awk -F= '{print $2;}'`"
879 PREMODS="$PREMODS $2"
883 echo >&2 "Warning: --fs option is obsoleted. Use --initrdfs instead"
884 INITRDFS="`echo $1 | awk -F= '{print $2;}'`"
887 echo >&2 "Warning: --fs option is obsoleted. Use --initrdfs instead"
892 INITRDFS="`echo $1 | awk -F= '{print $2;}'`"
905 if [ -z "$target" ]; then
907 elif [ -z "$kernel" ]; then
918 if [ -z "$target" -o -z "$kernel" ]; then
922 pack_version="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d",$1,$2)}'`"
923 pack_version_long="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d%03d",$1,$2,$3)}'`"
925 if [ "x" = "x$INITRDFS" ] ; then
926 if [ "x" = "x$FS" ] ; then
928 if [ "$pack_version" -ge "002005" ] ; then
934 echo >&2 "Warning: FS configuration options is obsoleted. Use INITRDFS instead"
939 if [ "$pack_version" -lt "002006" ] ; then
944 if [ "$pack_version" -ge "002005" ] ; then
949 if is_yes "$USEINSMODSTATIC" ; then
950 insmod="insmod.static"
951 INSMOD="/sbin/insmod.static"
952 if [ "$pack_version" -lt "002005" -a -f /sbin/insmod.static.modutils ] ; then
953 INSMOD="/sbin/insmod.static.modutils"
955 if [ ! -f "$INSMOD" ] ; then
956 echo "insmod.static requested but /sbin/insmod.static not found !" >&2
963 if [ ! -x /sbin/mke2fs ]; then
964 echo >&2 "/sbin/mke2fs is missing"
969 if [ ! -x /sbin/genromfs ]; then
970 echo >&2 "/sbin/genromfs is missing"
975 if [ ! -x /sbin/mkcramfs ]; then
976 echo >&2 "/sbin/mkcramfs is missing"
981 if [ ! -x /bin/cpio ]; then
982 echo >&2 "/bin/cpio is missing"
985 if [ ! -x /usr/bin/find ]; then
986 echo >&2 "/usr/bin/find is missing"
991 echo >&2 "Filesystem $INITRDFS on initrd is not supported"
996 if [ -n "$img_vers" ]; then
997 target="$target-$kernel"
1000 if [ -z "$force" -a -f "$target" ]; then
1001 echo >&2 "$target already exists."
1005 if [ ! -d "/lib/modules/$kernel" ]; then
1006 echo >&2 "/lib/modules/$kernel is not a directory."
1010 if is_yes "$USE_SUSPEND"; then
1011 if is_yes "$USE_SUSPEND2"; then
1012 echo >&2 "Suspend2 shouldn't be used in parallel with mainline suspend!."
1017 if is_yes "$FB_SPLASH"; then
1018 if is_yes "$BOOT_SPLASH"; then
1019 echo >&2 "You can't use both bootsplash and fbsplash! Please choose one."
1021 elif [ "$INITRDFS" != "initramfs" ]; then
1022 echo >&2 "FB_SPLASH works only if INITRDFS is initramfs!."
1027 if [ ! -f /proc/mounts ]; then
1028 echo >&2 "WARNING: /proc filesystem not mounted, may cause wrong results or failure."
1031 if [ "$pack_version" -lt "002005" ]; then
1032 modulefile=/etc/modules.conf
1033 if [ ! -f "$modulefile" -a -f /etc/conf.modules ]; then
1034 modulefile=/etc/conf.modules
1037 modulefile=/etc/modprobe.conf
1040 for n in $PREMODS; do
1044 # allow forcing loading SCSI and/or IDE modules
1045 if is_yes "$ADDSCSI" ; then
1049 if is_yes "$ADDIDE" ; then
1055 org_rootdev="$rootdev1"
1057 find_modules_for "$rootdev1"
1059 findmodule "-$rootFs"
1061 for n in $BASICMODULES; do
1065 if is_yes "$USE_SUSPEND2"; then
1069 if is_yes "$FB_SPLASH"; then
1072 if [ -n "$ifneeded" -a -z "$MODULES" ]; then
1073 debug "No modules are needed -- not building initrd image."
1077 debug "Using modules: $MODULES"
1079 MNTIMAGE="`mktemp -d /tmp/initrd.XXXXXX`"
1080 IMAGE="`mktemp -u /tmp/initrd.img-XXXXXX`"
1081 MNTPOINT="`mktemp -d /tmp/initrd.mnt-XXXXXX`"
1082 RCFILE="$MNTIMAGE/linuxrc"
1084 if [ -f "$MNTIMAGE" ]; then
1085 echo >&2 "$MNTIMAGE already exists. Remove it and try again"
1089 if [ -f "$IMAGE" ]; then
1090 echo >&2 "$IMAGE already exists. Remove it and try again"
1094 mkdir -p "$MNTPOINT"
1097 mkdir -p "$MNTIMAGE"/{lib,bin,etc,dev,loopfs,var}
1100 # We don't need this directory, so let's save space
1101 rm -rf "$MNTPOINT"/lost+found
1103 modules_install "$MODULES"
1105 # mknod'ing the devices instead of copying them works both with and
1107 mknod "$MNTIMAGE/dev/console" c 5 1
1108 mknod "$MNTIMAGE/dev/null" c 1 3
1109 mknod "$MNTIMAGE/dev/zero" c 1 5
1112 ln -s /linuxrc $MNTIMAGE/init
1114 inst /bin/initrd-busybox "$MNTIMAGE/bin/initrd-busybox"
1115 ln -s initrd-busybox "$MNTIMAGE/bin/sh"
1116 ln -s initrd-busybox "$MNTIMAGE/bin/busybox" # for older busyboxes who had /bin/busybox as EXEPATH
1118 if is_yes "$USEINSMODSTATIC" ; then
1119 inst "$INSMOD" $MNTIMAGE/bin/insmod.static
1129 modules_add_linuxrc "$MODULES" "$s"
1131 # TODO: rewrite for busybox
1132 #if [ -n "$loopDev" ]; then
1133 # if [ ! -d /initrd ]; then
1137 # cp -a "$loopDev" "$MNTIMAGE/dev"
1138 # cp -a "$rootdev1" "$MNTIMAGE/dev"
1139 # echo "echo Mounting device containing loopback root filesystem" >> "$RCFILE"
1140 # echo "mount -t $loopFs $loopDev /loopfs" >> "$RCFILE"
1141 # echo "echo Setting up loopback device $rootdev1" >> $RCFILE
1142 # echo "losetup $rootdev1 /loopfs$loopFile" >> "$RCFILE"
1145 initrd_gen_suspend() {
1146 if [ ! -x /usr/sbin/resume ]; then
1147 echo "/usr/sbin/resume is missing !"
1150 mkdir -p $MNTIMAGE/etc
1151 mkdir -p $MNTIMAGE/dev
1152 resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
1153 cp -HR /dev/snapshot $resume_dev $MNTIMAGE/dev
1154 inst /etc/suspend.conf $MNTIMAGE/etc/suspend.conf
1155 inst /usr/sbin/resume "$MNTIMAGE/bin/resume"
1156 echo "resume" >> "$s"
1159 initrd_gen_suspend2() {
1160 mkdir -p $MNTIMAGE/sys
1161 mkdir -p $MNTIMAGE/proc
1162 cat << 'EOF' >> "$s"
1163 mount -t proc none /proc
1164 mount -t sysfs none /sys
1165 if [ "$(awk ' /resume2=/ { print "yes"; } ' /proc/cmdline)" = "yes" ]; then
1168 [ -e /proc/suspend2/do_resume ] && echo > /proc/suspend2/do_resume
1169 [ -e /sys/power/suspend2/do_resume ] && echo > /sys/power/suspend2/do_resume
1176 initrd_gen_tmpfs_dev() {
1180 mount -o mode=0755 -t tmpfs none /dev
1181 mknod /dev/console c 5 1
1182 mknod /dev/null c 1 3
1183 mknod /dev/zero c 1 5
1190 debug "Setting up udev..."
1191 mkdir -p $MNTIMAGE/sbin
1192 mkdir -p $MNTIMAGE/proc
1193 mkdir -p $MNTIMAGE/etc/udev
1194 mkdir -p $MNTIMAGE/sys
1196 inst /sbin/initrd-udev $MNTIMAGE/sbin/udev
1197 ln -s udev $MNTIMAGE/sbin/udevstart
1198 inst /etc/udev/udev.conf $MNTIMAGE/etc/udev/udev.conf
1200 ln -s udev $MNTIMAGE/sbin/hotplug
1202 if is_yes "$USE_UDEV"; then
1203 initrd_gen_tmpfs_dev >> "$s"
1205 mount -t proc none /proc
1206 mount -t sysfs none /sys
1209 echo -n /sbin/hotplug > /proc/sys/kernel/hotplug
1216 initrd_gen_dmraid() {
1217 if [ ! -x /sbin/dmraid-initrd ] ; then
1218 echo "/sbin/dmraid-initrd is missing missing !"
1222 # AFAIR it just needs tmpfs on /dev.
1223 if [ ! -x $MNTIMAGE/sbin/udev ]; then
1224 echo "udev is needed on target initrd for dmraid to work!"
1228 mkdir -p "$MNTIMAGE/sbin"
1229 inst /sbin/dmraid-initrd $MNTIMAGE/sbin/dmraid
1231 mount -t proc none /proc
1232 mount -t sysfs none /sys
1233 # 2 secs was enough for my system to initialize. but really this is udev issue?
1235 : 'Activating Device-Mapper RAID(s)'
1243 initrd_gen_softraid() {
1244 debug "Setting up mdadm..."
1246 if [ ! -x /sbin/mdadm -o ! -x /sbin/initrd-mdassemble ] ; then
1247 echo "/sbin/mdadm or /sbin/initrd-mdassemble is missing !"
1251 inst /sbin/initrd-mdassemble "$MNTIMAGE/bin/mdassemble"
1254 dev_list_extra=$(awk '/^DEVICE / { for (i=2; i<=NF; i++) { printf "%s ", $i; }; } ' /etc/mdadm.conf)
1255 for ex_dev in $dev_list_extra; do
1256 echo "DEVICE $ex_dev" >> "$MNTIMAGE/etc/mdadm.conf"
1259 for nr in `seq 1 $rootdev_nr`; do
1260 eval cr_rootdev="\$rootdev${nr}"
1261 eval cr_dev_list="\$dev_list${nr}"
1262 debug echo "Setting up array ($cr_rootdev = $cr_dev_list)"
1264 [ "$cr_rootdev" = "/dev/md0" ] && do_md0=0
1266 echo "DEVICE $cr_dev_list" >> "$MNTIMAGE/etc/mdadm.conf"
1267 cr_dev_list_md="$(echo "$cr_dev_list" | xargs | awk ' { gsub(/ +/,",",$0); print $0; }')"
1268 cr_md_conf=$(/sbin/mdadm --detail --brief --config=/etc/mdadm.conf $cr_rootdev)
1269 if [ -n "$cr_md_conf" ]; then
1270 echo "$cr_md_conf" >> "$MNTIMAGE/etc/mdadm.conf"
1272 echo "ARRAY $cr_rootdev devices=$cr_dev_list_md" >> "$MNTIMAGE/etc/mdadm.conf"
1275 for f in $cr_dev_list $cr_rootdev $dev_list_extra; do
1276 # mkdir in case of devfs name
1277 mkdir -p $MNTIMAGE/`dirname $f`
1278 [ -e "$MNTIMAGE/$f" ] && continue
1279 debug echo "copying $f"
1280 # this works fine with and without devfs
1281 cp -HR $f $MNTIMAGE/$f
1285 echo "mdassemble" >> "$s"
1287 # needed to determine md-version
1288 if [ "$do_md0" -eq 1 ] ; then
1289 mknod $MNTIMAGE/dev/md0 b 9 0
1294 # use root=/dev/ram0 init=/linuxrc when starting kernel or you will
1295 # have problems like init(XX) being child process of swapper(1).
1296 debug "Adding rootfs on NFS support to initrd (dhcp)"
1297 mknod "$MNTIMAGE/dev/urandom" c 1 8
1298 mkdir "$MNTIMAGE/newroot"
1299 mkdir "$MNTIMAGE/proc"
1300 echo "ifconfig lo 127.0.0.1 up" >> "$s"
1301 echo "route add -net 127.0.0.0 netmask 255.0.0.0 lo" >> "$s"
1302 echo "ifconfig eth0 0.0.0.0 up" >> "$s"
1303 echo "udhcpc -i eth0 -f -q -s /bin/setdhcp" >> "$s"
1304 cat << 'EOF' > "$MNTIMAGE/bin/setdhcp"
1306 [ "$1" != "bound" ] && exit
1307 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
1308 [ -n "$subnet" ] && NETMASK="netmask $subnet"
1310 ifconfig $interface $ip $BROADCAST $NETMASK up
1312 if [ -n "$router" ]; then
1313 for r in $router; do
1315 route add default gw $r dev $interface
1320 mount -t proc none /proc
1321 for o in $(cat /proc/cmdline); do
1324 rootpath=${o#nfsroot=}
1330 if [ -n "$rootpath" ]; then
1332 mount -n -t nfs -o ro,nolock,posix,tcp,wsize=8192,rsize=8192 $rootpath /newroot
1336 echo "Missing rootpath in what DHCP server sent to us. Failing..."
1337 echo "All seen variables are listed below:"
1342 chmod 755 "$MNTIMAGE/bin/setdhcp"
1343 echo "cd /newroot" >> "$s"
1344 echo "pivot_root . initrd" >> "$s"
1345 echo "[ -x /sbin/chroot ] && exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
1346 echo "exec /usr/sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
1350 debug "Adding LVM support to initrd"
1351 inst /sbin/initrd-lvm $MNTIMAGE/bin/lvm
1352 mkdir -p $MNTIMAGE/etc
1353 mkdir -p $MNTIMAGE/tmp
1354 mkdir -p $MNTIMAGE/proc
1355 mkdir -p $MNTIMAGE/newroot
1357 # always make /dev on tmpfs for LVM2
1358 if [ "$LVMTOOLSVERSION" = "2" ] && ! is_yes "$tmpfs_dev"; then
1359 initrd_gen_tmpfs_dev >> "$s"
1362 if ! is_yes "$tmpfs_dev"; then
1363 mkdir -p $MNTIMAGE/dev/mapper
1364 mknod $MNTIMAGE/dev/mapper/control c 10 63
1365 for device in $PVDEVICES; do
1366 # if LVM on RAID then device might be copied already in gen_softraid
1367 [ -e "$MNTIMAGE/dev/$(basename $device)" ] && continue
1368 cp -HR $device $MNTIMAGE/dev/
1371 echo "mount -t proc none /proc" >> "$s"
1372 echo "mount -t tmpfs none /tmp" >> "$s"
1373 if [ "$LVMTOOLSVERSION" = "1" ] ; then
1374 echo "lvm vgscan -T" >> "$s"
1375 echo "lvm vgchange -T -a y $VGVOLUME" >> "$s"
1376 echo "umount /tmp" >> "$s"
1378 echo "umount /dev" >> "$s"
1379 echo "umount /proc" >> "$s"
1381 org_rootdev=$(_lvm2_node_resolve "$org_rootdev")
1382 echo "cat /etc/lvm.conf > /tmp/lvm.conf" >> "$s"
1383 echo "global {" > "$MNTIMAGE/etc/lvm.conf"
1384 echo " locking_type = 0" >> "$MNTIMAGE/etc/lvm.conf"
1385 echo " locking_dir = \"/tmp\"" >> "$MNTIMAGE/etc/lvm.conf"
1386 echo "}" >> "$MNTIMAGE/etc/lvm.conf"
1387 echo "devices {" >> "$MNTIMAGE/etc/lvm.conf"
1388 echo " sysfs_scan=0" >> "$MNTIMAGE/etc/lvm.conf"
1389 if is_yes "$raidfound"; then
1390 echo " md_component_detection = 1" >> "$MNTIMAGE/etc/lvm.conf"
1392 lvm dumpconfig | awk '/filter=/' >> "$MNTIMAGE/etc/lvm.conf"
1393 echo "}" >> "$MNTIMAGE/etc/lvm.conf"
1396 : 'Making device nodes'
1399 # ignore first two lines, header and empty line
1402 while read major minor blocks dev; do
1403 mknod /dev/\$dev b \$major \$minor
1405 ) < /proc/partitions
1407 # disable noise from lvm accessing devices that aren't ready.
1408 printk=\$(cat /proc/sys/kernel/printk)
1409 echo 0 > /proc/sys/kernel/printk
1412 : 'Scanning for Volume Groups'
1413 LVM_SYSTEM_DIR=/tmp lvm vgscan --ignorelockingfailure 2>/dev/null
1415 : 'Activating Volume Groups'
1416 LVM_SYSTEM_DIR=/tmp lvm vgchange --ignorelockingfailure -a y $VGVOLUME 2>/dev/null
1418 echo "\$printk" > /proc/sys/kernel/printk
1420 # Find out major/minor
1421 majmin="\$(LVM_SYSTEM_DIR=/tmp lvm lvdisplay --ignorelockingfailure -c $org_rootdev 2>/dev/null)"
1422 majmin="\${majmin#*/}"
1423 majmin="\${majmin#*:*:*:*:*:*:*:*:*:*:*:*}"
1424 major="\${majmin%:*}"
1425 minor="\${majmin#*:}"
1427 val=\$((256 * \$major + \$minor))
1428 echo \$val > /proc/sys/kernel/real-root-dev
1435 initrd_gen_procdata() {
1436 debug "Adding rootfs finding based on root= option support."
1437 mkdir -p $MNTIMAGE/proc
1438 cat << 'EOF' >> "$s"
1440 mount -t proc none /proc
1441 root="$(busybox awk ' /root=\/dev\// { gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ' /proc/cmdline)"
1442 if [ -n "$root" ]; then
1443 rootnr="$(busybox awk -v root="$root" ' { if ($4 == root) { print 256*$1+$2; } } ' /proc/partitions)"
1444 if [ -n "$rootnr" ]; then
1445 echo "$rootnr" > /proc/sys/kernel/real-root-dev
1455 if is_yes "$USE_UDEV"; then
1459 if is_yes "$USE_SUSPEND"; then
1463 if is_yes "$USE_SUSPEND2"; then
1467 if is_yes "$USE_DMRAID"; then
1471 if is_yes "$usenfs" ; then
1473 elif is_yes "$USERAIDSTART" && is_yes "$raidfound" ; then
1475 if is_yes "$uselvm" ; then
1480 elif is_yes "$uselvm" ; then
1486 if [ "$INITRDFS" = "initramfs" ]; then
1487 mkdir -p $MNTIMAGE/newroot
1488 cp -HR $org_rootdev $MNTIMAGE/dev
1489 # Parsing root parameter
1490 # We support passing root as hda3 /dev/hda3 0303 0x0303
1491 cat << 'EOF' >> "$s"
1493 mount -t proc none /proc
1494 root="$(busybox awk -v prefix="root=" ' \
1495 function separate_root ( txt ) \
1497 gsub(/.*root=/,NIL,txt); \
1498 gsub(/ .*/,NIL,txt); \
1502 num_pattern = "[0-9][0-9][0-9][0-9]"; \
1503 dev_pattern = "[hms][a-z][a-z]([0-9])+"; \
1504 partition = "Metallica rocks!"; \
1505 min = -1; maj = -1; \
1507 $0 ~ prefix "0x" num_pattern { sub(/root=0x/,"root="); } \
1508 $0 ~ prefix num_pattern { \
1509 gsub(/.*root=/,NIL,partition); \
1510 gsub(/ .*/,NIL,partition); \
1511 partition = separate_root( $0 ); \
1512 maj = sprintf("%d",substr(partition,1,2)); \
1513 min = sprintf("%d",substr(partition,3)); \
1515 $0 ~ prefix "\/dev\/" dev_pattern { sub(/root=\/dev\//,"root="); } \
1516 $0 ~ prefix dev_pattern { \
1517 partition = separate_root( $0 ); \
1519 $4 ~ partition { maj = $1; min = $2; } \
1520 $1 ~ maj && $2 ~ min { partition = $4; } \
1521 END { print sprintf("/dev/%s %d %d", partition, maj, min); }
1522 ' /proc/cmdline /proc/partitions)"
1528 if [ ! -b $device ]; then
1529 mknod $device b $maj $min
1533 mount -t $rootFs \$device /newroot
1534 init="\$(busybox awk ' /init=\// { gsub(/.*init=/,NIL,\$0); gsub(/ .*/,NIL,\$0); print \$0; } ' /proc/cmdline )"
1535 if [ -z "\$init" -o ! -x "/newroot\$init" ]; then
1539 exec switch_root /newroot \$init
1541 # we need real file, not symlink
1542 rm -f $MNTIMAGE/init
1543 cp -a $MNTIMAGE/linuxrc $MNTIMAGE/init
1548 (cd "$MNTIMAGE"; tar cf - .) | (cd "$MNTPOINT"; tar xf -)
1552 IMAGESIZE=$(du -ks $MNTPOINT | awk '{print int(($1+1023+512)/1024)*1024}')
1553 debug "ext2 image size: $IMAGESIZE ($MNTPOINT)"
1554 if [ "$IMAGESIZE" -gt 4096 ]; then
1555 echo >&2 "$0: Your image size is larger than 4096, You should add ramdisk_size=$IMAGESIZE to your kernel commandline!"
1558 dd if=/dev/zero of="$IMAGE" bs=1k count="$IMAGESIZE" 2> /dev/null
1559 mke2fs -q -F -b 1024 -m 0 "$IMAGE" 2>/dev/null 1>&2
1560 tune2fs -i 0 "$IMAGE" >/dev/null 2>&1
1562 tmpmnt="`mktemp -d /tmp/initrd.mnte2-XXXXXX`"
1563 mount -o loop -t ext2 "$IMAGE" "$tmpmnt"
1565 (cd "$MNTPOINT"; tar cf - .) | (cd "$tmpmnt"; tar xf -)
1570 genromfs -f "$IMAGE" -d "$MNTPOINT" -V "PLD initrd for kernel $kernel"
1573 mkcramfs "$MNTPOINT" "$IMAGE"
1576 (cd $MNTPOINT ; find . | cpio -H newc -o > "$IMAGE")
1579 echo "Filesystem $INITRDFS not supported by $0";
1582 if is_yes "$COMPRESS" ; then
1583 gzip -9 < "$IMAGE" > "$target"
1585 cp -a "$IMAGE" "$target"
1588 if is_yes "$BOOT_SPLASH"; then
1589 if [ ! -x /bin/splash.bin ]; then
1590 echo >&2 "Failed to execute /bin/splash.bin. Is bootsplash package installed?"
1591 elif [ -z "$THEME" ]; then
1592 echo >&2 "Please configure your /etc/sysconfig/bootsplash first."
1593 echo >&2 "Generating bootsplashes skipped."
1595 if [ -n "$BOOT_SPLASH_RESOLUTIONS" ]; then
1596 for res in $BOOT_SPLASH_RESOLUTIONS; do
1597 if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" ]; then
1598 /bin/splash.bin -s -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> "$target" && \
1599 debug "Added $res $THEME theme to initrd."
1601 echo >&2 "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped"
1605 echo >&2 "No BOOT_SPLASH_RESOLUTIONS specified in /etc/sysconfig/bootsplash."
1606 echo >&2 "Not adding bootsplash to initrd."
1611 if is_yes "$FB_SPLASH"; then
1612 if [ ! -x /usr/bin/splash_geninitramfs ]; then
1613 echo >&2 "Failed to execute /usr/bin/splash_geninitramfs. Is splashutils package installed?"
1614 elif [ -z "$SPLASH_THEME" ]; then
1615 echo >&2 "Please configure your /etc/sysconfig/fbsplash first."
1616 echo >&2 "Generating fbsplashes skipped."
1618 if [ -n "$FB_SPLASH_RESOLUTIONS" ]; then
1619 for res in $FB_SPLASH_RESOLUTIONS; do
1620 if [ -f "/etc/splash/$SPLASH_THEME/$res.cfg" ]; then
1621 /usr/bin/splash_geninitramfs -a $target -r $res $SPLASH_THEME && \
1622 debug "Added $res $SPLASH_THEME theme to initramfs."
1624 echo >&2 "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
1628 echo >&2 "No FB_SPLASH_RESOLUTIONS specified in /etc/sysconfig/fbsplash."
1629 echo >&2 "Not adding fbsplash to initramfs."
1634 rm -rf "$MNTIMAGE" "$MNTPOINT" "$IMAGE"
1636 # vim:ts=4:sw=4:noet:fdm=marker