Merge lp:~emanuele-aina/linaro-image-tools/grub-load-rootfs-by-uuid into lp:linaro-image-tools/11.11

Proposed by Emanuele Aina
Status: Needs review
Proposed branch: lp:~emanuele-aina/linaro-image-tools/grub-load-rootfs-by-uuid
Merge into: lp:linaro-image-tools/11.11
Diff against target: 171 lines (+20/-19)
2 files modified
linaro_image_tools/media_create/boards.py (+18/-18)
linaro_image_tools/media_create/tests/test_media_create.py (+2/-1)
To merge this branch: bzr merge lp:~emanuele-aina/linaro-image-tools/grub-load-rootfs-by-uuid
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Needs Fixing
Review via email: mp+113585@code.launchpad.net

Description of the change

Currently the I386Config board definition sets the `root=LABEL=rootfs' parameter for the kernel to be booted and, given that populate_rootfs() uses the UUID to populate /etc/fstab, this can lead to some inconsistencies.

This branch updates the _make_boot_files_*() functions to accept a 'rootfs_uuid' parameter and on i386 uses it to generate a "root=UUID=%s" kernel command line argument.

Argument passing between the bootfs/rootfs stages is a bit flaky, given the need to update so many call sites. Coalescing all the function parameters in a BuildConfig object would reduce the patch to three lines and make future modifications easier.

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote :

Hi Emanuele,

thanks for working on this!
I was looking at the patch, and unfortunately there is a small conflict when I merge it with trunk. Conflict is rather trivia to fix, but the are at least 13 tests failing now.

Can you please update the patch and take a look at the errors?
Thanks.

review: Needs Fixing

Unmerged revisions

534. By Emanuele Aina

Point the i386 kernel to its rootfs by UUID

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro_image_tools/media_create/boards.py'
2--- linaro_image_tools/media_create/boards.py 2012-06-13 14:41:42 +0000
3+++ linaro_image_tools/media_create/boards.py 2012-07-05 13:39:21 +0000
4@@ -668,11 +668,11 @@
5
6 if cls.hwpack_format == HardwarepackHandler.FORMAT_1:
7 cls._make_boot_files(
8- boot_env, chroot_dir, boot_dir,
9+ rootfs_uuid, boot_env, chroot_dir, boot_dir,
10 boot_device_or_file, k_img_data, i_img_data, d_img_data)
11 else:
12 cls._make_boot_files_v2(
13- boot_env, chroot_dir, boot_dir,
14+ rootfs_uuid, boot_env, chroot_dir, boot_dir,
15 boot_device_or_file, k_img_data, i_img_data, d_img_data)
16
17 @classmethod
18@@ -696,7 +696,7 @@
19 cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE)
20
21 @classmethod
22- def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,
23+ def _make_boot_files_v2(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
24 boot_device_or_file, k_img_data, i_img_data,
25 d_img_data):
26 with cls.hardwarepack_handler:
27@@ -747,7 +747,7 @@
28 cls.SAMSUNG_V310_ENV_START)
29
30 @classmethod
31- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
32+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
33 boot_device_or_file, k_img_data, i_img_data,
34 d_img_data):
35 """Make the necessary boot files for this board.
36@@ -916,7 +916,7 @@
37 rootfs_uuid, boot_dir, boot_device_or_file)
38
39 @classmethod
40- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
41+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
42 boot_device_or_file, k_img_data, i_img_data,
43 d_img_data):
44 # XXX: delete this method when hwpacks V1 can die
45@@ -983,7 +983,7 @@
46 dtb_name = 'isee-igep-v2.dtb'
47
48 @classmethod
49- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
50+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
51 boot_device_or_file, k_img_data, i_img_data,
52 d_img_data):
53 # XXX: delete this method when hwpacks V1 can die
54@@ -1021,7 +1021,7 @@
55 return cls._extra_serial_opts % cls.serial_tty
56
57 @classmethod
58- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
59+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
60 boot_device_or_file, k_img_data, i_img_data,
61 d_img_data):
62 # XXX: delete this method when hwpacks V1 can die
63@@ -1040,7 +1040,7 @@
64 the SnowballConfigImage configuration.'''
65
66 @classmethod
67- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
68+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
69 boot_device_or_file, k_img_data, i_img_data,
70 d_img_data):
71 # XXX: delete this method when hwpacks V1 can die
72@@ -1096,7 +1096,7 @@
73 loader_start, loader_len, boot_start, boot_len, root_start)
74
75 @classmethod
76- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
77+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
78 boot_device_or_file, k_img_data, i_img_data,
79 d_img_data):
80 # XXX: delete this method when hwpacks V1 can die
81@@ -1271,7 +1271,7 @@
82 loader_start, loader_len, boot_start, boot_len, root_start)
83
84 @classmethod
85- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
86+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
87 boot_device_or_file, k_img_data, i_img_data,
88 d_img_data):
89 # XXX: delete this method when hwpacks V1 can die
90@@ -1349,7 +1349,7 @@
91 return cls._extra_serial_opts % cls.serial_tty
92
93 @classmethod
94- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
95+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
96 boot_device_or_file, k_img_data, i_img_data,
97 d_img_data):
98 make_uImage(cls.load_addr, k_img_data, boot_dir)
99@@ -1375,7 +1375,7 @@
100 return ""
101
102 @classmethod
103- def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,
104+ def _make_boot_files_v2(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
105 boot_device_or_file, k_img_data, i_img_data,
106 d_img_data):
107 output_dir = os.path.dirname(boot_device_or_file)
108@@ -1418,7 +1418,7 @@
109 loaders_start, loaders_len, boot_start, boot_len, root_start)
110
111 @classmethod
112- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
113+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
114 boot_device_or_file, k_img_data, i_img_data,
115 d_img_data):
116 # XXX: delete this method when hwpacks V1 can die
117@@ -1543,7 +1543,7 @@
118 set timeout=3
119 set default='0'
120 menuentry 'core' {
121- linux /%s root=LABEL=rootfs ro %s
122+ linux /%s root=UUID=%s ro %s
123 initrd /%s
124 }"""
125
126@@ -1556,7 +1556,7 @@
127 return cls._extra_serial_opts % cls.serial_tty
128
129 @classmethod
130- def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
131+ def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
132 boot_device_or_file, k_img_data, i_img_data,
133 d_img_data):
134 # copy image and init into boot partition
135@@ -1575,7 +1575,7 @@
136
137 # generate loader config file
138 loader_config = cls.BOOTLOADER_CFG % (os.path.basename(k_img_data),
139- cls.extra_serial_opts, os.path.basename(i_img_data))
140+ rootfs_uuid, cls.extra_serial_opts, os.path.basename(i_img_data))
141
142 _, tmpfile = tempfile.mkstemp()
143 atexit.register(os.unlink, tmpfile)
144@@ -1586,11 +1586,11 @@
145 cls.BOOTLOADER_CFG_FILE)], as_root=True).wait()
146
147 @classmethod
148- def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,
149+ def _make_boot_files_v2(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
150 boot_device_or_file, k_img_data, i_img_data,
151 d_img_data):
152 # reuse hwpack v1 function
153- cls._make_boot_files(boot_env, chroot_dir, boot_dir,
154+ cls._make_boot_files(rootfs_uuid, boot_env, chroot_dir, boot_dir,
155 boot_device_or_file, k_img_data, i_img_data,
156 d_img_data)
157
158
159=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
160--- linaro_image_tools/media_create/tests/test_media_create.py 2012-07-04 15:30:34 +0000
161+++ linaro_image_tools/media_create/tests/test_media_create.py 2012-07-05 13:39:21 +0000
162@@ -905,7 +905,8 @@
163 boot_env = board_configs['snowball_emmc']._get_boot_env(
164 is_live=False, is_lowmem=False, consoles=[],
165 rootfs_uuid="test_boot_env_uuid", d_img_data=None)
166- boards.SnowballEmmcConfig._make_boot_files(boot_env, self.tempdir,
167+ boards.SnowballEmmcConfig._make_boot_files("test_boot_env_uuid",
168+ boot_env, self.tempdir,
169 self.temp_bootdir_path, 'boot_device_or_file', k_img_file,
170 i_img_file, None)
171 expected = [

Subscribers

People subscribed via source and target branches