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
=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py 2012-06-13 14:41:42 +0000
+++ linaro_image_tools/media_create/boards.py 2012-07-05 13:39:21 +0000
@@ -668,11 +668,11 @@
668668
669 if cls.hwpack_format == HardwarepackHandler.FORMAT_1:669 if cls.hwpack_format == HardwarepackHandler.FORMAT_1:
670 cls._make_boot_files(670 cls._make_boot_files(
671 boot_env, chroot_dir, boot_dir,671 rootfs_uuid, boot_env, chroot_dir, boot_dir,
672 boot_device_or_file, k_img_data, i_img_data, d_img_data)672 boot_device_or_file, k_img_data, i_img_data, d_img_data)
673 else:673 else:
674 cls._make_boot_files_v2(674 cls._make_boot_files_v2(
675 boot_env, chroot_dir, boot_dir,675 rootfs_uuid, boot_env, chroot_dir, boot_dir,
676 boot_device_or_file, k_img_data, i_img_data, d_img_data)676 boot_device_or_file, k_img_data, i_img_data, d_img_data)
677677
678 @classmethod678 @classmethod
@@ -696,7 +696,7 @@
696 cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE)696 cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE)
697697
698 @classmethod698 @classmethod
699 def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,699 def _make_boot_files_v2(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
700 boot_device_or_file, k_img_data, i_img_data,700 boot_device_or_file, k_img_data, i_img_data,
701 d_img_data):701 d_img_data):
702 with cls.hardwarepack_handler:702 with cls.hardwarepack_handler:
@@ -747,7 +747,7 @@
747 cls.SAMSUNG_V310_ENV_START)747 cls.SAMSUNG_V310_ENV_START)
748748
749 @classmethod749 @classmethod
750 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,750 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
751 boot_device_or_file, k_img_data, i_img_data,751 boot_device_or_file, k_img_data, i_img_data,
752 d_img_data):752 d_img_data):
753 """Make the necessary boot files for this board.753 """Make the necessary boot files for this board.
@@ -916,7 +916,7 @@
916 rootfs_uuid, boot_dir, boot_device_or_file)916 rootfs_uuid, boot_dir, boot_device_or_file)
917917
918 @classmethod918 @classmethod
919 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,919 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
920 boot_device_or_file, k_img_data, i_img_data,920 boot_device_or_file, k_img_data, i_img_data,
921 d_img_data):921 d_img_data):
922 # XXX: delete this method when hwpacks V1 can die922 # XXX: delete this method when hwpacks V1 can die
@@ -983,7 +983,7 @@
983 dtb_name = 'isee-igep-v2.dtb'983 dtb_name = 'isee-igep-v2.dtb'
984984
985 @classmethod985 @classmethod
986 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,986 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
987 boot_device_or_file, k_img_data, i_img_data,987 boot_device_or_file, k_img_data, i_img_data,
988 d_img_data):988 d_img_data):
989 # XXX: delete this method when hwpacks V1 can die989 # XXX: delete this method when hwpacks V1 can die
@@ -1021,7 +1021,7 @@
1021 return cls._extra_serial_opts % cls.serial_tty1021 return cls._extra_serial_opts % cls.serial_tty
10221022
1023 @classmethod1023 @classmethod
1024 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,1024 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1025 boot_device_or_file, k_img_data, i_img_data,1025 boot_device_or_file, k_img_data, i_img_data,
1026 d_img_data):1026 d_img_data):
1027 # XXX: delete this method when hwpacks V1 can die1027 # XXX: delete this method when hwpacks V1 can die
@@ -1040,7 +1040,7 @@
1040 the SnowballConfigImage configuration.'''1040 the SnowballConfigImage configuration.'''
10411041
1042 @classmethod1042 @classmethod
1043 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,1043 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1044 boot_device_or_file, k_img_data, i_img_data,1044 boot_device_or_file, k_img_data, i_img_data,
1045 d_img_data):1045 d_img_data):
1046 # XXX: delete this method when hwpacks V1 can die1046 # XXX: delete this method when hwpacks V1 can die
@@ -1096,7 +1096,7 @@
1096 loader_start, loader_len, boot_start, boot_len, root_start)1096 loader_start, loader_len, boot_start, boot_len, root_start)
10971097
1098 @classmethod1098 @classmethod
1099 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,1099 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1100 boot_device_or_file, k_img_data, i_img_data,1100 boot_device_or_file, k_img_data, i_img_data,
1101 d_img_data):1101 d_img_data):
1102 # XXX: delete this method when hwpacks V1 can die1102 # XXX: delete this method when hwpacks V1 can die
@@ -1271,7 +1271,7 @@
1271 loader_start, loader_len, boot_start, boot_len, root_start)1271 loader_start, loader_len, boot_start, boot_len, root_start)
12721272
1273 @classmethod1273 @classmethod
1274 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,1274 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1275 boot_device_or_file, k_img_data, i_img_data,1275 boot_device_or_file, k_img_data, i_img_data,
1276 d_img_data):1276 d_img_data):
1277 # XXX: delete this method when hwpacks V1 can die1277 # XXX: delete this method when hwpacks V1 can die
@@ -1349,7 +1349,7 @@
1349 return cls._extra_serial_opts % cls.serial_tty1349 return cls._extra_serial_opts % cls.serial_tty
13501350
1351 @classmethod1351 @classmethod
1352 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,1352 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1353 boot_device_or_file, k_img_data, i_img_data,1353 boot_device_or_file, k_img_data, i_img_data,
1354 d_img_data):1354 d_img_data):
1355 make_uImage(cls.load_addr, k_img_data, boot_dir)1355 make_uImage(cls.load_addr, k_img_data, boot_dir)
@@ -1375,7 +1375,7 @@
1375 return ""1375 return ""
13761376
1377 @classmethod1377 @classmethod
1378 def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,1378 def _make_boot_files_v2(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1379 boot_device_or_file, k_img_data, i_img_data,1379 boot_device_or_file, k_img_data, i_img_data,
1380 d_img_data):1380 d_img_data):
1381 output_dir = os.path.dirname(boot_device_or_file)1381 output_dir = os.path.dirname(boot_device_or_file)
@@ -1418,7 +1418,7 @@
1418 loaders_start, loaders_len, boot_start, boot_len, root_start)1418 loaders_start, loaders_len, boot_start, boot_len, root_start)
14191419
1420 @classmethod1420 @classmethod
1421 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,1421 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1422 boot_device_or_file, k_img_data, i_img_data,1422 boot_device_or_file, k_img_data, i_img_data,
1423 d_img_data):1423 d_img_data):
1424 # XXX: delete this method when hwpacks V1 can die1424 # XXX: delete this method when hwpacks V1 can die
@@ -1543,7 +1543,7 @@
1543 set timeout=31543 set timeout=3
1544 set default='0'1544 set default='0'
1545 menuentry 'core' {1545 menuentry 'core' {
1546 linux /%s root=LABEL=rootfs ro %s1546 linux /%s root=UUID=%s ro %s
1547 initrd /%s1547 initrd /%s
1548 }"""1548 }"""
15491549
@@ -1556,7 +1556,7 @@
1556 return cls._extra_serial_opts % cls.serial_tty1556 return cls._extra_serial_opts % cls.serial_tty
15571557
1558 @classmethod1558 @classmethod
1559 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,1559 def _make_boot_files(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1560 boot_device_or_file, k_img_data, i_img_data,1560 boot_device_or_file, k_img_data, i_img_data,
1561 d_img_data):1561 d_img_data):
1562 # copy image and init into boot partition1562 # copy image and init into boot partition
@@ -1575,7 +1575,7 @@
15751575
1576 # generate loader config file1576 # generate loader config file
1577 loader_config = cls.BOOTLOADER_CFG % (os.path.basename(k_img_data),1577 loader_config = cls.BOOTLOADER_CFG % (os.path.basename(k_img_data),
1578 cls.extra_serial_opts, os.path.basename(i_img_data))1578 rootfs_uuid, cls.extra_serial_opts, os.path.basename(i_img_data))
15791579
1580 _, tmpfile = tempfile.mkstemp()1580 _, tmpfile = tempfile.mkstemp()
1581 atexit.register(os.unlink, tmpfile)1581 atexit.register(os.unlink, tmpfile)
@@ -1586,11 +1586,11 @@
1586 cls.BOOTLOADER_CFG_FILE)], as_root=True).wait()1586 cls.BOOTLOADER_CFG_FILE)], as_root=True).wait()
15871587
1588 @classmethod1588 @classmethod
1589 def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,1589 def _make_boot_files_v2(cls, rootfs_uuid, boot_env, chroot_dir, boot_dir,
1590 boot_device_or_file, k_img_data, i_img_data,1590 boot_device_or_file, k_img_data, i_img_data,
1591 d_img_data):1591 d_img_data):
1592 # reuse hwpack v1 function1592 # reuse hwpack v1 function
1593 cls._make_boot_files(boot_env, chroot_dir, boot_dir,1593 cls._make_boot_files(rootfs_uuid, boot_env, chroot_dir, boot_dir,
1594 boot_device_or_file, k_img_data, i_img_data,1594 boot_device_or_file, k_img_data, i_img_data,
1595 d_img_data)1595 d_img_data)
15961596
15971597
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py 2012-07-04 15:30:34 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py 2012-07-05 13:39:21 +0000
@@ -905,7 +905,8 @@
905 boot_env = board_configs['snowball_emmc']._get_boot_env(905 boot_env = board_configs['snowball_emmc']._get_boot_env(
906 is_live=False, is_lowmem=False, consoles=[],906 is_live=False, is_lowmem=False, consoles=[],
907 rootfs_uuid="test_boot_env_uuid", d_img_data=None)907 rootfs_uuid="test_boot_env_uuid", d_img_data=None)
908 boards.SnowballEmmcConfig._make_boot_files(boot_env, self.tempdir,908 boards.SnowballEmmcConfig._make_boot_files("test_boot_env_uuid",
909 boot_env, self.tempdir,
909 self.temp_bootdir_path, 'boot_device_or_file', k_img_file,910 self.temp_bootdir_path, 'boot_device_or_file', k_img_file,
910 i_img_file, None)911 i_img_file, None)
911 expected = [912 expected = [

Subscribers

People subscribed via source and target branches