Merge lp:~liuyq0307/lava-master-image-scripts/add-sdcard into lp:lava-master-image-scripts

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 62
Proposed branch: lp:~liuyq0307/lava-master-image-scripts/add-sdcard
Merge into: lp:lava-master-image-scripts
Diff against target: 146 lines (+30/-5)
4 files modified
lava-create-master (+10/-0)
master-rootfs-extras/bin/lava-partition-disk (+18/-4)
master-rootfs-extras/lib/lava/common (+1/-0)
master-rootfs-extras/lib/lava/lava-master-init (+1/-1)
To merge this branch: bzr merge lp:~liuyq0307/lava-master-image-scripts/add-sdcard
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle (community) Approve
Dave Pigott Approve
Zygmunt Krynicki Pending
Review via email: mp+112257@code.launchpad.net

This proposal supersedes a proposal from 2012-06-18.

Description of the change

Add support to creating an sdcard partition into the sdcard disk.
But because the mmcblk0p8 is not supported,
so for Origen and iMX, the sdcard partition keep not used.

The addition of sdcard partition into sdcard disk in this branch will not affect the deployment for Origen and iMX boards.

To post a comment you must log in.
Revision history for this message
Spring Zhang (qzhang) wrote : Posted in a previous version of this proposal

imx53 bug is on https://bugs.launchpad.net/lava-master-image-scripts/+bug/1014498, but I think it's related with master kernel.

Revision history for this message
Zygmunt Krynicki (zyga) wrote : Posted in a previous version of this proposal

<liuyq> could you help to try this branch https://code.launchpad.net/~liuyq0307/lava-master-image-scripts/add-sdcard with a imx53 or origen board?
<liuyq> davepigott, I have tested with panda, it works
<zyga> liuyq, would you mind opening a merge request
 even if it is still work in progress
 (mark it as such if needed)
<davepigott> liuyq: Will test
<liuyq> davepigott, thanks, and I submitted a MP for it. https://code.launchpad.net/~liuyq0307/lava-master-image-scripts/add-sdcard/+merge/110770
<liuyq> davepigott, springz has used it with his imx, but there is a problem about the last 8th partition of sdcard.
 davepigott, I don't know if the problem has relation to the size of his sdcard, the size is 4G in total.
<davepigott> liuyq: Our recommendation is always to use at least 8GB, but I'll check
<liuyq> davepigott, I am a little afraid that we can't create the 8th partition on imx or origen.
<davepigott> liuyq: I'll find out
<zyga> liuyq, why did you move to kpartx?
<liuyq> zyga, partx does not work on my precise, also not work on springz's natty
<zyga> liuyq, I see
<liuyq> zyga, but kparx works work for both
<zyga> liuyq, I'd prefer that to be a separate patch, and drop the # commented out version of partx
* zyga is not really in a position to tell this as I'm not a lava or validation person anymore
<zyga> but that's what I think
<davepigott> zyga: liuyq I completely agree about the commented out code, and we did say that you had to be on precise to make this work properly
<liuyq> zyga, thanks, I will delete the old partx comment when I merge. Here just for the convenience that if the kpartx does not work for all we can easily rollback
<zyga> davepigott, yes but apparently it's hard for some of the assignees to transition to new os release
 sure
 liuyq, I'd rather see a version that works on just kpartx than both comments, that'
 that's why we have bzr for
<davepigott> liuyq: The default rootfs size we set is 4G so it won't work on a 4G card
<liuyq> davepigott, yes, I told springz to specify the size with the command parameters
<liuyq> davepigott, zyga, BTW, we also have a lava-partition-disk under lava-dispatcher/doc/scripts/lava-partition-disk
<zyga> liuyq, oh, I'm happy to kill it if davepigott doesn't mind
<liuyq> davepigott, zyga, should we delete it? it seems almost the same as the one in lava-master-image-scripts, but a little out of date
<zyga> yes
<davepigott> +1

Revision history for this message
Zygmunt Krynicki (zyga) wrote : Posted in a previous version of this proposal

* split the kpartx from sdcard partition improvements
* remove the old commented out code

review: Needs Fixing
Revision history for this message
Dave Pigott (dpigott) wrote : Posted in a previous version of this proposal

Will not work with imx53 and Origen. We hit the limit of 8 partitions. Needs rethinking in light of this.

Revision history for this message
Zygmunt Krynicki (zyga) wrote : Posted in a previous version of this proposal

