diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 509: Merge: Adding mmc_device_id to be parsed from mmc_id and be used by flash-kernel

Message ID 20120419103516.26331.37622.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

James Tunnicliffe April 19, 2012, 10:35 a.m. UTC
Merge authors:
  Ricardo Salveti (rsalveti)
Related merge proposals:
  https://code.launchpad.net/~rsalveti/linaro-image-tools/mmc_device_id/+merge/102611
  proposed by: Ricardo Salveti (rsalveti)
  review: Approve - James Tunnicliffe (dooferlad)
------------------------------------------------------------
revno: 509 [merge]
committer: James Tunnicliffe <james.tunnicliffe@linaro.org>
branch nick: trunk
timestamp: Thu 2012-04-19 11:33:20 +0100
message:
  Merge: Adding mmc_device_id to be parsed from mmc_id and be used by flash-kernel
modified:
  linaro-media-create
  linaro_image_tools/media_create/boards.py
  linaro_image_tools/media_create/rootfs.py
  linaro_image_tools/media_create/tests/test_media_create.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'linaro-media-create'
--- linaro-media-create	2012-04-18 13:26:25 +0000
+++ linaro-media-create	2012-04-19 01:12:10 +0000
@@ -195,6 +195,7 @@ 
             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

=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py	2012-04-18 14:25:33 +0000
+++ linaro_image_tools/media_create/boards.py	2012-04-19 01:12:10 +0000
@@ -206,6 +206,7 @@ 
     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 @@ 
 
             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')

=== modified file 'linaro_image_tools/media_create/rootfs.py'
--- linaro_image_tools/media_create/rootfs.py	2011-10-19 13:59:30 +0000
+++ linaro_image_tools/media_create/rootfs.py	2012-04-19 01:12:10 +0000
@@ -43,7 +43,7 @@ 
 
 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 @@ 
         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 @@ 
         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):

=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py	2012-03-21 14:14:56 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py	2012-04-19 01:12:10 +0000
@@ -389,6 +389,7 @@ 
             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):