diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 491: Add support for Android on the Mx6QSabrelite board

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

Commit Message

Guilherme Salgado Feb. 20, 2012, 6:37 p.m. UTC
Merge authors:
  Bernhard Rosenkraenzer (berolinux)
  Bernhard Rosenkraenzer (berolinux)
  Guilherme Salgado (salgado)
Related merge proposals:
  https://code.launchpad.net/~berolinux/linaro-image-tools/android-mx6qsabrelite/+merge/93139
  proposed by: Bernhard Rosenkraenzer (berolinux)
  review: Approve - Guilherme Salgado (salgado)
------------------------------------------------------------
revno: 491 [merge]
committer: Guilherme Salgado <guilherme.salgado@linaro.org>
branch nick: trunk
timestamp: Mon 2012-02-20 15:35:13 -0300
message:
  Add support for Android on the Mx6QSabrelite board
modified:
  linaro-android-media-create
  linaro_image_tools/media_create/android_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-android-media-create'
--- linaro-android-media-create	2012-01-19 06:31:50 +0000
+++ linaro-android-media-create	2012-02-20 18:32:21 +0000
@@ -25,14 +25,14 @@ 
 
 from linaro_image_tools import cmd_runner
 
-from linaro_image_tools.media_create.android_boards import android_board_configs
+from linaro_image_tools.media_create.android_boards import (
+    android_board_configs,
+    )
 from linaro_image_tools.media_create.check_device import (
     confirm_device_selection_and_ensure_it_is_ready)
 from linaro_image_tools.media_create.partitions import (
     Media,
-    setup_partitions,
     setup_android_partitions,
-    get_uuid,
     partition_mounted,
     )
 from linaro_image_tools.media_create.rootfs import populate_partition