Interesting:

What are the partitions on imx53:

master:

 boot
 rootfs

test:

 boot
 rootfs / system *
 userdata *
 scdard *

Android partitions marked with *

I assume I'm missing some special boot partitions specific to imx53

Revision history for this message
Dave Pigott (dpigott) wrote : Posted in a previous version of this proposal

imx53 and origen images have a small first partition as well as boot and rootfs - infrastructure or landing teams team would probably be able to tell us what they are for.

Revision history for this message
Spring Zhang (qzhang) wrote : Posted in a previous version of this proposal

I upgrade my linux-util to precise version, and found the same error like Yongqin's when using partx.

But I say it doesn't matter, it will finish the image, I can dd it to a SD card and make it boot up, the only missing is that partition making process doesn't happen automatically when first boot up. The error I met:

$ ./lava-create-master imx53 -o ../masteimx53.img --verbose
LAVA master images are easy to make, just three steps:

1) Preparing vanilla Linaro image
 * Inhibiting udisks...
 * Re-using existing vanilla image: /home/spring/.cache/lava/master-image-scripts/pristine-images/imx53-vanilla.img
2) Converting vanilla image to LAVA master image
 * Creating a copy of vanilla image...
 * Attaching master image to loopback device...
 * Adding partitions to the loopback device...
partx: /dev/loop0: error adding partitions 1-3
 * Removing loopback device partitions...
partx: defined range <1:0> does not make sense

$ partx --show ../master_imx53.img
NR START END SECTORS SIZE NAME UUID
 1 1 8191 8191 4M
 2 8192 114687 106496 52M
 3 114688 4194303 4079616 2G

Revision history for this message
Yongqin Liu (liuyq0307) wrote : Posted in a previous version of this proposal

./lava-create-master will mount the image file locally, and add some file
into it to make it do the partition job when first boot.
(the files are in master-rootfs-extras directory)
but the partx error make it not able to mount the image file locally.

On 20 June 2012 09:28, Spring Zhang <email address hidden> wrote:

> I upgrade my linux-util to precise version, and found the same error like
> Yongqin's when using partx.
>
> But I say it doesn't matter, it will finish the image, I can dd it to a SD
> card and make it boot up, the only missing is that partition making process
> doesn't happen automatically when first boot up. The error I met:
>
> $ ./lava-create-master imx53 -o ../masteimx53.img --verbose
> LAVA master images are easy to make, just three steps:
>
> 1) Preparing vanilla Linaro image
> * Inhibiting udisks...
> * Re-using existing vanilla image:
> /home/spring/.cache/lava/master-image-scripts/pristine-images/imx53-vanilla.img
> 2) Converting vanilla image to LAVA master image
> * Creating a copy of vanilla image...
> * Attaching master image to loopback device...
> * Adding partitions to the loopback device...
> partx: /dev/loop0: error adding partitions 1-3
> * Removing loopback device partitions...
> partx: defined range <1:0> does not make sense
>
> $ partx --show ../master_imx53.img
> NR START END SECTORS SIZE NAME UUID
> 1 1 8191 8191 4M
> 2 8192 114687 106496 52M
> 3 114688 4194303 4079616 2G
>
> --
>
> https://code.launchpad.net/~liuyq0307/lava-master-image-scripts/add-sdcard/+merge/110770
> You are the owner of lp:~liuyq0307/lava-master-image-scripts/add-sdcard.
>

Revision history for this message
Yongqin Liu (liuyq0307) wrote : Posted in a previous version of this proposal

> * split the kpartx from sdcard partition improvements
> * remove the old commented out code
Split the change to kpartx to this MP
https://code.launchpad.net/~liuyq0307/lava-master-image-scripts/use-kpartx/+merge/111133

please review it

Revision history for this message
Dave Pigott (dpigott) wrote :

Given the partitioning limits for origen and imx53, I'd rather see us not do the userdata partitioning on those boards, rather than attempting and failing.

68. By Yongqin Liu

keep not changed for iMX and origen

69. By Yongqin Liu

add comment for userdata partition

70. By Yongqin Liu

make some lines the same as before

71. By Yongqin Liu

add double quote

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

> Given the partitioning limits for origen and imx53, I'd rather see us not do
> the userdata partitioning on those boards, rather than attempting and failing.

Yeah, I agree with you.
Now I have updated it to only add the userdata partition for 2part board.
Please review it again.

