diff options
author | Ricardo Salveti de Araujo <ricardo.salveti@linaro.org> | 2012-04-18 22:12:10 -0300 |
---|---|---|
committer | Ricardo Salveti de Araujo <ricardo.salveti@linaro.org> | 2012-04-18 22:12:10 -0300 |
commit | 844ee91c1a227f15261b6fd35a37da5e91ba7e50 (patch) | |
tree | 3fce66afcf7040f823d200cd371ceab86165c0d4 | |
parent | e18b79130caef3227894026e6e7fda48e1fde905 (diff) |
Adding mmc_device_id to be parsed from mmc_id and be used by flash-kernel
-rwxr-xr-x | linaro-media-create | 3 | ||||
-rw-r--r-- | linaro_image_tools/media_create/boards.py | 2 | ||||
-rw-r--r-- | linaro_image_tools/media_create/rootfs.py | 12 | ||||
-rw-r--r-- | linaro_image_tools/media_create/tests/test_media_create.py | 1 |
4 files changed, 12 insertions, 6 deletions
diff --git a/linaro-media-create b/linaro-media-create index 062432c..2440e78 100755 --- a/linaro-media-create +++ b/linaro-media-create @@ -195,6 +195,7 @@ if __name__ == '__main__': create_swap = True populate_rootfs(ROOTFS_DIR, ROOT_DISK, root_partition, args.rootfs, rootfs_uuid, create_swap, str(args.swap_file), - board_config.mmc_part_offset, board_config) + board_config.mmc_device_id, board_config.mmc_part_offset, + board_config) print "Done creating Linaro image on %s" % media.path diff --git a/linaro_image_tools/media_create/boards.py b/linaro_image_tools/media_create/boards.py index 4a9b2c8..7b3894b 100644 --- a/linaro_image_tools/media_create/boards.py +++ b/linaro_image_tools/media_create/boards.py @@ -206,6 +206,7 @@ class BoardConfig(object): env_dd = False fatload_command = 'fatload' mmc_option = '0:1' + mmc_device_id = 0 mmc_part_offset = 0 uimage_path = '' fat_size = 32 @@ -347,6 +348,7 @@ class BoardConfig(object): cls.mmc_option = cls.get_metadata_field('mmc_id') if cls.mmc_option is not None: + cls.mmc_device_id = int(cls.mmc_option.split(':')[0]) cls.mmc_part_offset = int(cls.mmc_option.split(':')[1]) - 1 boot_min_size = cls.get_metadata_field('boot_min_size') diff --git a/linaro_image_tools/media_create/rootfs.py b/linaro_image_tools/media_create/rootfs.py index f81f2f7..1083546 100644 --- a/linaro_image_tools/media_create/rootfs.py +++ b/linaro_image_tools/media_create/rootfs.py @@ -43,7 +43,7 @@ def rootfs_mount_options(rootfs_type): def populate_rootfs(content_dir, root_disk, partition, rootfs_type, rootfs_uuid, should_create_swap, swap_size, - partition_offset, board_config=None): + mmc_device_id, partition_offset, board_config=None): """Populate the rootfs and make the necessary tweaks to make it usable. This consists of: @@ -87,7 +87,8 @@ def populate_rootfs(content_dir, root_disk, partition, rootfs_type, append_to_fstab(root_disk, fstab_additions) print "\nCreating /etc/flash-kernel.conf\n" - create_flash_kernel_config(root_disk, 1 + partition_offset) + create_flash_kernel_config( + root_disk, mmc_device_id, 1 + partition_offset) if board_config is not None: print "\nUpdating /etc/network/interfaces\n" @@ -114,15 +115,16 @@ def update_network_interfaces(root_disk, board_config): write_data_to_protected_file(if_path, config) -def create_flash_kernel_config(root_disk, boot_partition_number): +def create_flash_kernel_config(root_disk, mmc_device_id, boot_partition_number): """Create a flash-kernel.conf file under root_disk/etc. Uses the given partition number to figure out the boot partition. """ - target_boot_dev = '/dev/mmcblk0p%s' % boot_partition_number + target_boot_dev = '/dev/mmcblk%dp%s' % ( + mmc_device_id, boot_partition_number) flash_kernel = os.path.join(root_disk, 'etc', 'flash-kernel.conf') write_data_to_protected_file( - flash_kernel, "UBOOT_PART=%s" % target_boot_dev) + flash_kernel, "UBOOT_PART=%s\n" % target_boot_dev) def _list_files(directory): diff --git a/linaro_image_tools/media_create/tests/test_media_create.py b/linaro_image_tools/media_create/tests/test_media_create.py index 5abc7fe..30c6550 100644 --- a/linaro_image_tools/media_create/tests/test_media_create.py +++ b/linaro_image_tools/media_create/tests/test_media_create.py @@ -389,6 +389,7 @@ class TestSetMetadata(TestCaseWithFixtures): pass config.set_metadata('ahwpack.tar.gz') self.assertEquals(data_to_set, config.mmc_option) + self.assertEquals(0, config.mmc_device_id) self.assertEquals(0, config.mmc_part_offset) def test_sets_boot_min_size(self): |