From 9f85179b7fd706ddc9b5386dfae3514f16ca26f9 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 5 Jan 2010 23:56:23 +0100 Subject: Start moving from klibc to glibc+busybox Remove klibc-isms from base and init (except kinit, which will be done in a later commit) Install busybox to the initramfs and change /init so it can be used with busybox --- init | 10 +++++----- install/base | 21 +++++++++------------ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/init b/init index 8885b39..e77a0dc 100644 --- a/init +++ b/init @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/busybox ash +# Mount /proc so busybox can access /proc/self/exe +/bin/busybox mount -t proc proc /proc +# Install busybox's applets as symlinks +/bin/busybox --install -s . /init_functions msg ":: Loading Initramfs" - /bin/mount -t sysfs none /sys -/bin/mount -t proc none /proc read CMDLINE Date: Sun, 10 Jan 2010 17:25:22 +0100 Subject: Do not mount /proc before busybox --install - this requires CONFIG_BUSYBOX_EXEC_PATH="/bin/busybox" in busybox --- init | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init b/init index e77a0dc..c70d309 100644 --- a/init +++ b/init @@ -1,13 +1,12 @@ #!/bin/busybox ash -# Mount /proc so busybox can access /proc/self/exe -/bin/busybox mount -t proc proc /proc # Install busybox's applets as symlinks /bin/busybox --install -s . /init_functions msg ":: Loading Initramfs" -/bin/mount -t sysfs none /sys +/bin/mount -t proc proc /proc +/bin/mount -t sysfs sys /sys read CMDLINE Date: Sun, 10 Jan 2010 17:33:10 +0100 Subject: Remove kinit usage from /init: Implement parseblock and kinit in shell code, use busybox/switch_root for the final step. TODO: NFS --- init | 91 ++++++++++++++++++++++++++++++++++++------------------------ install/base | 1 + 2 files changed, 56 insertions(+), 36 deletions(-) diff --git a/init b/init index c70d309..892e7fd 100644 --- a/init +++ b/init @@ -11,9 +11,8 @@ msg ":: Loading Initramfs" read CMDLINE /proc/sys/kernel/modprobe # if available, start udevd at this stage @@ -31,8 +30,6 @@ for cmd in ${CMDLINE}; do [0123456Ss]) ;; [0-9]*) ;; single) ;; - #Allow "init=X" to pass-through - init=*) kinit_params="${kinit_params} ${cmd}" ;; # only export stuff that does work with dash :) *=*) cmd="$(replace -s= "${cmd}" '.' '_')" cmd="$(replace -s= "${cmd}" '-' '_')" @@ -77,8 +74,6 @@ done if [ -z "${rootdelay}" ] || ! [ "${rootdelay}" -ge 0 ]; then export rootdelay=10 fi -# We'll wait for the root device, so make sure klibc doesn't -export kinit_params="${kinit_params} rootdelay=0" if [ -e "/hooks" ]; then for h in ${HOOKS}; do @@ -100,38 +95,9 @@ if [ "${break}" = "y" ]; then PS1="ramfs$ " /bin/sh -i fi -# If we boot from NFS, don't check for a block device in /dev -# Let kinit do it all -if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then - if ! poll_device "${root}" ${rootdelay}; then - msg "\nRoot device '${root}' doesn't exist, attempting to create it" - - eval $(/bin/parseblock "${root}") - if [ -z "${BLOCKDEVICE}" ]; then - echo "ERROR: Failed to parse block device ids for '${root}'" - else - echo "/bin/mknod /dev/root b ${BLOCKDEVICE}" - /bin/mknod /dev/root b ${BLOCKDEVICE} >/dev/null - export root="/dev/root" - fi - if [ ! -b "${root}" -a ! -h "${root}" ]; then - err "Unable to detect or create root device '${root}'" - echo "You are being dropped to a recovery shell" - echo " Type 'reboot' to reboot" - echo " Type 'exit' to try and continue booting" - echo "" - echo "If the device '${root}' gets created while you are here," - echo "try adding 'rootdelay=10' or higher to the kernel command-line" - PS1="ramfs$ " /bin/sh -i - msg "Trying to continue (this will most likely fail)..." - fi - fi -fi - if [ -f "/message" ]; then msg "$(cat /message)" fi -msg ":: Initramfs Completed - control passing to kinit" #Special handling if udev is running udevpid=$(/bin/minips -C udevd -o pid=) @@ -140,4 +106,57 @@ if [ -n "${udevpid}" ]; then /bin/sleep 0.01 fi -exec /bin/kinit "$@" -- "root=${root}" ${kinit_params} > /dev/null 2>&1 +mkdir -p /new_root +if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then + if [ ${root:0:5} != "/dev/" ] || ! poll_device "${root}" ${rootdelay}; then + msg "\nRoot device '${root}' doesn't exist. Attempting to create it." + rootdev="" + if [ ${root:0:5} = "/dev/" ]; then + # It might be a block device (/dev/sda) + if [ -f /sys/block/${root:5}/dev ]; then + rootdev="$(cat /sys/block/${root:5}/dev | sed 's|:| |')" + # It might be a partition on any block device (/dev/sda1) + else + for dir in /sys/block/*; do + if [ -f ${dir}/${root:5}/dev ]; then + rootdev="$(cat /sys/block/${dir}/${root:5}/dev | sed 's|:| |')" + break + fi + done + fi + # It might be a major/minor pair (8:1) + elif echo ${root} | grep -q :; then + rootdev="$(echo ${root} | sed 's|:| |')" + root="/dev/root" + # It might be major/minor encoded as a single hex-number (lilo-style) (801) + elif [ ${#root} -le 4 -a ${#root} -gt 2 ] && echo "${root}" | grep -qe '^[A-Fa-f0-9]*$'; then + str_offset=$((${#root}-2)) + major=$(printf "%d" 0x${root:0:${str_offset}}) + minor=$(printf "%d" 0x${root:${str_offset}}) + rootdev="${major} ${minor}" + root="/dev/root" + fi + if [ -n "${rootdev}" ]; then + msg "Creating root device ${root} with major $(echo "${rootdev}" | cut -d\ -f1) and minor $(echo "${rootdev}" | cut -d\ -f2)." + mknod ${root} b ${rootdev} + else + err "Unable to determine major/minor number of root device '${root}'." + echo "You are being dropped to a recovery shell" + echo " Type 'reboot' to reboot" + echo " Type 'exit' to try and continue booting" + PS1="ramfs$ " /bin/sh -i + msg "Trying to continue (this will most likely fail) ..." + fi + fi + # We didn't build filesystem support into busybox, + # instead we use util-linux-ng's blkid for best compatibility + fstype=$(eval $(/sbin/blkid -o udev -p "${root}"); echo $ID_FS_TYPE) + mount ${fstype:+-t ${fstype}} -o ro "${root}" /new_root +else + # TODO: Actually implement this + err "Mounting NFS root is not implemented yet." +fi +umount /proc +umount /sys +[ -z "${init}" ] && init="/sbin/init" +exec /sbin/switch_root -c /dev/console /new_root ${init} "$@" diff --git a/install/base b/install/base index 43fc1cb..0972542 100644 --- a/install/base +++ b/install/base @@ -20,6 +20,7 @@ install () add_binary /lib/initcpio/busybox /bin/busybox add_binary /sbin/modprobe + add_binary /sbin/blkid add_file "/lib/initcpio/init_functions" "/init_functions" add_file "/lib/initcpio/init" "/init" -- cgit v1.2.3-24-g4f1b From a1d8b8d5ed63f78346ed4430c7fae3f4711f0782 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 10 Jan 2010 17:36:12 +0100 Subject: Make base hook help message more generic, remove klibc reference --- install/base | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/base b/install/base index 0972542..ff1be88 100644 --- a/install/base +++ b/install/base @@ -37,7 +37,7 @@ help () { cat < Date: Sun, 10 Jan 2010 17:49:41 +0100 Subject: Remove klibc-isms from autodetect: Use blkid for filesystem detection --- install/autodetect | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/install/autodetect b/install/autodetect index b3e6b90..0010da3 100644 --- a/install/autodetect +++ b/install/autodetect @@ -14,10 +14,7 @@ install () findfs () { for blkdev in $(find /dev -type b | grep -v -e /dev/loop -e /dev/ram -e /dev/fd); do - eval $(/usr/lib/klibc/bin/fstype 2>/dev/null < ${blkdev}) - if [ -n "${FSTYPE}" -a "${FSTYPE}" != "swap" -a "${FSTYPE}" != "unknown" -a "${FSTYPE}" != "luks" -a "${FSTYPE}" != "lvm2" ]; then - echo ${FSTYPE} - fi + (eval $(/sbin/blkid -o udev -p "${blkdev}"); [ "${ID_FS_USAGE}" = "filesystem" ] && echo $ID_FS_TYPE) done } -- cgit v1.2.3-24-g4f1b From 3fceb27acec3c2039639c6f9d205da24b3b68619 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 10 Jan 2010 18:20:49 +0100 Subject: Remove parseblock usage from resume hook, also fix resuming with tuxonice --- hooks/resume | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/hooks/resume b/hooks/resume index 0632fed..cd82e1c 100644 --- a/hooks/resume +++ b/hooks/resume @@ -3,18 +3,26 @@ run_hook () { fmtdevice () { echo "${1}:${2}"; } - if [ -n "${resume}" ] && poll_device "${resume}" ${rootdelay}; then - # Try resuming with tuxonice - tuxoniceroot="/sys/power/tuxonice" - if [ -d "${tuxoniceroot}" ]; then - echo ${resume} > ${tuxoniceroot}/resume - echo > ${tuxoniceroot}/do_resume + if [ -n "${resume}" ]; then + if grep -q ':' ${resume}; then + # Tux-on-ice syntax: swap:/dev/sda2 or file:/dev/sda2:0xdeadbeef + resumedev="$(echo ${resume} | cut -d: -f2)" + else + # Classical syntax: just a device + resumedev="${resume}" fi + if poll_device "${resumedev}" ${rootdelay}; then + # Try resuming with tuxonice + tuxoniceroot="/sys/power/tuxonice" + if [ -d "${tuxoniceroot}" ]; then + echo ${resume} > ${tuxoniceroot}/resume + echo > ${tuxoniceroot}/do_resume + fi - # Try resuming with vanilla hibernation - if [ -e "/sys/power/resume" ]; then - eval $(/bin/parseblock "${resume}") - fmtdevice ${BLOCKDEVICE} > /sys/power/resume + # Try resuming with vanilla hibernation + if [ -e "/sys/power/resume" ]; then + printf "%d:%d" $(stat -Lc "0x%t 0x%T" ${resume}) > /sys/power/resume + fi fi fi } -- cgit v1.2.3-24-g4f1b From a5b517dba551af7fd902464a5d866e2d5ce03508 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 10 Jan 2010 18:44:47 +0100 Subject: Add udev hook, originated from the obsolete klibc-udev package --- Makefile | 1 + hooks/udev | 8 ++++++++ install/udev | 28 ++++++++++++++++++++++++++++ load-modules.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 hooks/udev create mode 100644 install/udev create mode 100755 load-modules.sh diff --git a/Makefile b/Makefile index 413fae6..f9fd557 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ install: all install -D -m755 init ${DESTDIR}/lib/initcpio/init install -D -m755 init_functions ${DESTDIR}/lib/initcpio/init_functions install -D -m644 functions ${DESTDIR}/lib/initcpio/functions + install -D -m644 load-modules.sh ${DESTDIR}/lib/initcpio/udev/load-modules.sh install -d ${DESTDIR}/lib/initcpio/hooks install -d ${DESTDIR}/lib/initcpio/install diff --git a/hooks/udev b/hooks/udev new file mode 100644 index 0000000..57a90f7 --- /dev/null +++ b/hooks/udev @@ -0,0 +1,8 @@ +# vim: set ft=sh: +run_hook () +{ + msg -n ":: Triggering uevents..." + /sbin/udevadm trigger + /sbin/udevadm settle + msg "done." +} diff --git a/install/udev b/install/udev new file mode 100644 index 0000000..986dc58 --- /dev/null +++ b/install/udev @@ -0,0 +1,28 @@ +# vim:set ft=sh: + +install () +{ + MODULES="" + BINARIES="" + FILES=" /etc/udev/udev.conf" + SCRIPT="udev" + add_binary /sbin/udevd + add_binary /sbin/udevadm + for rules in 50-firmware.rules 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do + add_file /lib/udev/rules.d/${rules} + done + for tool in firmware.sh; do + add_file /lib/udev/${tool} + done + add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh +} + +help () +{ +cat < Date: Tue, 12 Jan 2010 00:30:45 +0100 Subject: Do not append a trailing /, remove it (fixed FS#17793) The comment said it was appending a trailing /, but it was actually removed Recent fixes adjusted the code to do what the comment says, which is wrong here. This fixes the code and the comment. --- mkinitcpio | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index e331da2..91dac25 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -175,10 +175,8 @@ if [ -n "${PRESET}" ]; then fi fi -# append a trailing / if needed -if [ "${BASEDIR}" = "${BASEDIR%/}" ]; then - BASEDIR="${BASEDIR}/" -fi +# remove trailing / from BASEDIR +BASEDIR="${BASEDIR%/}" MODULEDIR="${BASEDIR}/lib/modules/${KERNELVERSION}" -- cgit v1.2.3-24-g4f1b From 54fd0322ae780c13ab2804489a30944ca08cfa88 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 12 Jan 2010 00:41:46 +0100 Subject: Fix adding duplicate symlinks into the cpio image --- functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions b/functions index 7546088..7d692d9 100644 --- a/functions +++ b/functions @@ -92,7 +92,7 @@ add_symlink () dest="${2##$BASEDIR}" add_dir $(dirname "${dest}") add_dir $(dirname "${fil}") - if ! grep "slink ${dest} " "${FILELIST}" 2>&1 > /dev/null; then + if ! grep "slink ${fil} " "${FILELIST}" 2>&1 > /dev/null; then msg " adding link ${fil} -> ${dest}" echo "slink ${fil} ${dest} $(stat -c '%a' ${1}) 0 0" >> "${FILELIST}" fi -- cgit v1.2.3-24-g4f1b From cd0973a87d41a7a90808024861aff1af4d4d3096 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 12 Jan 2010 21:18:57 +0100 Subject: Replace the custom 'replace' tool with 'sed' --- init | 23 ++++++++++++----------- load-modules.sh | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/init b/init index 892e7fd..aa46c48 100644 --- a/init +++ b/init @@ -30,32 +30,33 @@ for cmd in ${CMDLINE}; do [0123456Ss]) ;; [0-9]*) ;; single) ;; - # only export stuff that does work with dash :) - *=*) cmd="$(replace -s= "${cmd}" '.' '_')" - cmd="$(replace -s= "${cmd}" '-' '_')" - export "${cmd}" + # only export stuff that does work with ash :) + *=*) rhs="$(echo "${cmd}" | cut -d= -f2-)" + cmd="$(echo "${cmd}" | cut -d= -f1 | sed 's|.|_|g')" + cmd="$(echo "${cmd}" | sed 's|-|_|g')=${rhs}" + (echo "${cmd}" | grep -qe '^[0-9]') || export "${cmd}" + ;; + *) cmd="$(echo "${cmd}" | sed 's|.|_|g')" + cmd="$(echo "${cmd}" | sed 's|-|_|g')" + (echo "${cmd}" | grep -qe '^[0-9]') || export "${cmd}=y" ;; - *) cmd="$(replace "${cmd}" '.' '_')" - cmd="$(replace "${cmd}" '-' '_')" - export "${cmd}=y" - ;; esac done if [ -n "${disablehooks}" ]; then - for d in $(replace "${disablehooks}" ','); do + for d in $(echo "${disablehooks}" | sed 's|,| |g'); do export "hook_${d}=disabled" done fi if [ -n "${disablemodules}" ]; then - for d in $(replace "${disablemodules}" ','); do + for d in $(echo "${disablemodules}" | sed 's|,| |g'); do export "mod_${d}=disabled" done fi if [ -n "${earlymodules}" ]; then - for m in $(replace "${earlymodules}" ','); do + for m in $(echo "${earlymodules}" | sed 's|,| |g'); do /sbin/modprobe -q ${m} > /dev/null 2>&1 done fi diff --git a/load-modules.sh b/load-modules.sh index 21767ca..f703088 100755 --- a/load-modules.sh +++ b/load-modules.sh @@ -7,7 +7,7 @@ MODPROBE="/sbin/modprobe" RESOLVEALIAS="/bin/resolve-modalias" USEBLACKLIST="--use-blacklist" -REPLACE="/bin/replace" +SED="/bin/sed" MODDEPS="/bin/moddeps" if [ -f /proc/cmdline ]; then @@ -19,12 +19,12 @@ if [ -f /proc/cmdline ]; then done #parse cmdline entries of the form "disablemodules=x,y,z" if [ -n "${disablemodules}" ]; then - BLACKLIST="$(${REPLACE} ${disablemodules} ',')" + BLACKLIST="$(echo "${disablemodules}" | ${SED} 's|,| |g')" fi fi # sanitize the module names -BLACKLIST="$(${REPLACE} "${BLACKLIST}" '-' '_')" +BLACKLIST="$(echo "${BLACKLIST}" | ${SED} 's|-|_|g')" if [ -n "${BLACKLIST}" ] ; then # Try to find all modules for the alias -- cgit v1.2.3-24-g4f1b From 9ca9d2fbf0af1f37678fb9835045141ac0cfc049 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 12 Jan 2010 21:26:45 +0100 Subject: Fix a small oops in the sed usage --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init b/init index aa46c48..94db351 100644 --- a/init +++ b/init @@ -32,11 +32,11 @@ for cmd in ${CMDLINE}; do single) ;; # only export stuff that does work with ash :) *=*) rhs="$(echo "${cmd}" | cut -d= -f2-)" - cmd="$(echo "${cmd}" | cut -d= -f1 | sed 's|.|_|g')" + cmd="$(echo "${cmd}" | cut -d= -f1 | sed 's|\.|_|g')" cmd="$(echo "${cmd}" | sed 's|-|_|g')=${rhs}" (echo "${cmd}" | grep -qe '^[0-9]') || export "${cmd}" ;; - *) cmd="$(echo "${cmd}" | sed 's|.|_|g')" + *) cmd="$(echo "${cmd}" | sed 's|\.|_|g')" cmd="$(echo "${cmd}" | sed 's|-|_|g')" (echo "${cmd}" | grep -qe '^[0-9]') || export "${cmd}=y" ;; -- cgit v1.2.3-24-g4f1b From 2538c6ce3382a394524d8a0f6a545f1a9f86ddbf Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 12 Jan 2010 21:31:52 +0100 Subject: Replace custom minips with busybox pidof --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 94db351..4904d12 100644 --- a/init +++ b/init @@ -101,7 +101,7 @@ if [ -f "/message" ]; then fi #Special handling if udev is running -udevpid=$(/bin/minips -C udevd -o pid=) +udevpid=$(/bin/pidof udevd) if [ -n "${udevpid}" ]; then /bin/kill -9 ${udevpid} > /dev/null 2>&1 /bin/sleep 0.01 -- cgit v1.2.3-24-g4f1b From 93a8be170ff841dd345084b5f5eda66c76e6534f Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 12 Jan 2010 21:36:38 +0100 Subject: Correct load-modules.sh permissions (+x was missing) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9fd557..9cb5bbe 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ install: all install -D -m755 init ${DESTDIR}/lib/initcpio/init install -D -m755 init_functions ${DESTDIR}/lib/initcpio/init_functions install -D -m644 functions ${DESTDIR}/lib/initcpio/functions - install -D -m644 load-modules.sh ${DESTDIR}/lib/initcpio/udev/load-modules.sh + install -D -m755 load-modules.sh ${DESTDIR}/lib/initcpio/udev/load-modules.sh install -d ${DESTDIR}/lib/initcpio/hooks install -d ${DESTDIR}/lib/initcpio/install -- cgit v1.2.3-24-g4f1b From b2093f6c9d4f039e7944aebfb6b5c558218dabc6 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 12 Jan 2010 22:13:33 +0100 Subject: Add keymap hook --- hooks/keymap | 15 +++++++++++++++ install/keymap | 29 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 hooks/keymap create mode 100644 install/keymap diff --git a/hooks/keymap b/hooks/keymap new file mode 100644 index 0000000..fd53f5f --- /dev/null +++ b/hooks/keymap @@ -0,0 +1,15 @@ +# vim: set ft=sh: +run_hook () +{ + msg -n ":: Loading keymap..." + . /keymap.utf8 + if [ "${UTF8}" = "yes" ]; then + /usr/bin/kbd_mode -u -C /dev/console + printf "\033%%G" >> /dev/console + else + /usr/bin/kbd_mode -a -C /dev/console + printf "\033%%@" >> /dev/console + fi + /sbin/loadkmap < /keymap.bin + msg "done." +} diff --git a/install/keymap b/install/keymap new file mode 100644 index 0000000..cb64e69 --- /dev/null +++ b/install/keymap @@ -0,0 +1,29 @@ +# vim: set ft=sh: + +install () +{ + MODULES="" + BINARIES="" + FILES="" + SCRIPT="keymap" + KEYMAP_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" + UTF8_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" + eval "$(grep -e "^LOCALE=" -e "^KEYMAP=" -e "^CONSOLEFONT=" -e "^CONSOLEMAP=" /etc/rc.conf)" + if [ -n "$(echo ${LOCALE} | grep -i utf)" ]; then + echo "UTF8='yes'" >> ${KEYMAP_FILE} + /bin/loadkeys -q -u $KEYMAP -b > ${KEYMAP_FILE} + else + echo "UTF8='no'" >> ${KEYMAP_FILE} + /bin/loadkeys -q $KEYMAP -b > ${KEYMAP_FILE} + fi + add_file ${KEYMAP_FILE} /keymap.bin + add_file ${UTF8_FILE} /keymap.utf8 +} + +help () +{ +cat< Date: Tue, 12 Jan 2010 22:34:06 +0100 Subject: Fix UTF8 mode in the keymap hook --- install/keymap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/keymap b/install/keymap index cb64e69..0ddd0e5 100644 --- a/install/keymap +++ b/install/keymap @@ -10,10 +10,10 @@ install () UTF8_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" eval "$(grep -e "^LOCALE=" -e "^KEYMAP=" -e "^CONSOLEFONT=" -e "^CONSOLEMAP=" /etc/rc.conf)" if [ -n "$(echo ${LOCALE} | grep -i utf)" ]; then - echo "UTF8='yes'" >> ${KEYMAP_FILE} + echo "UTF8='yes'" > ${UTF8_FILE} /bin/loadkeys -q -u $KEYMAP -b > ${KEYMAP_FILE} else - echo "UTF8='no'" >> ${KEYMAP_FILE} + echo "UTF8='no'" > ${UTF8_FILE} /bin/loadkeys -q $KEYMAP -b > ${KEYMAP_FILE} fi add_file ${KEYMAP_FILE} /keymap.bin -- cgit v1.2.3-24-g4f1b From 6cd3bb0e81a8bb13feffafb8f1ed30138f404b93 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Thu, 14 Jan 2010 13:04:14 +0100 Subject: Remove more klibc'isms from blacklisting code in load-modules.sh: - As in http://mailman.archlinux.org/pipermail/arch-commits/2010-January/072491.html, replace resolve-modalias with modprobe --resolve-alias - Remove usage of custom moddeps binary, replace it with the same 'sed' line as in /lib/udev/load-modules.sh --- load-modules.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/load-modules.sh b/load-modules.sh index f703088..68aa3f5 100755 --- a/load-modules.sh +++ b/load-modules.sh @@ -1,14 +1,13 @@ #! /bin/sh # Implement blacklisting for udev-loaded modules # Includes module checking -# - Aaron Griffin & Tobias Powalowski for Archlinux +# - Aaron Griffin, Tobias Powalowski & Thomas Bächler for Arch Linux [ $# -ne 1 ] && exit 1 MODPROBE="/sbin/modprobe" -RESOLVEALIAS="/bin/resolve-modalias" +RESOLVEALIAS="${MODPROBE} --resolve-alias" USEBLACKLIST="--use-blacklist" SED="/bin/sed" -MODDEPS="/bin/moddeps" if [ -f /proc/cmdline ]; then for cmd in $(cat /proc/cmdline); do @@ -34,8 +33,14 @@ if [ -n "${BLACKLIST}" ] ; then [ -z "${mods}" ] && $MODPROBE -qni $1 && mods="$1" && USEBLACKLIST="" [ -z "${mods}" ] && exit for mod in ${mods}; do - deps="$(${MODDEPS} ${mod})" + # Find the module and all its dependencies + deps="$($MODPROBE -i --show-depends ${mod})" [ $? -ne 0 ] && continue + + #sanitize the module names + deps="$(echo "$deps" | ${SED} \ + -e "s#^insmod /lib.*/\(.*\)\.ko.*#\1#g" \ + -e 's|-|_|g')" # If the module or any of its dependencies is blacklisted, don't load it for dep in $deps; do for blackmod in ${BLACKLIST}; do -- cgit v1.2.3-24-g4f1b From 880bc44f247e9b32d0c9aebd40d1a16a660fbf64 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Thu, 14 Jan 2010 17:49:45 +0100 Subject: Correct ${RESOLVEALIAS} usage that broke after the last commit --- load-modules.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load-modules.sh b/load-modules.sh index 68aa3f5..4631dac 100755 --- a/load-modules.sh +++ b/load-modules.sh @@ -27,7 +27,7 @@ BLACKLIST="$(echo "${BLACKLIST}" | ${SED} 's|-|_|g')" if [ -n "${BLACKLIST}" ] ; then # Try to find all modules for the alias - mods="$($RESOLVEALIAS /lib/modules/$(uname -r)/modules.alias $1)" + mods="$($RESOLVEALIAS $1)" # If no modules could be found, try if the alias name is a module name # In that case, omit the --use-blacklist parameter to imitate normal modprobe behaviour [ -z "${mods}" ] && $MODPROBE -qni $1 && mods="$1" && USEBLACKLIST="" -- cgit v1.2.3-24-g4f1b From 33e55e4c9d873550842a21e6071044b984b26c28 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 24 Jan 2010 14:57:29 +0100 Subject: Use modprobe --resolve-alias for resolving aliases in autodetect as Arch's udev 150-1 removes resolve-modalias --- functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions b/functions index 7d692d9..49b4ab4 100644 --- a/functions +++ b/functions @@ -4,7 +4,7 @@ auto_modules () aliases="$(find /sys/devices/ -name modalias -exec cat {} +)" mods="" for a in $aliases; do - m="$(resolve-modalias "/lib/modules/${KERNELVERSION}/modules.alias" "$a")" + m="$(modprobe --set-version ${KERNELVERSION} --resolve-alias "$a")" [ -n "$m" ] && mods="$mods $m" done -- cgit v1.2.3-24-g4f1b From ee8b48902037ecbccdeaed69ecc4bb947de4febc Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 24 Jan 2010 17:09:47 +0100 Subject: [install/udev] Latest udev uses firmware instead of firmware.sh --- install/udev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/udev b/install/udev index 986dc58..17a82c9 100644 --- a/install/udev +++ b/install/udev @@ -11,7 +11,7 @@ install () for rules in 50-firmware.rules 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do add_file /lib/udev/rules.d/${rules} done - for tool in firmware.sh; do + for tool in firmware; do add_file /lib/udev/${tool} done add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh -- cgit v1.2.3-24-g4f1b From 64f2af7521825e9171cc191c6136870cf8a81f54 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 24 Jan 2010 17:10:05 +0100 Subject: Install load-modules.sh to the tarball --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 9cb5bbe..f287664 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,7 @@ TARBALL_FILES = \ init \ init_functions \ install \ + load-modules.sh \ mkinitcpio \ mkinitcpio.conf \ mkinitcpio.d \ -- cgit v1.2.3-24-g4f1b From 7504fd6be397ac154ecd61ffab7b9fbafddc4a0c Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Fri, 29 Jan 2010 19:56:50 +0100 Subject: Nicer shell prompt in the break/emergency shell --- init | 4 ++-- init_functions | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/init b/init index 4904d12..6064f14 100644 --- a/init +++ b/init @@ -93,7 +93,7 @@ fi if [ "${break}" = "y" ]; then echo ":: Break requested, type 'exit' to resume operation" - PS1="ramfs$ " /bin/sh -i + launch_interactive_shell fi if [ -f "/message" ]; then @@ -145,7 +145,7 @@ if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then echo "You are being dropped to a recovery shell" echo " Type 'reboot' to reboot" echo " Type 'exit' to try and continue booting" - PS1="ramfs$ " /bin/sh -i + launch_interactive_shell msg "Trying to continue (this will most likely fail) ..." fi fi diff --git a/init_functions b/init_functions index 968258a..2692a2a 100644 --- a/init_functions +++ b/init_functions @@ -21,3 +21,7 @@ poll_device() { done [ -b "${device}" -o -h "${device}" ] } + +launch_interactive_shell() { + PS1='[ramfs \W]\$ ' /bin/sh -i +} -- cgit v1.2.3-24-g4f1b From af47b16bdc76608b7edb17fa6b80c18e53c775ec Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Fri, 5 Feb 2010 23:38:28 +0100 Subject: Respect rootfstype command line parameter --- init | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init b/init index 6064f14..508c473 100644 --- a/init +++ b/init @@ -151,7 +151,11 @@ if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then fi # We didn't build filesystem support into busybox, # instead we use util-linux-ng's blkid for best compatibility - fstype=$(eval $(/sbin/blkid -o udev -p "${root}"); echo $ID_FS_TYPE) + if [ -n "${rootfstype}" ]; then + fstype="${rootfstype}" + else + fstype=$(eval $(/sbin/blkid -o udev -p "${root}"); echo $ID_FS_TYPE) + fi mount ${fstype:+-t ${fstype}} -o ro "${root}" /new_root else # TODO: Actually implement this -- cgit v1.2.3-24-g4f1b From 6390dacd274faa6d960aa67d342a10a5388ef98f Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Fri, 5 Feb 2010 23:43:36 +0100 Subject: Remove the raid hook: This will be replaced by the better hook from the mdadm package --- hooks/raid | 9 --------- install/raid | 39 --------------------------------------- 2 files changed, 48 deletions(-) delete mode 100644 hooks/raid delete mode 100644 install/raid diff --git a/hooks/raid b/hooks/raid deleted file mode 100644 index cd1a920..0000000 --- a/hooks/raid +++ /dev/null @@ -1,9 +0,0 @@ -# vim: set ft=sh: -run_hook () -{ - #TODO scan for these somehow... - /sbin/modprobe -aq linear multipath raid0 raid1 raid456 raid10 >/dev/null 2>&1 - # md= can be specified multiple times. The simplistic commandline - # parsing does not handle this, so we will let mdassemble parse it - /bin/mdassemble ${CMDLINE} -} diff --git a/install/raid b/install/raid deleted file mode 100644 index 0b227d2..0000000 --- a/install/raid +++ /dev/null @@ -1,39 +0,0 @@ -# vim: set ft=sh: - -install () -{ - MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-") " - BINARIES="" - FILES="" - SCRIPT="raid" - add_file "/usr/lib/klibc/bin/mdassemble" "/bin/mdassemble" -} - -help () -{ -cat<,,,,dev0,dev1 - - for raid arrays with persistent superblocks: - md=,dev0,dev1,...,devn - - Parameters: - - = the number of the md device: - 0 means md0, 1 means md1, ... - - = -1 linear mode, 0 striped mode - other modes are only supported with persistent super block - - = (raid-0 and raid-1 only): - Set the chunk size as 4k << n. - - = totally ignored - - : e.g. /dev/hda1,/dev/hdc1,/dev/sda1,/dev/sdb1 -HELPEOF -} -- cgit v1.2.3-24-g4f1b From 3c6a2fab7e5a347d92bba152dca367fcbfabc3a6 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 10:55:34 +0100 Subject: Settle remaining uevents before killing udevd --- init | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init b/init index 508c473..cfa6c75 100644 --- a/init +++ b/init @@ -103,6 +103,8 @@ fi #Special handling if udev is running udevpid=$(/bin/pidof udevd) if [ -n "${udevpid}" ]; then + # Settle pending uevents, then kill udev + /sbin/udevadm settle /bin/kill -9 ${udevpid} > /dev/null 2>&1 /bin/sleep 0.01 fi -- cgit v1.2.3-24-g4f1b From a648fa6fcc9eb729ec6cb6b609f58f1ff5b7dfa3 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 11:05:10 +0100 Subject: Release 0.5.99.3 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f287664..8f6cd8a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for mkinitcpio -VERSION = 0.6.0a +VERSION = 0.5.99.3 all: doc -- cgit v1.2.3-24-g4f1b From c4dbe4cb2d740172f1199e8f3af23709477ea0de Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 14:23:07 +0100 Subject: Remove an extra whitespace from the emergency shell prompt --- init_functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_functions b/init_functions index 2692a2a..c0f10e9 100644 --- a/init_functions +++ b/init_functions @@ -23,5 +23,5 @@ poll_device() { } launch_interactive_shell() { - PS1='[ramfs \W]\$ ' /bin/sh -i + PS1='[ramfs \W]\$ ' /bin/sh -i } -- cgit v1.2.3-24-g4f1b From 0d7759576490af59d7fc54871495ef8bca9e56aa Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 14:34:01 +0100 Subject: Allow a filesystem name to be an alias instead of a kernel module This fixes future bugs in 2.6.33 when the ext4 driver is used for ext3 and ext2, and you want to mount ext2/3 as your root filesystem --- install/autodetect | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install/autodetect b/install/autodetect index 0010da3..adfee9f 100644 --- a/install/autodetect +++ b/install/autodetect @@ -20,10 +20,13 @@ install () if [ ${UID} -eq 0 -o "$(groups | grep disk)" != "" ]; then for fs in $(findfs | sort | uniq); do - for mod in $(find "${MODULEDIR}" -type f -name "${fs}.ko"); do - if [ -n "${mod}" ]; then - AUTODETECT="${AUTODETECT} ${mod}" - fi + allfs="${fs} $(modprobe --resolve-alias ${fs})" + for mod in ${allfs}; do + for modfile in $(find "${MODULEDIR}" -type f -name "${mod}.ko"); do + if [ -n "${modfile}" ]; then + AUTODETECT="${AUTODETECT} ${modfile}" + fi + done done done -- cgit v1.2.3-24-g4f1b From ba97db07a5bcbc5c0db2241a2f8ac4117d05c8f3 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 21:57:45 +0100 Subject: Honor the rootflags= command line option This fixes FS#18213. --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index cfa6c75..6a78965 100644 --- a/init +++ b/init @@ -158,7 +158,7 @@ if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then else fstype=$(eval $(/sbin/blkid -o udev -p "${root}"); echo $ID_FS_TYPE) fi - mount ${fstype:+-t ${fstype}} -o ro "${root}" /new_root + mount ${fstype:+-t ${fstype}} -o ro${rootflags:+,${rootflags}} "${root}" /new_root else # TODO: Actually implement this err "Mounting NFS root is not implemented yet." -- cgit v1.2.3-24-g4f1b From bf7b98936386ff88c0774589e40352824728ae96 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 22:06:55 +0100 Subject: Do not try to load the keymap if no KEYMAP option is set in rc.conf Fixes FS#18214 --- hooks/keymap | 22 ++++++++++++---------- install/keymap | 24 +++++++++++++----------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/hooks/keymap b/hooks/keymap index fd53f5f..9557c26 100644 --- a/hooks/keymap +++ b/hooks/keymap @@ -1,15 +1,17 @@ # vim: set ft=sh: run_hook () { - msg -n ":: Loading keymap..." - . /keymap.utf8 - if [ "${UTF8}" = "yes" ]; then - /usr/bin/kbd_mode -u -C /dev/console - printf "\033%%G" >> /dev/console - else - /usr/bin/kbd_mode -a -C /dev/console - printf "\033%%@" >> /dev/console + if [ -e /keymap.bin ]; then + msg -n ":: Loading keymap..." + . /keymap.utf8 + if [ "${UTF8}" = "yes" ]; then + /usr/bin/kbd_mode -u -C /dev/console + printf "\033%%G" >> /dev/console + else + /usr/bin/kbd_mode -a -C /dev/console + printf "\033%%@" >> /dev/console + fi + /sbin/loadkmap < /keymap.bin + msg "done." fi - /sbin/loadkmap < /keymap.bin - msg "done." } diff --git a/install/keymap b/install/keymap index 0ddd0e5..65990dd 100644 --- a/install/keymap +++ b/install/keymap @@ -6,18 +6,20 @@ install () BINARIES="" FILES="" SCRIPT="keymap" - KEYMAP_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" - UTF8_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" - eval "$(grep -e "^LOCALE=" -e "^KEYMAP=" -e "^CONSOLEFONT=" -e "^CONSOLEMAP=" /etc/rc.conf)" - if [ -n "$(echo ${LOCALE} | grep -i utf)" ]; then - echo "UTF8='yes'" > ${UTF8_FILE} - /bin/loadkeys -q -u $KEYMAP -b > ${KEYMAP_FILE} - else - echo "UTF8='no'" > ${UTF8_FILE} - /bin/loadkeys -q $KEYMAP -b > ${KEYMAP_FILE} + eval "$(grep -e "^LOCALE=" -e "^KEYMAP=" /etc/rc.conf)" + if [ -n "$KEYMAP" ]; then + KEYMAP_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" + UTF8_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" + if [ -n "$(echo ${LOCALE} | grep -i utf)" ]; then + echo "UTF8='yes'" > ${UTF8_FILE} + /bin/loadkeys -q -u $KEYMAP -b > ${KEYMAP_FILE} + else + echo "UTF8='no'" > ${UTF8_FILE} + /bin/loadkeys -q $KEYMAP -b > ${KEYMAP_FILE} + fi + add_file ${KEYMAP_FILE} /keymap.bin + add_file ${UTF8_FILE} /keymap.utf8 fi - add_file ${KEYMAP_FILE} /keymap.bin - add_file ${UTF8_FILE} /keymap.utf8 } help () -- cgit v1.2.3-24-g4f1b From d677a731301297c7bf4ffbe9c6735169150c4d4b Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 22:10:27 +0100 Subject: udev: Do not try to resolve any group/user names There is no nss library or user/group database in initramfs, so tell udev to not try to resolve any names --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 6a78965..823355c 100644 --- a/init +++ b/init @@ -19,7 +19,7 @@ echo "/sbin/modprobe" > /proc/sys/kernel/modprobe if [ -x /sbin/udevd ]; then msg ":: Starting udevd..." echo > /proc/sys/kernel/hotplug - /sbin/udevd --daemon + /sbin/udevd --daemon --resolve-names=never msg "done." fi -- cgit v1.2.3-24-g4f1b From f566ff5aafb01fd8078630cbc5b33b1c131f4866 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 22:14:37 +0100 Subject: Release 0.5.99.4 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8f6cd8a..3cfdb67 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for mkinitcpio -VERSION = 0.5.99.3 +VERSION = 0.5.99.4 all: doc -- cgit v1.2.3-24-g4f1b From 7a331bf5caf4e2df4e1db1c45ce0901106671030 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 7 Feb 2010 22:27:42 +0100 Subject: Remove firmware hook This hook is complete overkill: Firmware for modules is added when they specify it in modinfo. If someone needs more firmware, FILES= in mkinitcpio.conf should always be used. --- install/firmware | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 install/firmware diff --git a/install/firmware b/install/firmware deleted file mode 100644 index d03e274..0000000 --- a/install/firmware +++ /dev/null @@ -1,22 +0,0 @@ -# vim: set ft=sh: - -install () -{ - MODULES="" - BINARIES="" - FILES="" - SCRIPT="" - if [ -d /lib/firmware ]; then - add_full_dir /lib/firmware - else - err "No firmware files found!" - fi -} - -help () -{ -cat< Date: Sun, 7 Feb 2010 22:33:50 +0100 Subject: Adjust pcmcia hook: Use dynamically linked binaries and only add sd_mod to the kernel modules --- install/pcmcia | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/pcmcia b/install/pcmcia index b17ad27..8b685c5 100644 --- a/install/pcmcia +++ b/install/pcmcia @@ -5,13 +5,13 @@ install () MODULES=" $(checked_modules '/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')" MODULES=$(echo ${MODULES}) #trim whitespace if [ -n "${MODULES}" ]; then - MODULES="${MODULES} sd_mod sr_mod ide-gd_mod ide-cd_mod" + MODULES="${MODULES} sd_mod" fi BINARIES="" FILES="/etc/pcmcia/config.opts" SCRIPT="" - add_file "/lib/udev/pcmcia-socket-startup.static" "/lib/udev/pcmcia-socket-startup" - add_file "/lib/udev/pcmcia-check-broken-cis.static" "/lib/udev/pcmcia-check-broken-cis" + add_binary "/lib/udev/pcmcia-socket-startup" + add_binary "/lib/udev/pcmcia-check-broken-cis" add_file "/lib/udev/rules.d/60-pcmcia.rules" } -- cgit v1.2.3-24-g4f1b From e6d8a6ed2c1884072e6323072da7f1a5333e3b73 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Mon, 8 Feb 2010 10:41:25 +0100 Subject: Fix wrong syntax in the resume hook, finally fix tuxonice (hopefully) --- hooks/resume | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/hooks/resume b/hooks/resume index cd82e1c..f514eb6 100644 --- a/hooks/resume +++ b/hooks/resume @@ -4,7 +4,7 @@ run_hook () fmtdevice () { echo "${1}:${2}"; } if [ -n "${resume}" ]; then - if grep -q ':' ${resume}; then + if echo ${resume} | grep -q ':'; then # Tux-on-ice syntax: swap:/dev/sda2 or file:/dev/sda2:0xdeadbeef resumedev="$(echo ${resume} | cut -d: -f2)" else @@ -12,16 +12,18 @@ run_hook () resumedev="${resume}" fi if poll_device "${resumedev}" ${rootdelay}; then - # Try resuming with tuxonice - tuxoniceroot="/sys/power/tuxonice" - if [ -d "${tuxoniceroot}" ]; then - echo ${resume} > ${tuxoniceroot}/resume - echo > ${tuxoniceroot}/do_resume - fi - - # Try resuming with vanilla hibernation - if [ -e "/sys/power/resume" ]; then - printf "%d:%d" $(stat -Lc "0x%t 0x%T" ${resume}) > /sys/power/resume + if echo ${resume} | grep -q ':'; then + # Try resuming with tuxonice + tuxoniceroot="/sys/power/tuxonice" + if [ -d "${tuxoniceroot}" ]; then + echo ${resume} > ${tuxoniceroot}/resume + echo > ${tuxoniceroot}/do_resume + fi + else + # Try resuming with vanilla hibernation + if [ -e "/sys/power/resume" ]; then + printf "%d:%d" $(stat -Lc "0x%t 0x%T" ${resume}) > /sys/power/resume + fi fi fi fi -- cgit v1.2.3-24-g4f1b From 7ab7aad6b592e72ec04ddb497067594b7f708eeb Mon Sep 17 00:00:00 2001 From: Eric Bélanger Date: Mon, 8 Feb 2010 06:12:15 -0500 Subject: Fixed typo in comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eric Bélanger --- mkinitcpio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkinitcpio b/mkinitcpio index 91dac25..999901d 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -8,7 +8,7 @@ # variables should be quoted and bracketed "${SOMEVAR}" # inline execution should be done with $() instead of backticks # use -z "${var}" to test for nulls/empty strings -# incase of embedded spaces, quote all path names and string comarpisons +# in case of embedded spaces, quote all path names and string comparisons # -- cgit v1.2.3-24-g4f1b From 24e89b6cc03f821c3e2f36413ca64080bca21404 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Mon, 8 Feb 2010 19:50:44 +0100 Subject: Fix typo in the manpage (thanks Eric) --- mkinitcpio.5.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkinitcpio.5.txt b/mkinitcpio.5.txt index 56e5eae..3b70f6c 100644 --- a/mkinitcpio.5.txt +++ b/mkinitcpio.5.txt @@ -66,7 +66,7 @@ set up the udev device filesystem, load IDE modules, etc. About Presets ------------- -A preset is a pre-defined definition on how to create an initial ramdisk. Instead of specifying the configuration file and which output file, every time you generate a new intial ramdisk, you define a preset and use the -p switch to generate an initial ramdisk according to your preset. Presets are located in /etc/mkinitcpio.d +A preset is a pre-defined definition on how to create an initial ramdisk. Instead of specifying the configuration file and which output file, every time you generate a new initial ramdisk, you define a preset and use the -p switch to generate an initial ramdisk according to your preset. Presets are located in /etc/mkinitcpio.d Files ----- -- cgit v1.2.3-24-g4f1b From 7d99fdb862b10e9019e5be78ad7afb6c1ae7f8c0 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 8 Feb 2010 22:56:17 -0300 Subject: Fix path when looking at /sys/block for rootdev otherwise will access to /sys/block//sys/block/sda/sda1/dev (for example) Signed-off-by: Gerardo Exequiel Pozzi --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 823355c..88cefc1 100644 --- a/init +++ b/init @@ -122,7 +122,7 @@ if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then else for dir in /sys/block/*; do if [ -f ${dir}/${root:5}/dev ]; then - rootdev="$(cat /sys/block/${dir}/${root:5}/dev | sed 's|:| |')" + rootdev="$(cat ${dir}/${root:5}/dev | sed 's|:| |')" break fi done -- cgit v1.2.3-24-g4f1b From 82e9837b9661ead8f78023ef645c7b6679786739 Mon Sep 17 00:00:00 2001 From: Simon Boulay Date: Mon, 8 Feb 2010 19:44:53 +0100 Subject: Add support for mounting root filesystem over NFS. --- hooks/net | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ init | 11 ++++++++-- install/net | 11 ++++++---- 3 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 hooks/net diff --git a/hooks/net b/hooks/net new file mode 100644 index 0000000..9b97e39 --- /dev/null +++ b/hooks/net @@ -0,0 +1,72 @@ +# vim: set ft=sh: +run_hook () +{ + local line i address rootserver rootpath + + : > /ip_opts + + if [ -n "${ip}" ]; then + # setup network and save some values + ipconfig "${ip}" | while read line; do + # echo ":: ${line}" + if [ "${line#"IP-Config:"}" != "${line}" ]; then + continue + fi + line="$(echo ${line} | sed -e 's/ :/:/g;s/: /=/g')" + for i in ${line}; do + case "${i}" in + address=*) + echo "${i}" >> /ip_opts + ;; + netmask=*) + echo "${i}" >> /ip_opts + ;; + gateway=*) + echo "${i}" >> /ip_opts + ;; + dns0=*) + echo "${i}" >> /ip_opts + ;; + dns1=*) + echo "${i}" >> /ip_opts + ;; + rootserver=*) + echo "${i}" >> /ip_opts + ;; + rootpath=*) + echo "${i}" >> /ip_opts + ;; + esac + done + done + + . /ip_opts + + echo "IP-Config: ${address}/${netmask}" + echo "IP-Config: gw: ${gateway} dns0: ${dns0} dns1: ${dns1}" + + # calculate nfs_server, nfs_path and nfs_option for later nfs mount + if [ "${root}" = "/dev/nfs" -o "${nfsroot}" != "" ]; then + # default rootpath + if [ "${rootpath}" = "" ]; then + rootpath="/tftpboot/${address}" + fi + + # parse nfsroot + line="${nfsroot}" + nfs_server="${line%%:*}" + [ "${nfs_server}" = "${line}" ] && nfs_server="${rootserver}" + line="${line#*:}" + nfs_path="${line%%,*}" + line="${line#"${nfs_path}"}" + [ "${nfs_path}" = "" ] && nfs_path="${rootpath}" + nfs_option="${line#","}" + + # ensure root and filesystem type are set proper for nfs boot + root="/dev/nfs" + rootfstype="nfs" + + echo "NFS-root: ${nfs_server}:${nfs_path}" + fi + fi +} diff --git a/init b/init index 88cefc1..05ec3d5 100644 --- a/init +++ b/init @@ -160,8 +160,15 @@ if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then fi mount ${fstype:+-t ${fstype}} -o ro${rootflags:+,${rootflags}} "${root}" /new_root else - # TODO: Actually implement this - err "Mounting NFS root is not implemented yet." + if [ -z "$nfs_server" -o -z "$nfs_path" ]; then + err "Unable to mount root filesystem over NFS: wrong parameters." + echo "You are being dropped to a recovery shell" + echo " Type 'reboot' to reboot" + echo " Type 'exit' to try and continue booting" + launch_interactive_shell + msg "Trying to continue (this will most likely fail) ..." + fi + nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" /new_root fi umount /proc umount /sys diff --git a/install/net b/install/net index 69359e9..7b31c09 100644 --- a/install/net +++ b/install/net @@ -6,7 +6,10 @@ install () BINARIES="" FILES="" - SCRIPT="" + SCRIPT="net" + + add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig" + add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount" } help () @@ -97,10 +100,10 @@ cat< Date: Tue, 9 Feb 2010 20:32:43 +0100 Subject: Remove the comment about 'reboot': busybox reboot requires init to run, thus typing reboot is ineffective --- init | 2 -- 1 file changed, 2 deletions(-) diff --git a/init b/init index 05ec3d5..cf55e51 100644 --- a/init +++ b/init @@ -145,7 +145,6 @@ if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then else err "Unable to determine major/minor number of root device '${root}'." echo "You are being dropped to a recovery shell" - echo " Type 'reboot' to reboot" echo " Type 'exit' to try and continue booting" launch_interactive_shell msg "Trying to continue (this will most likely fail) ..." @@ -163,7 +162,6 @@ else if [ -z "$nfs_server" -o -z "$nfs_path" ]; then err "Unable to mount root filesystem over NFS: wrong parameters." echo "You are being dropped to a recovery shell" - echo " Type 'reboot' to reboot" echo " Type 'exit' to try and continue booting" launch_interactive_shell msg "Trying to continue (this will most likely fail) ..." -- cgit v1.2.3-24-g4f1b From 2cc35c56773bc0ee06d32622dd2254f03e52a867 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 9 Feb 2010 20:37:38 +0100 Subject: Honor the "rw" command line flag, but still make "ro" the default if nothing is specified --- init | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/init b/init index cf55e51..7d4b226 100644 --- a/init +++ b/init @@ -30,6 +30,8 @@ for cmd in ${CMDLINE}; do [0123456Ss]) ;; [0-9]*) ;; single) ;; + rw) readwrite="yes" ;; + ro) readwrite="no" ;; # only export stuff that does work with ash :) *=*) rhs="$(echo "${cmd}" | cut -d= -f2-)" cmd="$(echo "${cmd}" | cut -d= -f1 | sed 's|\.|_|g')" @@ -157,7 +159,12 @@ if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then else fstype=$(eval $(/sbin/blkid -o udev -p "${root}"); echo $ID_FS_TYPE) fi - mount ${fstype:+-t ${fstype}} -o ro${rootflags:+,${rootflags}} "${root}" /new_root + if [ "${readwrite}" = "yes" ]; then + rwopt="rw" + else + rwopt="ro" + fi + mount ${fstype:+-t ${fstype}} -o ${rwopt}${rootflags:+,${rootflags}} "${root}" /new_root else if [ -z "$nfs_server" -o -z "$nfs_path" ]; then err "Unable to mount root filesystem over NFS: wrong parameters." -- cgit v1.2.3-24-g4f1b From 6342c254a951db2c511730d54b209643e6bff6ff Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Wed, 10 Feb 2010 18:31:38 +0100 Subject: Release 0.5.99.5 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3cfdb67..0acb2e8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for mkinitcpio -VERSION = 0.5.99.4 +VERSION = 0.5.99.5 all: doc -- cgit v1.2.3-24-g4f1b From 6fdbf6edefb4371179783c2539d2f30c682bd155 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Wed, 10 Feb 2010 23:37:30 +0100 Subject: Add "consolefont" hook to set the console font early MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch provided by Davorin Učakar, currently only unicode fonts are supported --- hooks/consolefont | 10 ++++++++++ install/consolefont | 31 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 hooks/consolefont create mode 100644 install/consolefont diff --git a/hooks/consolefont b/hooks/consolefont new file mode 100644 index 0000000..8183844 --- /dev/null +++ b/hooks/consolefont @@ -0,0 +1,10 @@ +# vim: set ft=sh: + +run_hook () +{ + if [ -e /consolefont.psfu ]; then + msg -n ":: Loading console font..." + /usr/sbin/setfont -C /dev/console /consolefont.psfu + msg "done." + fi +} diff --git a/install/consolefont b/install/consolefont new file mode 100644 index 0000000..b39e3b0 --- /dev/null +++ b/install/consolefont @@ -0,0 +1,31 @@ +# vim: set ft=sh: + +install () +{ + MODULES="" + BINARIES="" + FILES="" + SCRIPT="consolefont" + if [ -n "$CONSOLEFONT" ]; then + CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz" + if [ -e ${CONSOLEFONT_FILE_GZ} ]; then + CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psfu.XXXXXX)" + zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE} + add_file ${CONSOLEFONT_FILE} /consolefont.psfu + else + echo "consolefont hook: Console font file must end with .psfu.gz" + echo "consolefont hook: Only unicode fonts are supported at the moment." + fi + fi +} + +help () +{ +cat< Date: Wed, 10 Feb 2010 19:44:22 -0300 Subject: Removed/changed messages/comments about klibc/kinit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also remove comment about "modload" in conf. Signed-off-by: Gerardo Exequiel Pozzi Signed-off-by: Thomas Bächler --- mkinitcpio | 9 ++++----- mkinitcpio.5.txt | 2 +- mkinitcpio.conf | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 999901d..0865482 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -1,10 +1,9 @@ #!/bin/bash # mkinitcpio - modular tool for building an init ramfs cpio image # -# IMPORTANT: We need to keep a common base syntax here -# because some of these hooks/scripts need to run under -# the klibc shell or even busybox's ash - therefore, the -# following constraints should be enforced: +# IMPORTANT: We need to keep a common base syntax here because +# some of these hooks/scripts need to run under busybox's ash - +# therefore, the following constraints should be enforced: # variables should be quoted and bracketed "${SOMEVAR}" # inline execution should be done with $() instead of backticks # use -z "${var}" to test for nulls/empty strings @@ -54,7 +53,7 @@ usage () echo " -g IMAGE Generate a cpio image as IMAGE. default: no" echo " -a NAME Append to an existing filelist. default: no" echo " -p PRESET Build specified preset." - echo " -m MESSAGE Print MESSAGE before passing control to kinit." + echo " -m MESSAGE Print MESSAGE before passing control to init." echo " -S SKIPHOOKS Skip SKIPHOOKS (comma-separated) when building the image." echo " -v Verbose output. Default: no" echo " -M Display modules found via autodetection." diff --git a/mkinitcpio.5.txt b/mkinitcpio.5.txt index 3b70f6c..1c095dc 100644 --- a/mkinitcpio.5.txt +++ b/mkinitcpio.5.txt @@ -37,7 +37,7 @@ Options Build initial ramdisk according to specified 'preset'. Presets are found in /etc/mkinitcpio.d *-m* 'message':: - Print 'message' before passing control to kinit. + Print 'message' before passing control to init. *-S* 'hooks':: Skip 'hooks' when generating the image. Several hooks should be comma-separated. diff --git a/mkinitcpio.conf b/mkinitcpio.conf index 7b2c98c..781d64a 100644 --- a/mkinitcpio.conf +++ b/mkinitcpio.conf @@ -30,7 +30,6 @@ FILES="" # help on a given hook. # 'base' is _required_ unless you know precisely what you are doing. # 'udev' is _required_ in order to automatically load modules -# 'modload' may be used in place of 'udev', but is not recommended # 'filesystems' is _required_ unless you specify your fs modules in MODULES # Examples: # This setup specifies all modules in the MODULES setting above. -- cgit v1.2.3-24-g4f1b From 866db5c57013a3648fc24100384da763b1c7fdef Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Thu, 11 Feb 2010 00:39:05 +0100 Subject: consolefont: Update error message --- install/consolefont | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/consolefont b/install/consolefont index b39e3b0..6e242a8 100644 --- a/install/consolefont +++ b/install/consolefont @@ -13,8 +13,8 @@ install () zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE} add_file ${CONSOLEFONT_FILE} /consolefont.psfu else - echo "consolefont hook: Console font file must end with .psfu.gz" - echo "consolefont hook: Only unicode fonts are supported at the moment." + echo "consolefont: Font file does not exist or does not end with .psfu.gz" + echo "consolefont: Only unicode fonts are supported at the moment." fi fi } -- cgit v1.2.3-24-g4f1b From a1e8a2cb279f89838a6757fe5f80c5ae37108ca7 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 10 Feb 2010 21:39:23 -0300 Subject: Fix tabs/space indents from commit 866db5c5 Signed-off-by: Gerardo Exequiel Pozzi --- hooks/consolefont | 6 +++--- install/consolefont | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hooks/consolefont b/hooks/consolefont index 8183844..f35869e 100644 --- a/hooks/consolefont +++ b/hooks/consolefont @@ -3,8 +3,8 @@ run_hook () { if [ -e /consolefont.psfu ]; then - msg -n ":: Loading console font..." - /usr/sbin/setfont -C /dev/console /consolefont.psfu - msg "done." + msg -n ":: Loading console font..." + /usr/sbin/setfont -C /dev/console /consolefont.psfu + msg "done." fi } diff --git a/install/consolefont b/install/consolefont index 6e242a8..67777b8 100644 --- a/install/consolefont +++ b/install/consolefont @@ -9,12 +9,12 @@ install () if [ -n "$CONSOLEFONT" ]; then CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz" if [ -e ${CONSOLEFONT_FILE_GZ} ]; then - CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psfu.XXXXXX)" - zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE} - add_file ${CONSOLEFONT_FILE} /consolefont.psfu - else - echo "consolefont: Font file does not exist or does not end with .psfu.gz" - echo "consolefont: Only unicode fonts are supported at the moment." + CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psfu.XXXXXX)" + zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE} + add_file ${CONSOLEFONT_FILE} /consolefont.psfu + else + echo "consolefont: Font file does not exist or does not end with .psfu.gz" + echo "consolefont: Only unicode fonts are supported at the moment." fi fi } -- cgit v1.2.3-24-g4f1b From d67250f427937cb4b6f75b27d47d35302bd9890b Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Thu, 11 Feb 2010 09:07:20 +0100 Subject: Fix file system autodetection of filesystems when the running kernel and the target kernel don't match. We need --set-version when resolving filesystem aliases, thanks Tobias. --- install/autodetect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/autodetect b/install/autodetect index adfee9f..6c9193c 100644 --- a/install/autodetect +++ b/install/autodetect @@ -20,7 +20,7 @@ install () if [ ${UID} -eq 0 -o "$(groups | grep disk)" != "" ]; then for fs in $(findfs | sort | uniq); do - allfs="${fs} $(modprobe --resolve-alias ${fs})" + allfs="${fs} $(modprobe --set-version ${KERNELVERSION} --resolve-alias ${fs})" for mod in ${allfs}; do for modfile in $(find "${MODULEDIR}" -type f -name "${mod}.ko"); do if [ -n "${modfile}" ]; then -- cgit v1.2.3-24-g4f1b