diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 634: Fix _get_bootcmd() to cover all bootm use cases:

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

Commit Message

Fathi Boudra Aug. 16, 2013, 6:10 a.m. UTC
Merge authors:
  Fathi Boudra (fboudra)
Related merge proposals:
  https://code.launchpad.net/~fboudra/linaro-image-tools/bootm-fixes/+merge/178705
  proposed by: Fathi Boudra (fboudra)
  review: Approve - Milo Casagrande (milo)
------------------------------------------------------------
revno: 634 [merge]
committer: Fathi Boudra <fathi.boudra@linaro.org>
branch nick: linaro-image-tools
timestamp: Fri 2013-08-16 09:09:14 +0300
message:
  Fix _get_bootcmd() to cover all bootm use cases:
   * kernel only
   * kernel + initrd
   * kernel + dtb
   * kernel + initrd + dtb
modified:
  linaro_image_tools/media_create/boards.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_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py	2013-08-06 07:25:33 +0000
+++ linaro_image_tools/media_create/boards.py	2013-08-06 10:09:32 +0000
@@ -534,21 +534,27 @@ 
         boot_script = (
             ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
              "%(kernel_addr)s %(uimage_path)suImage; ")) % replacements
-        if i_img_data is not None:
+        boot_script_bootm = (("bootm %(kernel_addr)s")) % replacements
+        if i_img_data is not None and d_img_data is not None:
+            boot_script += (
+                ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
+                 "%(initrd_addr)s %(uimage_path)suInitrd; "
+                 "%(fatload_command)s %(load_interface)s %(mmc_option)s "
+                 "%(dtb_addr)s board.dtb; ")) % replacements
+            boot_script_bootm += (
+                (" %(initrd_addr)s %(dtb_addr)s")) % replacements
+        elif i_img_data is None and d_img_data is not None:
+            boot_script += (
+                ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
+                 "%(dtb_addr)s board.dtb; ")) % replacements
+            boot_script_bootm += ((" - %(dtb_addr)s")) % replacements
+        elif i_img_data is not None and d_img_data is None:
             boot_script += (
                 ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
                  "%(initrd_addr)s %(uimage_path)suInitrd; ")) % replacements
-            if d_img_data is not None:
-                assert self.dtb_addr is not None, (
-                    "Need a dtb_addr when passing d_img_data")
-                boot_script += (
-                    ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
-                     "%(dtb_addr)s board.dtb; ")) % replacements
-        boot_script += (("bootm %(kernel_addr)s")) % replacements
-        if i_img_data is not None:
-            boot_script += ((" %(initrd_addr)s")) % replacements
-            if self.dtb_addr is not None:
-                boot_script += ((" %(dtb_addr)s")) % replacements
+            boot_script_bootm += ((" %(initrd_addr)s")) % replacements
+
+        boot_script += boot_script_bootm
         return boot_script
 
     def add_boot_args(self, extra_args):

=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py	2013-07-25 08:00:25 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py	2013-08-08 07:34:16 +0000
@@ -2261,11 +2261,13 @@ 
         board_conf = get_board_config('highbank')
         boot_commands = board_conf._get_boot_env(
             is_live=False, is_lowmem=False, consoles=[],
-            rootfs_id="UUID=deadbeef", i_img_data="initrd", d_img_data=None)
+            rootfs_id="UUID=deadbeef", i_img_data="initrd",
+            d_img_data="board.dtb")
         expected = {
             'bootargs': 'root=UUID=deadbeef rootwait ro',
             'bootcmd': 'ext2load scsi 0:1 0x00800000 uImage; '
             'ext2load scsi 0:1 0x01000000 uInitrd; '
+            'ext2load scsi 0:1 0x00001000 board.dtb; '
             'bootm 0x00800000 0x01000000 0x00001000',
             'fdt_high': '0xffffffff',
             'initrd_high': '0xffffffff'}