[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Support for MMC/SD cards - OK for Lenny?



Attached a series of relatively simple patches that
1) make it possible to use a SD card to load drivers or firmware from
2) allow to install Debian on a SD card
The patches have been tested for both purposes.

As the patches are fairly simple and we'll have to do another kernel 
upload anyway, I wonder if this could still be added for Lenny. Otavio?
The only missing patch in that case is one that adds the mmc-modules udeb 
to relevant installer images.

Cheers,
FJP

Description of the patches
--------------------------
Two of the patches are bugfixes and should be included in Lenny anyway.
Note that some of the patches don't have a changelog entry yet.

01-kernel-udebs.patch
New kernel udeb mmc-modules. Adds support for devices supported by sdhci 
and tifm_sd on amd64 and i386. Other arches can be added trivially, but 
I've not done so as I don't know which are relevant and cannot test them.

02-partman-base.patch
Adds human readable descriptions for MMC/SD cards.
To avoid breaking translations for Lenny I'd suggest adding the two new 
strings as untranslatable and only enabling translations post-Lenny.
I think this would be acceptable as the strings are probably fairly 
understandable in any language and very few people will see them anyway.

03-grub-installer.patch
Trivial changes for root/boot device parsing.

04-mountmedia-bugfix.patch
Fixes inconsistency between check-missing-firmware (hw-detect) and 
mountmedia I found while testing. Should be included in Lenny anyway.

05-list-changes-bugfix.patch
Without this fix 'list-devices partition' will incorrectly return the 
following for cciss, ida and mmcblk devices:
/dev/bdi
/dev/device
/dev/holders
/dev/mmcblk0p1
/dev/power
/dev/queue
/dev/slaves
/dev/subsystem

Reason is that for these devices matching is by name only (instead of 
using udevadm). Should be included in Lenny anyway.

06-list-changes.patch
Makes list-changes also list MMC/SD card disks and partitions.

commit 581fef80c2c06f7986dbb6b18fd6282f37684b17
Author: Frans Pop <fjp@debian.org>
Date:   Sun Sep 28 15:29:47 2008 +0200

    Add mmc-modules udeb to support MMC and SD cards
    
    For now support is only added for the sdhci and tifm_sd drivers
    on i386/amd64. The wbsd driver is excluded because it would mean
    adding a dependency on PCMCIA.

diff --git a/packages/kernel/kernel-wedge/debian/changelog b/packages/kernel/kernel-wedge/debian/changelog
index 54d05d7..0a4ffdf 100644
--- a/packages/kernel/kernel-wedge/debian/changelog
+++ b/packages/kernel/kernel-wedge/debian/changelog
@@ -1,3 +1,9 @@
+kernel-wedge (2.52) UNRELEASED; urgency=low
+
+  * Add mmc-modules udeb to support MMC and SD cards.
+
+ -- Frans Pop <fjp@debian.org>  Sun, 28 Sep 2008 15:18:27 +0200
+
 kernel-wedge (2.51) unstable; urgency=low
 
   * Move pata-sis to sata-modules since sata-sis depends on pata-sis and
diff --git a/packages/kernel/kernel-wedge/modules/mmc-modules b/packages/kernel/kernel-wedge/modules/mmc-modules
new file mode 100644
index 0000000..940afe9
--- /dev/null
+++ b/packages/kernel/kernel-wedge/modules/mmc-modules
@@ -0,0 +1,4 @@
+mmc_block
+sdhci
+ricoh_mmc
+tifm_sd
diff --git a/packages/kernel/kernel-wedge/package-list b/packages/kernel/kernel-wedge/package-list
index 3f79656..304e923 100644
--- a/packages/kernel/kernel-wedge/package-list
+++ b/packages/kernel/kernel-wedge/package-list
@@ -390,6 +390,13 @@ Description: ATA disk modules
  This package contains core ATA disk modules used by both PATA and SATA
  disk drivers.
 
