Merge lp:~tom-gall/linaro-image-tools/linaro-media-create into lp:linaro-image-tools/11.11

Proposed by Tom Gall
Status: Superseded
Proposed branch: lp:~tom-gall/linaro-image-tools/linaro-media-create
Merge into: lp:linaro-image-tools/11.11
Diff against target: 64 lines (+18/-9)
1 file modified
linaro-media-create (+18/-9)
To merge this branch: bzr merge lp:~tom-gall/linaro-image-tools/linaro-media-create
Reviewer Review Type Date Requested Status
Loïc Minier (community) Disapprove
Review via email: mp+33843@code.launchpad.net

This proposal has been superseded by a proposal from 2010-08-27.

Description of the change

fixes lp:622979

Change correctly respects FAT_SIZE and replaces use of fdisk with sfdisk on MMC

To post a comment you must log in.
Revision history for this message
Loïc Minier (lool) wrote :

Hey

 * ensure_command fdisk util-linux appears twice now
 * you replace FDISK=$(fdisk ...) with FDISK=$(sfdisk ...); might make sense to rename, but it's ok in both cases
 * duplicating the whole sudo sfdisk is a bit ugly; consider defining part_type=0xC or part_type=0xE, and using that in the here doc
 * I'm pretty sure that 0xC is supported, since the Ubuntu ARM folks release images using 0xC; however you might have to ensure that mkfs.vfat is called with -F32 to generate a FAT32 if you actually use 0xC (which means the partition is expected to contain a FAT32); instead of supporting FAT16 and FAT32 in the script, I'd rather force FAT32 everywhere

Thanks,

review: Disapprove
Revision history for this message
Tom Gall (tom-gall) wrote :

Hi,

Thanks for reviewing my proposed patch.

> Hey
>
> * ensure_command fdisk util-linux appears twice now

no it doesn't.

From the diff:
-ensure_command fdisk util-linux # threre is a fdisk binary provided by gnu-fdisk as well
+ensure_command sfdisk util-linux
+ensure_command fdisk util-linux

> * you replace FDISK=$(fdisk ...) with FDISK=$(sfdisk ...); might make sense
> to rename, but it's ok in both cases
> * duplicating the whole sudo sfdisk is a bit ugly; consider defining
> part_type=0xC or part_type=0xE, and using that in the here doc

If you know how to do the following construct correctly in bash I'm all ears:

sudo sfdisk -D -H $HEADS -S $SECTORS $CYLINDER_ARG $partdev << 'THEEND'
,9,$PARTITION_TABLE,*
,,,-
THEEND

I'm not sure evaluation of $PARTITION_TABLE is possible in that kind of construct ergo the if statement. You'll note on line 95 in the script the same kind of if statement is used with the exact same construct.

> * I'm pretty sure that 0xC is supported, since the Ubuntu ARM folks release
> images using 0xC; however you might have to ensure that mkfs.vfat is called
> with -F32 to generate a FAT32 if you actually use 0xC (which means the
> partition is expected to contain a FAT32); instead of supporting FAT16 and
> FAT32 in the script, I'd rather force FAT32 everywhere

The historical default for the script has been a FAT16 boot partitions. I don't see why advocating changing the default to FAT32. As I understand via Torez she had mentioned that not all boards supported FAT32. While this could be a broken firmware statement (and I've certainly seen that on other architectures), I don't believe changing the default to be wise. The essence of the change now allows boards to adjust the setting.

> Thanks,

Regards,
Tom

Revision history for this message
Loïc Minier (lool) wrote :

> no it doesn't.

This is the diff I received over email for mp+33843 (this request) had:
 ensure_command parted parted
-ensure_command fdisk util-linux # threre is a fdisk binary provided by
gnu-fdisk as well
+ensure_command fdisk util-linux
+ensure_command sfdisk util-linux
+ensure_command fdisk util-linux
 ensure_command wget wget

it clearly listed fdisk twice in the new version; this was apparently fixed in the mean time. What I see here now is alright though.

> If you know how to do the following construct correctly in bash I'm all ears

