[arch-general] mkinitcpio - Possible patch for ext4 autodetection

Gerhard Brauer gerhard.brauer at web.de
Sat Dec 27 12:33:22 EST 2008


Hi, i modified the auto-detection function for file-system modules to
auto-detect a ext4 partition.
The advantage of using blkid instead of klibc-package/bin/fstype is
that blkid detects ext4 filesystems. I tried to rebuild klibc with
kernel 2.6.28, but this failed.

But maybe this could be a alternative method, and maybe better cause
klibc is often older than the kernel.

---------
--- /lib/initcpio/install/autodetect.org        2008-11-23 07:48:21.000000000 +0100
+++ /lib/initcpio/install/autodetect    2008-12-27 18:21:22.310364104 +0100
@@ -14,7 +14,7 @@
     findfs ()
     {
         for blkdev in $(find /dev -type b | grep -v -e loop -e ram -e fd); do
-            eval $(/usr/lib/klibc/bin/fstype 2>/dev/null < ${blkdev})
+           FSTYPE=$(blkid -o value -s TYPE ${blkdev})
             if [ -n "${FSTYPE}" -a "${FSTYPE}" != "swap" -a "${FSTYPE}" != "unknown" -a "${FSTYPE}" != "luks" -a "${FSTYPE}" != "lvm2" ]; then
                 echo ${FSTYPE}
             fi
@@ -50,6 +50,7 @@
         grep "^${modname}$" "${MODULE_FILE}" >/dev/null 2>&1 && continue
         case "${m}" in 
             #*/ieee1394/*) echo -e "sbp2\nsd_mod\nsr_mod" >> "${MODULE_FILE}";;
+           *ext4*) echo -e "jbd2\nmbcache\ncrc16" >> "${MODULE_FILE}" ;;
             *ext3*) echo "jbd" >> "${MODULE_FILE}" ;;
             *afs*) echo "rxrpc" >> "${MODULE_FILE}" ;;
             *cramfs*) echo "zlib_inflate" >> "${MODULE_FILE}" ;;
---------------

With this patch mkinitcpio -M detects the ext4 (and releated) modules,
and i could build a proper initrd image for booting from ext4 (with
grub2 as bootloader)

I don't want to file a bug/feature request while not tested enough.

Regards
	Gerhard


More information about the arch-general mailing list