BTW, I have not test this updated source yet, could you help to test it with the Origen and iMX first?
I will test the 2part with panda tomorrow after the jobs on it now completed.

Thanks,
Yongqin Liu

Revision history for this message
Dave Pigott (dpigott) :
review: Approve
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks good to me now too.

review: Approve
72. By Yongqin Liu

fix the bug for format userdata partition

73. By Yongqin Liu

fix the bug for format userdata partition

74. By Yongqin Liu

revert back the fix for trap on EXIT

75. By Yongqin Liu

add the for the if condition

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava-create-master'
2--- lava-create-master 2012-06-20 01:57:28 +0000
3+++ lava-create-master 2012-06-29 06:58:19 +0000
4@@ -20,6 +20,10 @@
5 # defaults to 4G (4 GigaBytes)
6 export ROOTFS_SIZE="4G"
7
8+# Used during partitioning on first boot - size of the userdata partition
9+# defaults to 2G (2 GigaBytes)
10+export USERDATA_SIZE="2G"
11+
12 # TODO: change to BOARD
13 dev=
14
15@@ -81,6 +85,7 @@
16 printf -- " %-9s - %s\n" "--output" "Save the output as IMAGE"
17 printf -- " %-9s - %s\n" "--rebuild-vanilla" "Always rebuild vanilla image"
18 printf -- " %-9s - %s\n" "--rootfs-size" "Size of the testrootfs partition (default 4G)"
19+ printf -- " %-9s - %s\n" "--userdata-size" "Size of the userdata partition (default 2G), no meaning for iMX and Origen"
20 echo
21 echo "supported devices:"
22 echo
23@@ -131,6 +136,10 @@
24 ROOTFS_SIZE="$2"
25 shift 2
26 ;;
27+ --userdata-size|-r)
28+ USERDATA_SIZE="$2"
29+ shift 2
30+ ;;
31 *)
32 if [ -n "$dev" ]; then
33 show_usage
34@@ -429,6 +438,7 @@
35 -e "s!@LAVA_VERSION@!$LAVA_VERSION!" \
36 -e "s!@LAVA_URL@!$LAVA_URL!" \
37 -e "s!@LAVA_ROOTFS_SIZE@!$ROOTFS_SIZE!" \
38+ -e "s!@LAVA_USERDATA_SIZE@!$USERDATA_SIZE!" \
39 -i \
40 $MASTER_MNT/lib/lava/common
41
42
43=== modified file 'master-rootfs-extras/bin/lava-partition-disk'
44--- master-rootfs-extras/bin/lava-partition-disk 2012-05-15 08:31:12 +0000
45+++ master-rootfs-extras/bin/lava-partition-disk 2012-06-29 06:58:19 +0000
46@@ -4,8 +4,12 @@
47 # anything different
48 ROOTFS_SIZE="4G"
49
50+# By default we build a 2GByte partition. Specifiy on the command line for
51+# anything different
52+USERDATA_SIZE="2G"
53+
54 show_usage() {
55- echo "Usage: $0 [--rootfs-size|-r SIZE]"
56+ echo "Usage: $0 [--rootfs-size|-r SIZE] [--userdata-size|-u SIZE]"
57 }
58
59 show_help() {
60@@ -15,6 +19,7 @@
61 echo
62 printf -- " %-9s - %s\n" "--help" "Show this message"
63 printf -- " %-9s - %s\n" "--rootfs-size" "Size of the testrootfs partition (default 4G)"
64+ printf -- " %-9s - %s\n" "--userdata-size" "Size of the userdata partition (default 2G), no meaning for iMX and Origen"
65 echo
66 echo "See: $LAVA_URL for more information"
67 }
68@@ -30,6 +35,10 @@
69 ROOTFS_SIZE=$2;
70 shift 2
71 ;;
72+ --userdata-size|-u)
73+ USERDATA_SIZE=$2;
74+ shift 2
75+ ;;
76 *)
77 show_usage
78 echo "Too many arguments, see --help for details"
79@@ -98,7 +107,8 @@
80 then
81 TESTBOOT_PART=3
82 TESTROOTFS_PART=5
83- SDCARD_PART=6
84+ USERDATA_PART=6
85+ SDCARD_PART=7
86 LAST_BLOCK=2
87 else
88 TESTBOOT_PART=5
89@@ -133,11 +143,12 @@
90 # /dev/disk/by-label/rootfs - the master root filing system
91 # /dev/disk/by-label/testboot - the deployed test boot image will go here
92 # /dev/disk/by-label/testrootfs - the deployed test rootfs will go here
93+# /dev/disk/by-label/userdata - the Android userdata partition goes here, but will not exist for iMX and Origen board
94 # /dev/disk/by-label/sdcard - the Android sdcard partition goes here
95 #
96 # so first we partition the disk, if it's 2part, then 3 will be the testboot
97 # and 4 will be an extended partition containing 5 as the testrootfs and 6
98-# as sdcard.
99+# as userdata and 7 as sdcard.
100 # For 3part then 4 will be an extended partition containing 5/testboot,
101 # 6/testrootfs and 7/sdcard
102 partition_disk() {
103@@ -154,7 +165,7 @@
104 # 131072 = 65536 * 2 - fdisk works in 512K blocks, and we want a 64M
105 # partition for testboot.
106 EXTENDED_BLOCK_START=`echo $FIRST_BLOCK_START | awk '{print $1 + 131072}'`
107- FDISK_SCRIPT="n\np\n3\n$FIRST_BLOCK_START\n+64M\nt\n3\nc\nn\ne\n$EXTENDED_BLOCK_START\n\nn\n\n+$ROOTFS_SIZE\nn\n\n\nt\n6\nc\np\nw\n"
108+ FDISK_SCRIPT="n\np\n3\n$FIRST_BLOCK_START\n+64M\nt\n3\nc\nn\ne\n$EXTENDED_BLOCK_START\n\nn\n\n+$ROOTFS_SIZE\nn\n\n+$USERDATA_SIZE\nn\n\n\nt\n${SDCARD_PART}\nc\np\nw\n"
109 else
110 FDISK_SCRIPT="n\ne\n$FIRST_BLOCK_START\n\nn\n\n+64M\nt\n5\nc\nn\n\n+$ROOTFS_SIZE\nn\n\n\nt\n7\nc\np\nw\n"
111 fi
112@@ -168,6 +179,9 @@
113 mkfs.vfat -n testboot "${DEVICE}${PARTITION_PREFIX}${TESTBOOT_PART}"
114 mkfs.vfat -n sdcard "${DEVICE}${PARTITION_PREFIX}${SDCARD_PART}"
115 mkfs.ext3 -L testrootfs "${DEVICE}${PARTITION_PREFIX}${TESTROOTFS_PART}"
116+ if [ $SCHEME = "2part" ]; then
117+ mkfs.ext4 -L userdata "${DEVICE}${PARTITION_PREFIX}${USERDATA_PART}"
118+ fi
119 sync
120 }
121
122
123=== modified file 'master-rootfs-extras/lib/lava/common'
124--- master-rootfs-extras/lib/lava/common 2012-05-14 12:58:45 +0000
125+++ master-rootfs-extras/lib/lava/common 2012-06-29 06:58:19 +0000
126@@ -2,6 +2,7 @@
127 LAVA_VERSION=@LAVA_VERSION@
128 LAVA_URL=@LAVA_URL@
129 LAVA_ROOTFS_SIZE=@LAVA_ROOTFS_SIZE@
130+LAVA_USERDATA_SIZE=@LAVA_USERDATA_SIZE@
131
132 # Persistent device configuration file
133 LAVA_DEVICE_CONF=/var/lib/lava/device.conf
134
135=== modified file 'master-rootfs-extras/lib/lava/lava-master-init'
136--- master-rootfs-extras/lib/lava/lava-master-init 2012-05-14 12:58:45 +0000
137+++ master-rootfs-extras/lib/lava/lava-master-init 2012-06-29 06:58:19 +0000
138@@ -56,7 +56,7 @@
139 fi
140 # Do disk partitioning
141 echo "Partitioning disk to LAVA format" >> "$LAVA_FIRST_BOOT_LOG"
142- if ! lava-partition-disk -r $LAVA_ROOTFS_SIZE >> "$LAVA_FIRST_BOOT_LOG" 2>&1; then
143+ if ! lava-partition-disk -r $LAVA_ROOTFS_SIZE -u $LAVA_USERDATA_SIZE>> "$LAVA_FIRST_BOOT_LOG" 2>&1; then
144 echo "Unable to partition disk" >&2
145 return 1
146 fi

Subscribers

People subscribed via source and target branches