=== modified file 'linaro_image_tools/media_create/android_boards.py'
--- linaro_image_tools/media_create/android_boards.py	2012-02-08 19:34:27 +0000
+++ linaro_image_tools/media_create/android_boards.py	2012-02-20 18:32:21 +0000
@@ -76,7 +76,10 @@ 
         """
         boot_env = {}
         boot_env["bootargs"] = cls._get_bootargs(consoles)
-        boot_env["bootcmd"] = cls._get_bootcmd(None)
+        # On Android, the DTB file is always built as part of the kernel it
+        # comes from - and lives in the same directory in the boot tarball, so
+        # here we don't need to pass the whole path to it.
+        boot_env["bootcmd"] = cls._get_bootcmd(cls.dtb_name)
         return boot_env
 
     @classmethod
@@ -170,12 +173,13 @@ 
 
 
 class AndroidOmapConfig(AndroidBoardConfig):
-    pass
+    dtb_name = None
 
 
 class AndroidBeagleConfig(AndroidOmapConfig, BeagleConfig):
     _extra_serial_opts = 'console=tty0 console=ttyO2,115200n8'
     android_specific_args = 'init=/init androidboot.console=ttyO2'
+    dtb_name = None
 
 
 class AndroidPandaConfig(AndroidOmapConfig, PandaConfig):
@@ -184,6 +188,7 @@ 
         'earlyprintk fixrtc nocompcache vram=48M '
         'omapfb.vram=0:24M,1:24M mem=456M@0x80000000 mem=512M@0xA0000000')
     android_specific_args = 'init=/init androidboot.console=ttyO2'
+    dtb_name = None
 
 
 class AndroidSnowballSdConfig(AndroidBoardConfig, SnowballSdConfig):
@@ -198,6 +203,7 @@ 
     # needs uImage/uInitrd prefixed with /
     fatload_command = 'fat load'
     uimage_path = '/'
+    dtb_name = None
 
 
 class AndroidSnowballEmmcConfig(AndroidBoardConfig, SnowballEmmcConfig):
@@ -213,6 +219,7 @@ 
     # needs uImage/uInitrd prefixed with /
     fatload_command = 'fat load'
     uimage_path = '/'
+    dtb_name = None
 
     @classmethod
     def get_sfdisk_cmd(cls, should_align_boot_part=False):
@@ -239,6 +246,7 @@ 
         Mx53LoCoConfig.serial_tty)
     android_specific_args = 'init=/init androidboot.console=%s' % (
         Mx53LoCoConfig.serial_tty)
+    dtb_name = None
 
     @classmethod
     def get_sfdisk_cmd(cls, should_align_boot_part=False):
@@ -257,7 +265,17 @@ 
         install_mx5_boot_loader(os.path.join(boot_device_or_file, "u-boot.imx"), boot_partition, cls.LOADER_MIN_SIZE_S)
 
 
+class AndroidMx6QSabreliteConfig(AndroidMx53LoCoConfig):
+    uboot_flavor = 'mx6qsabrelite'
+    kernel_addr = '0x10000000'
+    initrd_addr = '0x12000000'
+    load_addr = '0x10008000'
+    dtb_addr = '0x11ff0000'
+    dtb_name = 'board.dtb'
+
+
 class AndroidSamsungConfig(AndroidBoardConfig):
+    dtb_name = None
 
     @classmethod
     def get_sfdisk_cmd(cls, should_align_boot_part=False):
@@ -279,16 +297,19 @@ 
 class AndroidSMDKV310Config(AndroidSamsungConfig, SMDKV310Config):
     _extra_serial_opts = 'console=tty0 console=ttySAC1,115200n8'
     android_specific_args = 'init=/init androidboot.console=ttySAC1'
+    dtb_name = None
 
 
 class AndroidOrigenConfig(AndroidSamsungConfig, OrigenConfig):
     _extra_serial_opts = 'console=tty0 console=ttySAC2,115200n8'
     android_specific_args = 'init=/init androidboot.console=ttySAC2'
+    dtb_name = None
 
 
 class AndroidVexpressA9Config(AndroidBoardConfig, VexpressA9Config):
     _extra_serial_opts = 'console=tty0 console=ttyAMA0,38400n8'
     android_specific_args = 'init=/init androidboot.console=ttyAMA0'
+    dtb_name = None
 
 
 android_board_configs = {
@@ -299,6 +320,7 @@ 
     'smdkv310': AndroidSMDKV310Config,
     'mx53loco': AndroidMx53LoCoConfig,
     'iMX53': AndroidMx53LoCoConfig,
+    'mx6qsabrelite': AndroidMx6QSabreliteConfig,
     'origen': AndroidOrigenConfig,
     'vexpress-a9': AndroidVexpressA9Config,
     }

=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py	2012-02-08 22:47:59 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py	2012-02-20 18:32:21 +0000
@@ -1187,6 +1187,12 @@ 
             '1318912,-,E\n1318912,524288,L\n1843200,1048576,L\n2891776,,,-',
             android_boards.AndroidMx53LoCoConfig.get_sfdisk_cmd())
 
+    def test_mx6_android(self):
+        self.assertEqual(
+            '1,8191,0xDA\n8192,262144,0x0C,*\n270336,1048576,L\n'
+            '1318912,-,E\n1318912,524288,L\n1843200,1048576,L\n2891776,,,-',
+            android_boards.AndroidMx6QSabreliteConfig.get_sfdisk_cmd())
+
 
 class TestGetSfdiskCmdV2(TestCase):
 
@@ -1481,13 +1487,13 @@ 
 
 
 class TestGetBootCmdAndroid(TestCase):
+
     def test_panda(self):
         # XXX: To fix bug 697824 we have to change class attributes of our
         # OMAP board configs, and some tests do that so to make sure they
         # don't interfere with us we'll reset that before doing anything.
         config = android_board_configs['panda']
         config.serial_tty = config._serial_tty
-        boot_commands = config._get_boot_env(consoles=[])
         expected = {
             'bootargs': 'console=ttyO2,115200n8 '
                         'rootwait ro earlyprintk fixrtc '
@@ -1497,11 +1503,9 @@ 
             'bootcmd': 'fatload mmc 0:1 0x80200000 uImage; '
                        'fatload mmc 0:1 0x81600000 uInitrd; '
                        'bootm 0x80200000 0x81600000'}
-        self.assertEqual(expected, boot_commands)
+        self.assertBootEnv(config, expected)
 
     def test_android_snowball_sd(self):
-        boot_commands = (android_boards.AndroidSnowballSdConfig.
-                         _get_boot_env(consoles=[]))
         expected = {
             'bootargs': 'console=ttyAMA2,115200n8 '
                         'rootwait ro earlyprintk '
@@ -1511,11 +1515,10 @@ 
             'bootcmd': 'fat load mmc 1:1 0x00100000 /uImage; '
                        'fat load mmc 1:1 0x05000000 /uInitrd; '
                        'bootm 0x00100000 0x05000000'}
-        self.assertEqual(expected, boot_commands)
+        self.assertBootEnv(
+            android_boards.AndroidSnowballSdConfig, expected)
 
     def test_android_snowball_emmc(self):
-        boot_commands = (android_boards.AndroidSnowballEmmcConfig.
-                         _get_boot_env(consoles=[]))
         expected = {
             'bootargs': 'console=ttyAMA2,115200n8 '
                         'rootwait ro earlyprintk '
@@ -1525,33 +1528,30 @@ 
             'bootcmd': 'fat load mmc 0:2 0x00100000 /uImage; '
                        'fat load mmc 0:2 0x05000000 /uInitrd; '
                        'bootm 0x00100000 0x05000000'}
-        self.assertEqual(expected, boot_commands)
+        self.assertBootEnv(
+            android_boards.AndroidSnowballEmmcConfig, expected)
 
     def test_android_origen(self):
-        boot_commands = (android_boards.AndroidOrigenConfig.
-                         _get_boot_env(consoles=[]))
         expected = {
             'bootargs': 'console=tty0 console=ttySAC2,115200n8 '
                         'rootwait ro init=/init androidboot.console=ttySAC2',
             'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; '
                        'fatload mmc 0:2 0x42000000 uInitrd; '
                        'bootm 0x40007000 0x42000000'}
-        self.assertEqual(expected, boot_commands)
+        self.assertBootEnv(
+            android_boards.AndroidOrigenConfig, expected)
 
     def test_android_vexpress_a9(self):
-        boot_commands = (android_boards.AndroidVexpressA9Config.
-                         _get_boot_env(consoles=[]))
         expected = {
             'bootargs': 'console=tty0 console=ttyAMA0,38400n8 '
                         'rootwait ro init=/init androidboot.console=ttyAMA0',
             'bootcmd': 'fatload mmc 0:1 0x60000000 uImage; '
                        'fatload mmc 0:1 0x62000000 uInitrd; '
                        'bootm 0x60000000 0x62000000'}
-        self.assertEqual(expected, boot_commands)
+        self.assertBootEnv(
+            android_boards.AndroidVexpressA9Config, expected)
 
     def test_android_mx5(self):
-        boot_commands = (android_boards.AndroidMx53LoCoConfig.
-                         _get_boot_env(consoles=[]))
         expected = {
             'bootargs': 'console=ttymxc0,115200n8 '
                         'rootwait ro earlyprintk rootdelay=1 fixrtc '
@@ -1560,7 +1560,24 @@ 
             'bootcmd': 'fatload mmc 0:2 0x70000000 uImage; '
                        'fatload mmc 0:2 0x72000000 uInitrd; '
                        'bootm 0x70000000 0x72000000'}
-        self.assertEqual(expected, boot_commands)
+        self.assertBootEnv(
+            android_boards.AndroidMx53LoCoConfig, expected)
+
+    def test_android_mx6(self):
+        expected = {
+            'bootargs': 'console=ttymxc0,115200n8 '
+                        'rootwait ro earlyprintk rootdelay=1 fixrtc '
+                        'nocompcache di1_primary tve init=/init '
+                        'androidboot.console=ttymxc0',
+            'bootcmd': 'fatload mmc 0:2 0x10000000 uImage; '
+                       'fatload mmc 0:2 0x12000000 uInitrd; '
+                       'fatload mmc 0:2 0x11ff0000 board.dtb; '
+                       'bootm 0x10000000 0x12000000 0x11ff0000'}
+        self.assertBootEnv(
+            android_boards.AndroidMx6QSabreliteConfig, expected)
+
+    def assertBootEnv(self, config, expected):
+        self.assertEqual(expected, config._get_boot_env(consoles=[]))
 
 
 class TestUnpackBinaryTarball(TestCaseWithFixtures):