+Package: mmc-modules
+Depends: kernel-image
+Priority: extra
+Description: MMC/SD card modules
+ This package contains modules needed to support MMC (multimedia) and
+ SD cards.
+
 Package: nbd-modules
 Depends: kernel-image
 Priority: extra
diff --git a/packages/kernel/linux-kernel-di-amd64-2.6/modules/amd64/mmc-modules b/packages/kernel/linux-kernel-di-amd64-2.6/modules/amd64/mmc-modules
new file mode 100644
index 0000000..dadfd53
--- /dev/null
+++ b/packages/kernel/linux-kernel-di-amd64-2.6/modules/amd64/mmc-modules
@@ -0,0 +1 @@
+#include <mmc-modules>
diff --git a/packages/kernel/linux-kernel-di-i386-2.6/modules/i386/mmc-modules b/packages/kernel/linux-kernel-di-i386-2.6/modules/i386/mmc-modules
new file mode 100644
index 0000000..dadfd53
--- /dev/null
+++ b/packages/kernel/linux-kernel-di-i386-2.6/modules/i386/mmc-modules
@@ -0,0 +1 @@
+#include <mmc-modules>
commit bba30931a890472b5333a1a1a3ac3b4232948468
Author: Frans Pop <fjp@debian.org>
Date:   Sun Sep 28 15:01:42 2008 +0200

    Add support for MMC/SD card devices

diff --git a/packages/arch/i386/grub-installer/grub-installer b/packages/arch/i386/grub-installer/grub-installer
index 501789a..81d2d3e 100755
--- a/packages/arch/i386/grub-installer/grub-installer
+++ b/packages/arch/i386/grub-installer/grub-installer
@@ -100,12 +100,14 @@ convert () {
 				  -e 's%\(fd[0-9]*\)$%\1%' \
 				  -e 's%/part[0-9]*$%/disc%' \
 				  -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
+				  -e 's%\(mmcblk[0-9]d[0-9]*\).*$%\1%' \
 				  -e 's%\(/mapper/mpath[0-9]\+\)-part[0-9]\+$%\1%')
 		tmp_part=$(echo "$1" | sed -e 's%.*/\(s\|h\|v\|xv\)d[a-z]\([0-9]*\)$%\2%' \
 				  -e 's%.*/fd[0-9]*$%%' \
 				  -e 's%.*/floppy/[0-9]*$%%' \
 				  -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \
 				  -e 's%.*c[0-7]d[0-9]*p*%%' \
+				  -e 's%.*mmcblk[0-9]d[0-9]*p%%' \
 				  -e 's%.*/mapper/mpath[0-9]\+-part\([0-9]\+\)%\1%')
 		;;
 	    gnu*)
@@ -249,7 +251,7 @@ esac
 rootfs_nodevfs=$(mapdevfs $rootfs)
 bootfs_nodevfs=$(mapdevfs $bootfs)
 prefix=$(echo "$bootfs" | \
-  sed 's:\(/dev/\(cciss\|ida\)/c[0-9]d[0-9]\|/dev/[a-z]\+\).*:\1:')
+  sed 's:\(/dev/\(cciss\|ida\)/c[0-9]d[0-9]\|/dev/mmcblk[0-9]\|/dev/[a-z]\+\).*:\1:')
 
 case $prefix in
     /dev/md)
@@ -258,7 +260,7 @@ case $prefix in
     /dev/mapper)
 	disc_offered_devfs="$bootfs"
 	;;
-    /dev/[hsv]d[a-z]|/dev/xvd[a-z]|/dev/cciss/c[0-9]d[0-9]|/dev/ida/c[0-9]d[0-9])
+    /dev/[hsv]d[a-z]|/dev/xvd[a-z]|/dev/cciss/c[0-9]d[0-9]|/dev/ida/c[0-9]d[0-9]|/dev/mmcblk[0-9])
 	disc_offered_devfs="$prefix"
 	;;
     *)