Sure, here you go:

cat << THEEND
,9,$PART_TYPE,*
,,,-
THEEND

note the lack of single quotes around 'THEEND'. EOF is a more common here doc delimiter, but either is fine.

> The historical default for the script has been a FAT16 boot partitions. I don't see why advocating changing the default to FAT32. As I understand via Torez she had mentioned that not all boards supported FAT32. While this could be a broken firmware statement (and I've certainly seen that on other architectures), I don't believe changing the default to be wise. The essence of the change now allows boards to adjust the setting.

The historical defaults for the script were a partition type of 0xC (means FAT32) and an actual filesystem of type FAT16 (mkfs.vfat without args selects FAT16/32 depending on the size of the partition, which was small enough that it would select FAT16); these were inconsistent.

I'd rather have us fix the inconsistency and find a common format which works with all boards than maintain two formats and code pathes.

31. By Tom Gall

Fix to respect FAT_SIZE and not to use sfdisk for MMC targets - lp:NUMBER

32. By Tom Gall

Fix to add fstab entries for rootfs and boot

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro-media-create'
2--- linaro-media-create 2010-08-23 22:52:21 +0000
3+++ linaro-media-create 2010-08-27 16:05:56 +0000
4@@ -18,7 +18,8 @@
5
6 ensure_command uuidgen uuidgen-runtime
7 ensure_command parted parted
8-ensure_command fdisk util-linux # threre is a fdisk binary provided by gnu-fdisk as well
9+ensure_command sfdisk util-linux
10+ensure_command fdisk util-linux
11 ensure_command wget wget
12 ensure_command mkfs.ext3 e2fsprogs
13 ensure_command mkfs.ext4 e2fsprogs
14@@ -129,10 +130,18 @@
15 else
16 partdev=${MMC}
17 fi
18-# Create a VFAT partition of 9 cylinders which is about 64M
19+
20+if [ "$FAT_SIZE" = "32" ]; then
21+ PARTITION_TYPE="0x0C"
22+else
23+ PARTITION_TYPE="0x0E"
24+fi
25+
26+# Create a VFAT or FAT16 partition of 9 cylinders which is about 64M
27 # and a linux partition of the rest
28-sudo sfdisk -D -H $HEADS -S $SECTORS $CYLINDER_ARG $partdev << 'THEEND'
29-,9,0x0C,*
30+
31+sudo sfdisk -D -H $HEADS -S $SECTORS $CYLINDER_ARG $partdev << THEEND
32+,9,$PARTITION_TYPE,*
33 ,,,-
34 THEEND
35
36@@ -279,14 +288,14 @@
37
38 function check_mmc {
39 DISK_NAME="Disk|Platte"
40- FDISK=$(sudo fdisk -l | grep "[${DISK_NAME}] ${MMC}" | awk '{print $2}')
41+ FDISK=$(sudo sfdisk -l | grep "[${DISK_NAME}] ${MMC}" | awk '{print $2}')
42
43 if test "-$FDISK-" = "-$MMC:-"
44 then
45 echo ""
46 echo "I see..."
47- echo "sudo fdisk -l:"
48- sudo fdisk -l | grep "[${DISK_NAME}] /dev/" --color=never
49+ echo "sudo sfdisk -l:"
50+ sudo sfdisk -l | grep "[${DISK_NAME}] /dev/" --color=never
51 echo ""
52 echo "mount:"
53 mount | grep -v none | grep "/dev/" --color=never
54@@ -298,8 +307,8 @@
55 echo ""
56 echo "Are you sure? I Don't see [${MMC}], here is what I do see..."
57 echo ""
58- echo "sudo fdisk -l:"
59- sudo fdisk -l | grep "[${DISK_NAME}] /dev/" --color=never
60+ echo "sudo sfdisk -l:"
61+ sudo sfdisk -l | grep "[${DISK_NAME}] /dev/" --color=never
62 echo ""
63 echo "mount:"
64 mount | grep -v none | grep "/dev/" --color=never

Subscribers

People subscribed via source and target branches