commit 6d337d2c9c8940b6bd570ca40c4416e232cd2f9f
Author: Frans Pop <fjp@debian.org>
Date:   Sun Sep 28 14:57:09 2008 +0200

    Add human readable descriptions for MMC/SD cards

diff --git a/packages/partman/partman-base/debian/partman-base.templates b/packages/partman/partman-base/debian/partman-base.templates
index a7601a0..701ec8d 100644
--- a/packages/partman/partman-base/debian/partman-base.templates
+++ b/packages/partman/partman-base/debian/partman-base.templates
@@ -277,6 +277,18 @@ Type: text
 # :sl1:
 _Description: SCSI%s (%s,%s,%s), partition #%s (%s)
 
+Template: partman/text/mmc_disk
+Type: text
+# For example MMC/SD card #1 (mmcblk0)
+# :sl3:
+_Description: MMC/SD card #%s (%s)
+
+Template: partman/text/mmc_partition
+Type: text
+# For example MMC/SD card #1, partition #2 (mmcblk0p2)
+# :sl3:
+_Description: MMC/SD card #%s, partition #%s (%s)
+
 Template: partman/text/raid_device
 Type: text
 # :sl3:
diff --git a/packages/partman/partman-base/lib/base.sh b/packages/partman/partman-base/lib/base.sh
index 0b0bff3..5a52a9e 100644
--- a/packages/partman/partman-base/lib/base.sh
+++ b/packages/partman/partman-base/lib/base.sh
@@ -796,6 +796,19 @@ humandev () {
 		printf "$RET" ".CCISS" "-" "$controller" "$lun" "$part" "$linux"
 	    fi
 	    ;;
+	/dev/mmcblk[0-9])
+	    drive=$(echo $1 | sed 's,^/dev/mmcblk\([0-9]\).*,\1,')
+	    linux=${1#/dev/}
+	    db_metaget partman/text/mmc_disk description
+	    printf "$RET" "$(($drive + 1))" "$linux"
+	    ;;
+	/dev/mmcblk[0-9]p[0-9]*)
+	    drive=$(echo $1 | sed 's,^/dev/mmcblk\([0-9]\).*,\1,')
+	    part=$(echo $1 | sed 's,^/dev/mmcblk[0-9]p\([0-9][0-9]*\).*,\1,')
+	    linux=${1#/dev/}
+	    db_metaget partman/text/mmc_partition description
+	    printf "$RET" "$(($drive + 1))" "$part" "$linux"
+	    ;;
 	/dev/md*|/dev/md/*)
 	    device=`echo "$1" | sed -e "s/.*md\/\?\(.*\)/\1/"`
 	    type=`grep "^md${device}[ :]" /proc/mdstat | sed -e "s/^.* : active raid\([[:alnum:]]\{,2\}\).*/\1/"`
commit 3b8850412a0b300e908ae618b43d97e47405e0a4
Author: Frans Pop <fjp@debian.org>
Date:   Sun Sep 28 17:19:31 2008 +0200

    MMC/SD card devices do not have a ID_TYPE variable, so match on name

diff --git a/packages/debian-installer-utils/debian/changelog b/packages/debian-installer-utils/debian/changelog
index 9600b23..f5f4e47 100644
--- a/packages/debian-installer-utils/debian/changelog
+++ b/packages/debian-installer-utils/debian/changelog
@@ -2,6 +2,7 @@ debian-installer-utils (1.65) UNRELEASED; urgency=low
 
   * When looking for partitions, only consider device subdirectories that end
     with a number to avoid matching directories such as power, slaves, etc.
+  * MMC/SD card devices do not have a ID_TYPE variable, so match on name.
 
  -- Frans Pop <fjp@debian.org>  Sun, 28 Sep 2008 17:11:40 +0200
 
diff --git a/packages/debian-installer-utils/list-devices b/packages/debian-installer-utils/list-devices
index 46d78db..b748be9 100755
--- a/packages/debian-installer-utils/list-devices
+++ b/packages/debian-installer-utils/list-devices
@@ -72,7 +72,7 @@ for x in $syspaths; do
 	fi
 	if ! $match && [ "$TYPE" = disk ]; then
 		case $devpath in
-		    /block/cciss\!*|/block/ida\!*|/block/rd\!*)
+		    /block/cciss\!*|/block/ida\!*|/block/rd\!*|/block/mmcblk*)
 			match=:
 			;;
 		esac
commit add57f3af3999f621e86b0310fc5484eb0e7927b
Author: Frans Pop <fjp@debian.org>
Date:   Sun Sep 28 17:05:30 2008 +0200

    Also look in firmware dir to match check-missing-firmware
    
    check-missing-firmware calls 'mountmedia driver' and then looks in the
    root directory and in a directory named firmware. This means that
    checkcontents() also needs to check for packages in /firmware/.

diff --git a/packages/mountmedia/debian/changelog b/packages/mountmedia/debian/changelog
index 5e67cb6..50a8f70 100644
--- a/packages/mountmedia/debian/changelog
+++ b/packages/mountmedia/debian/changelog
@@ -1,3 +1,11 @@
+mountmedia (0.18) UNRELEASED; urgency=low
+
+  * check-missing-firmware calls 'mountmedia driver' and then looks in the
+    root directory and in a directory named firmware. This means that
+    checkcontents() also needs to check for packages in /firmware/.
+
+ -- Frans Pop <fjp@debian.org>  Sun, 28 Sep 2008 16:44:12 +0200
+
 mountmedia (0.17) unstable; urgency=low
 
   * The script has not used the right name for the debconf template
diff --git a/packages/mountmedia/mountmedia b/packages/mountmedia/mountmedia
index 489a404..09a16a2 100755
--- a/packages/mountmedia/mountmedia
+++ b/packages/mountmedia/mountmedia
@@ -44,7 +44,8 @@ checkcontents() {
 		# Make sure this is driver media by checking the files on
 		# it. Check for regular debs, udebs, and to be on the safe
 		# side, check for *.ude files (msdos file names...)
-		for filename in $dir/*.deb $dir/*.udeb $dir/*.ude; do
+		for filename in $dir/*.deb $dir/*.udeb $dir/*.ude \
+		    $dir/firmware/*.deb $dir/firmware/*.udeb $dir/firmware/*.ude; do
 			if [ -f "$filename" ]; then
 				return 0 # success
 			fi
commit f5b2b13389b40657c944c70d7868b52298d9f20e
Author: Frans Pop <fjp@debian.org>
Date:   Sun Sep 28 17:16:41 2008 +0200

    Avoid reporting directories that are not partitions as partitions
    
    When looking for partitions, only consider device subdirectories that end
    with a number to avoid matching directories such as power, slaves, etc.

diff --git a/packages/debian-installer-utils/debian/changelog b/packages/debian-installer-utils/debian/changelog
index c583690..9600b23 100644
--- a/packages/debian-installer-utils/debian/changelog
+++ b/packages/debian-installer-utils/debian/changelog
@@ -1,3 +1,10 @@
+debian-installer-utils (1.65) UNRELEASED; urgency=low
+
+  * When looking for partitions, only consider device subdirectories that end
+    with a number to avoid matching directories such as power, slaves, etc.
+
+ -- Frans Pop <fjp@debian.org>  Sun, 28 Sep 2008 17:11:40 +0200
+
 debian-installer-utils (1.64) unstable; urgency=low
 
   [ Joey Hess ]
diff --git a/packages/debian-installer-utils/list-devices b/packages/debian-installer-utils/list-devices
index b86dea9..46d78db 100755
--- a/packages/debian-installer-utils/list-devices
+++ b/packages/debian-installer-utils/list-devices
@@ -32,7 +32,7 @@ syspaths=
 scan_partition=false
 case $TYPE in
     partition)
-	for x in /sys/block/*/*; do
+	for x in /sys/block/*/*[0-9]; do
 		[ -d "$x" ] || continue
 		syspaths="${syspaths:+$syspaths }$x"
 	done

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: