From patchwork Mon Dec 10 10:51:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 13447 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D86F923E19 for ; Mon, 10 Dec 2012 10:51:17 +0000 (UTC) Received: from mail-ie0-f174.google.com (mail-ie0-f174.google.com [209.85.223.174]) by fiordland.canonical.com (Postfix) with ESMTP id 34220A190FF for ; Mon, 10 Dec 2012 10:51:17 +0000 (UTC) Received: by mail-ie0-f174.google.com with SMTP id c11so7422781ieb.19 for ; Mon, 10 Dec 2012 02:51:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=SlkQVtkcgcO96OQHhaIoPjb5tB9KNdw0PydnfciruBA=; b=FKsttdl+UsAu2TrVF+CJuW50YFjg/GDUo+i+m1N8M9GgiG65JKeUW8zWtF91eQD7wA udHj9WoYKuGgMXrp0j4I4GcghyC1gxCIqgwUcPJu/GvZ35q8AUlZ2rzyZf4M2OuH+1Fm IyZ2TsxxEiPWSoMqe93o0fiPtsTqk284BmfihPFxtoh82jtgT//WWavZKL9MVWoZgre2 h540WxTHusbCu2WnRSh5y47d+nUCwiidM7vTqNBAkiCdGUtyCnRke+Qx5mFhFRvuzlFC zPNVjBOeVXYL5OueCFXKk+VLcOQbr9PMDASQSm8YtnXrQC0rAnbSid00dF19EwbAM9Ja kw6g== Received: by 10.50.42.168 with SMTP id p8mr6010060igl.57.1355136676576; Mon, 10 Dec 2012 02:51:16 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp59097igt; Mon, 10 Dec 2012 02:51:15 -0800 (PST) Received: by 10.180.85.194 with SMTP id j2mr9939946wiz.12.1355136675226; Mon, 10 Dec 2012 02:51:15 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id a6si8250154wix.26.2012.12.10.02.51.14 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 02:51:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Ti0x8-00027v-Di for ; Mon, 10 Dec 2012 10:51:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 57290E0127 for ; Mon, 10 Dec 2012 10:51:14 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 590 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 590: Generic support for Samsung boards. Message-Id: <20121210105114.25660.69401.launchpad@ackee.canonical.com> Date: Mon, 10 Dec 2012 10:51:14 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16341"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: f73fcebac34c471aa733d4083a865784f285c51a X-Gm-Message-State: ALoCoQlwqDbHAA3PJTeLbth2NAx8a4QGUkJJcWcXd30LG8Qat8Zj2S6+D5eNhVt0So8o2psBSqTy Merge authors: Tushar Behera (tusharbehera) Related merge proposals: https://code.launchpad.net/~tusharbehera/linaro-image-tools/origen-generic/+merge/138402 proposed by: Tushar Behera (tusharbehera) review: Approve - Milo Casagrande (milo) ------------------------------------------------------------ revno: 590 [merge] author: Tushar Behera committer: Milo Casagrande branch nick: trunk timestamp: Mon 2012-12-10 11:49:30 +0100 message: Generic support for Samsung boards. modified: linaro_image_tools/hwpack/config.py linaro_image_tools/hwpack/hardwarepack.py linaro_image_tools/hwpack/hwpack_fields.py linaro_image_tools/hwpack/tests/test_config_v3.py linaro_image_tools/media_create/android_boards.py 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 === modified file 'linaro_image_tools/hwpack/config.py' --- linaro_image_tools/hwpack/config.py 2012-10-02 15:25:27 +0000 +++ linaro_image_tools/hwpack/config.py 2012-12-07 08:47:58 +0000 @@ -71,7 +71,9 @@ SAMSUNG_BL1_LEN_FIELD, SAMSUNG_BL1_START_FIELD, SAMSUNG_BL2_LEN_FIELD, + SAMSUNG_BL2_START_FIELD, SAMSUNG_ENV_LEN_FIELD, + SAMSUNG_ENV_START_FIELD, SERIAL_TTY_FIELD, SNOWBALL_STARTUP_FILES_CONFIG_FIELD, SOURCES_FIELD, @@ -298,7 +300,9 @@ self._validate_snowball_startup_files_config() self._validate_samsung_bl1_start() self._validate_samsung_bl1_len() + self._validate_samsung_env_start() self._validate_samsung_env_len() + self._validate_samsung_bl2_start() self._validate_samsung_bl2_len() self._validate_sources() @@ -867,6 +871,14 @@ return self._get_option(SAMSUNG_BL1_LEN_FIELD) @property + def samsung_env_start(self): + """Env start offset for Samsung boards. + + A str. + """ + return self._get_option(SAMSUNG_ENV_START_FIELD) + + @property def samsung_env_len(self): """Env length for Samsung boards. @@ -875,6 +887,14 @@ return self._get_option(SAMSUNG_ENV_LEN_FIELD) @property + def samsung_bl2_start(self): + """BL2 start offset for Samsung boards. + + A str. + """ + return self._get_option(SAMSUNG_BL2_START_FIELD) + + @property def samsung_bl2_len(self): """BL2 length for Samsung boards. @@ -1269,6 +1289,16 @@ raise HwpackConfigError( "Invalid samsung_bl1_len %s" % (samsung_bl1_len)) + def _validate_samsung_env_start(self): + samsung_env_start = self.samsung_env_start + if samsung_env_start is None: + return + try: + assert int(samsung_env_start) > 0 + except: + raise HwpackConfigError( + "Invalid samsung_env_start %s" % (samsung_env_start)) + def _validate_samsung_env_len(self): samsung_env_len = self.samsung_env_len if samsung_env_len is None: @@ -1279,6 +1309,16 @@ raise HwpackConfigError( "Invalid samsung_env_len %s" % (samsung_env_len)) + def _validate_samsung_bl2_start(self): + samsung_bl2_start = self.samsung_bl2_start + if samsung_bl2_start is None: + return + try: + assert int(samsung_bl2_start) > 0 + except: + raise HwpackConfigError( + "Invalid samsung_bl2_start %s" % (samsung_bl2_start)) + def _validate_samsung_bl2_len(self): samsung_bl2_len = self.samsung_bl2_len if samsung_bl2_len is None: === modified file 'linaro_image_tools/hwpack/hardwarepack.py' --- linaro_image_tools/hwpack/hardwarepack.py 2012-09-25 16:24:32 +0000 +++ linaro_image_tools/hwpack/hardwarepack.py 2012-12-07 08:47:58 +0000 @@ -64,7 +64,9 @@ SAMSUNG_BL1_LEN_FIELD, SAMSUNG_BL1_START_FIELD, SAMSUNG_BL2_LEN_FIELD, + SAMSUNG_BL2_START_FIELD, SAMSUNG_ENV_LEN_FIELD, + SAMSUNG_ENV_START_FIELD, SERIAL_TTY_FIELD, SNOWBALL_STARTUP_FILES_CONFIG_FIELD, SUPPORT_FIELD, @@ -129,7 +131,8 @@ extra_serial_opts=None, loader_start=None, snowball_startup_files_config=None, samsung_bl1_start=None, samsung_bl1_len=None, - samsung_env_len=None, samsung_bl2_len=None): + samsung_env_start=None, samsung_env_len=None, + samsung_bl2_start=None, samsung_bl2_len=None): """Add fields that are specific to the new format. These fields are not present in earlier config files. @@ -163,7 +166,9 @@ self.snowball_startup_files_config = snowball_startup_files_config self.samsung_bl1_start = samsung_bl1_start self.samsung_bl1_len = samsung_bl1_len + self.samsung_env_start = samsung_env_start self.samsung_env_len = samsung_env_len + self.samsung_bl2_start = samsung_bl2_start self.samsung_bl2_len = samsung_bl2_len @classmethod @@ -224,7 +229,9 @@ samsung_bl1_len=config.samsung_bl1_len, samsung_bl1_start=config.samsung_bl1_start, samsung_bl2_len=config.samsung_bl2_len, + samsung_bl2_start=config.samsung_bl2_start, samsung_env_len=config.samsung_env_len, + samsung_env_start=config.samsung_env_start, serial_tty=config.serial_tty, snowball_startup_files_config=snowball_startup_config, spl_dd=config.spl_dd, @@ -329,8 +336,12 @@ metadata += dump({SAMSUNG_BL1_START_FIELD: self.samsung_bl1_start}) if self.samsung_bl1_len is not None: metadata += dump({SAMSUNG_BL1_LEN_FIELD: self.samsung_bl1_len}) + if self.samsung_env_start is not None: + metadata += dump({SAMSUNG_ENV_START_FIELD: self.samsung_env_start}) if self.samsung_env_len is not None: metadata += dump({SAMSUNG_ENV_LEN_FIELD: self.samsung_env_len}) + if self.samsung_bl2_start is not None: + metadata += dump({SAMSUNG_BL2_START_FIELD: self.samsung_bl2_start}) if self.samsung_bl2_len is not None: metadata += dump({SAMSUNG_BL2_LEN_FIELD: self.samsung_bl2_len}) return metadata @@ -415,8 +426,12 @@ metadata += "SAMSUNG_BL1_START=%s\n" % self.samsung_bl1_start if self.samsung_bl1_len is not None: metadata += "SAMSUNG_BL1_LEN=%s\n" % self.samsung_bl1_len + if self.samsung_env_start is not None: + metadata += "SAMSUNG_ENV_START=%s\n" % self.samsung_env_start if self.samsung_env_len is not None: metadata += "SAMSUNG_ENV_LEN=%s\n" % self.samsung_env_len + if self.samsung_bl2_start is not None: + metadata += "SAMSUNG_BL2_START=%s\n" % self.samsung_bl2_start if self.samsung_bl2_len is not None: metadata += "SAMSUNG_BL2_LEN=%s\n" % self.samsung_bl2_len return metadata === modified file 'linaro_image_tools/hwpack/hwpack_fields.py' --- linaro_image_tools/hwpack/hwpack_fields.py 2012-12-07 09:37:42 +0000 +++ linaro_image_tools/hwpack/hwpack_fields.py 2012-12-10 10:49:30 +0000 @@ -76,7 +76,9 @@ SAMSUNG_BL1_LEN_FIELD = 'samsung_bl1_len' SAMSUNG_BL1_START_FIELD = 'samsung_bl1_start' SAMSUNG_BL2_LEN_FIELD = 'samsung_bl2_len' +SAMSUNG_BL2_START_FIELD = 'samsung_bl2_start' SAMSUNG_ENV_LEN_FIELD = 'samsung_env_len' +SAMSUNG_ENV_START_FIELD = 'samsung_env_start' # Snowball fields SNOWBALL_STARTUP_FILES_CONFIG_FIELD = 'snowball_startup_files_config' @@ -142,7 +144,9 @@ SAMSUNG_BL1_LEN_FIELD: None, SAMSUNG_BL1_START_FIELD: None, SAMSUNG_ENV_LEN_FIELD: None, + SAMSUNG_ENV_START_FIELD: None, SAMSUNG_BL2_LEN_FIELD: None, + SAMSUNG_BL2_START_FIELD: None, SNOWBALL_STARTUP_FILES_CONFIG_FIELD: None, SOURCES_FIELD: None, BOOTLOADERS_FIELD: { === modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py' --- linaro_image_tools/hwpack/tests/test_config_v3.py 2012-10-01 09:26:10 +0000 +++ linaro_image_tools/hwpack/tests/test_config_v3.py 2012-12-07 08:47:58 +0000 @@ -29,7 +29,9 @@ SAMSUNG_BL1_LEN_FIELD, SAMSUNG_BL1_START_FIELD, SAMSUNG_BL2_LEN_FIELD, + SAMSUNG_BL2_START_FIELD, SAMSUNG_ENV_LEN_FIELD, + SAMSUNG_ENV_START_FIELD, ) @@ -816,11 +818,21 @@ SAMSUNG_BL2_LEN_FIELD + ': 1\n') self.assertEqual(None, config._validate_keys()) + def test_valid_samsung_bl2_start_field(self): + config = self.get_config(self.valid_start_v3 + + SAMSUNG_BL2_START_FIELD + ': 1\n') + self.assertEqual(None, config._validate_keys()) + def test_valid_samsung_env_len_field(self): config = self.get_config(self.valid_start_v3 + SAMSUNG_ENV_LEN_FIELD + ': 1\n') self.assertEqual(None, config._validate_keys()) + def test_valid_samsung_env_start_field(self): + config = self.get_config(self.valid_start_v3 + + SAMSUNG_ENV_START_FIELD + ': 1\n') + self.assertEqual(None, config._validate_keys()) + def test_samsung_field_wrong(self): config = self.get_config(self.valid_start_v3 + 'samsung_wrong_field: 1\n') === modified file 'linaro_image_tools/media_create/android_boards.py' --- linaro_image_tools/media_create/android_boards.py 2012-10-17 10:48:49 +0000 +++ linaro_image_tools/media_create/android_boards.py 2012-12-06 04:45:51 +0000 @@ -323,8 +323,8 @@ @classmethod def get_sfdisk_cmd(cls, should_align_boot_part=False): loaders_min_len = ( - cls.SAMSUNG_V310_BL2_START + cls.SAMSUNG_V310_BL2_LEN - - cls.SAMSUNG_V310_BL1_START) + cls.samsung_bl1_start + cls.samsung_bl1_len + cls.samsung_bl2_len + + cls.samsung_env_len) loader_start, loader_end, loader_len = align_partition( 1, loaders_min_len, 1, PART_ALIGN_S) === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2012-12-05 13:01:06 +0000 +++ linaro_image_tools/media_create/boards.py 2012-12-10 10:49:30 +0000 @@ -163,37 +163,26 @@ # Support for dtb_files as per hwpack v3 format. dtb_files = None - # Samsung v310 implementation notes and terminology + # Samsung Boot-loader implementation notes and terminology # # * BL0, BL1 etc. are the various bootloaders in order of execution - # * BL0 is the first stage bootloader, located in ROM; it loads a 32s - # long BL1 from MMC offset +1s and runs it - # * BL1 is the secondary program loader (SPL), a small (< 14k) version + # * BL0 is the first stage bootloader, located in ROM; it loads BL1/SPL + # from MMC offset +1s and runs it. + # * BL1 is the secondary program loader (SPL), a small version # of U-Boot with a checksum; it inits DRAM and loads a 1024s long BL2 - # to DRAM from MMC offset +65s - # * BL2 is U-Boot; it loads its 32s (16 KiB) long environment from MMC - # offset +33s which tells it to load a boot.scr from the first FAT - # partition of the MMC - # - # Layout: - # +0s: part table / MBR, 1s long - # +1s: BL1/SPL, 32s long - # +33s: U-Boot environment, 32s long - # +65s: U-Boot, 1024s long - # >= +1089s: FAT partition with boot script (boot.scr), kernel (uImage) - # and initrd (uInitrd) - SAMSUNG_V310_BL1_START = 1 - SAMSUNG_V310_BL1_LEN = 32 - SAMSUNG_V310_ENV_START = SAMSUNG_V310_BL1_START + SAMSUNG_V310_BL1_LEN - SAMSUNG_V310_ENV_LEN = 32 - assert SAMSUNG_V310_ENV_START == 33, ( - "BL1 expects u-boot environment at +33s") - assert SAMSUNG_V310_ENV_LEN * SECTOR_SIZE == 16 * 1024, ( - "BL1 expects u-boot environment to be 16 KiB") - SAMSUNG_V310_BL2_START = SAMSUNG_V310_ENV_START + SAMSUNG_V310_ENV_LEN - SAMSUNG_V310_BL2_LEN = 1024 - assert SAMSUNG_V310_BL2_LEN * SECTOR_SIZE == 512 * 1024, ( - "BL1 expects BL2 (u-boot) to be 512 KiB") + # from MMC and runs it. + # * BL2 is the U-Boot. + # + # samsung_bl1_{start,len}: Offset and maximum size for BL1 + # samsung_bl2_{start,len}: Offset and maximum size for BL2 + # samsung_env_{start,len}: Offset and maximum size for Environment settings + # + samsung_bl1_start = 1 + samsung_bl1_len = 32 + samsung_bl2_start = 65 + samsung_bl2_len = 1024 + samsung_env_start = 33 + samsung_env_len = 32 hardwarepack_handler = None @@ -231,12 +220,12 @@ cls.kernel_flavors = None cls.mmc_option = None cls.mmc_part_offset = None - cls.SAMSUNG_V310_BL1_START = None - cls.SAMSUNG_V310_BL1_LEN = None - cls.SAMSUNG_V310_ENV_START = None - cls.SAMSUNG_V310_ENV_LEN = None - cls.SAMSUNG_V310_BL2_START = None - cls.SAMSUNG_V310_BL2_LEN = None + cls.samsung_bl1_start = None + cls.samsung_bl1_len = None + cls.samsung_env_len = None + cls.samsung_bl2_len = None + # cls.samsung_bl2_start and cls.samsung_env_start should + # be initialized to default value for backward compatibility. # Set new values from metadata. cls.kernel_addr = cls.get_metadata_field('kernel_addr') @@ -332,31 +321,30 @@ loader_start = cls.get_metadata_field('loader_start') if loader_start is not None: cls.LOADER_START_S = int(loader_start) + samsung_bl1_start = cls.get_metadata_field('samsung_bl1_start') if samsung_bl1_start is not None: - cls.SAMSUNG_V310_BL1_START = int(samsung_bl1_start) + cls.samsung_bl1_start = int(samsung_bl1_start) + samsung_bl1_len = cls.get_metadata_field('samsung_bl1_len') if samsung_bl1_len is not None: - cls.SAMSUNG_V310_BL1_LEN = int(samsung_bl1_len) + cls.samsung_bl1_len = int(samsung_bl1_len) + + samsung_bl2_len = cls.get_metadata_field('samsung_bl2_len') + if samsung_bl2_len is not None: + cls.samsung_bl2_len = int(samsung_bl2_len) + + samsung_bl2_start = cls.get_metadata_field('samsung_bl2_start') + if samsung_bl2_start is not None: + cls.samsung_bl2_start = int(samsung_bl2_start) + samsung_env_len = cls.get_metadata_field('samsung_env_len') if samsung_env_len is not None: - cls.SAMSUNG_V310_ENV_LEN = int(samsung_env_len) - assert cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE == 16 * 1024, ( - "BL1 expects u-boot environment to be 16 KiB") - samsung_bl2_len = cls.get_metadata_field('samsung_bl2_len') - if samsung_bl2_len is not None: - cls.SAMSUNG_V310_BL2_LEN = int(samsung_bl2_len) - assert cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE == 512 * 1024, ( - "BL1 expects BL2 (u-boot) to be 512 KiB") + cls.samsung_env_len = int(samsung_env_len) - if (cls.SAMSUNG_V310_BL1_START and cls.SAMSUNG_V310_BL1_LEN): - cls.SAMSUNG_V310_ENV_START = (cls.SAMSUNG_V310_BL1_START + - cls.SAMSUNG_V310_BL1_LEN) - assert cls.SAMSUNG_V310_ENV_START == 33, ( - "BL1 expects u-boot environment at +33s") - if (cls.SAMSUNG_V310_ENV_START and cls.SAMSUNG_V310_ENV_LEN): - cls.SAMSUNG_V310_BL2_START = (cls.SAMSUNG_V310_ENV_START + - cls.SAMSUNG_V310_ENV_LEN) + samsung_env_start = cls.get_metadata_field('samsung_env_start') + if samsung_env_start is not None: + cls.samsung_env_start = int(samsung_env_start) cls.bootloader_copy_files = cls.hardwarepack_handler.get_field( "bootloader_copy_files")[0] @@ -660,11 +648,11 @@ def install_samsung_boot_loader(cls, samsung_spl_file, bootloader_file, boot_device_or_file): cls._dd_file(samsung_spl_file, boot_device_or_file, - cls.SAMSUNG_V310_BL1_START, - cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE) + cls.samsung_bl1_start, + cls.samsung_bl1_len * SECTOR_SIZE) cls._dd_file(bootloader_file, boot_device_or_file, - cls.SAMSUNG_V310_BL2_START, - cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE) + cls.samsung_bl2_start, + cls.samsung_bl2_len * SECTOR_SIZE) @classmethod def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir, @@ -712,12 +700,12 @@ if cls.env_dd: # Do we need to zero out the env before flashing it? _dd("/dev/zero", boot_device_or_file, - count=cls.SAMSUNG_V310_ENV_LEN, - seek=cls.SAMSUNG_V310_ENV_START) - env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE + count=cls.samsung_env_len, + seek=cls.samsung_env_start) + env_size = cls.samsung_env_len * SECTOR_SIZE env_file = make_flashable_env(boot_env, env_size) cls._dd_file(env_file, boot_device_or_file, - cls.SAMSUNG_V310_ENV_START) + cls.samsung_env_start) @classmethod def _make_boot_files(cls, boot_env, chroot_dir, boot_dir, @@ -1415,8 +1403,8 @@ def get_v1_sfdisk_cmd(cls, should_align_boot_part=False): # bootloaders partition needs to hold BL1, U-Boot environment, and BL2 loaders_min_len = ( - cls.SAMSUNG_V310_BL2_START + cls.SAMSUNG_V310_BL2_LEN - - cls.SAMSUNG_V310_BL1_START) + cls.samsung_bl1_start + cls.samsung_bl1_len + cls.samsung_bl2_len + + cls.samsung_env_len) # bootloaders partition loaders_start, loaders_end, loaders_len = align_partition( @@ -1444,9 +1432,9 @@ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1 cls.install_samsung_boot_loader(cls._get_samsung_spl(chroot_dir), cls._get_samsung_bootloader(chroot_dir), boot_device_or_file) - env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE + env_size = cls.samsung_env_len * SECTOR_SIZE env_file = make_flashable_env(boot_env, env_size) - _dd(env_file, boot_device_or_file, seek=cls.SAMSUNG_V310_ENV_START) + _dd(env_file, boot_device_or_file, seek=cls.samsung_env_start) make_uImage(cls.load_addr, k_img_data, boot_dir) make_uInitrd(i_img_data, boot_dir) @@ -1493,19 +1481,19 @@ @classmethod def populate_raw_partition(cls, boot_device_or_file, chroot_dir): # Zero the env so that the boot_script will get loaded - _dd("/dev/zero", boot_device_or_file, count=cls.SAMSUNG_V310_ENV_LEN, - seek=cls.SAMSUNG_V310_ENV_START) + _dd("/dev/zero", boot_device_or_file, count=cls.samsung_env_len, + seek=cls.samsung_env_start) # Populate created raw partition with BL1 and u-boot spl_file = os.path.join(chroot_dir, 'boot', 'u-boot-mmc-spl.bin') assert os.path.getsize(spl_file) <= ( - cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE), ( - "%s is larger than SAMSUNG_V310_BL1_LEN" % spl_file) - _dd(spl_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL1_START) + cls.samsung_bl1_len * SECTOR_SIZE), ( + "%s is larger than Samsung BL1 size" % spl_file) + _dd(spl_file, boot_device_or_file, seek=cls.samsung_bl1_start) uboot_file = os.path.join(chroot_dir, 'boot', 'u-boot.bin') assert os.path.getsize(uboot_file) <= ( - cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE), ( - "%s is larger than SAMSUNG_V310_BL2_LEN" % uboot_file) - _dd(uboot_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL2_START) + cls.samsung_bl2_len * SECTOR_SIZE), ( + "%s is larger than Samsung BL2 size" % uboot_file) + _dd(uboot_file, boot_device_or_file, seek=cls.samsung_bl2_start) class SMDKV310Config(SamsungConfig): === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2012-12-05 13:01:06 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2012-12-10 10:49:30 +0000 @@ -1664,9 +1664,10 @@ def test_smdkv310(self): class config(board_configs['smdkv310']): partition_layout = 'reserved_bootfs_rootfs' - LOADER_MIN_SIZE_S = (boards.BoardConfig.SAMSUNG_V310_BL2_START + - boards.BoardConfig.SAMSUNG_V310_BL2_LEN - - boards.BoardConfig.SAMSUNG_V310_BL1_START) + LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start + + boards.BoardConfig.samsung_bl1_len + + boards.BoardConfig.samsung_bl2_len + + boards.BoardConfig.samsung_env_len) self.assertEquals( '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', config.get_sfdisk_cmd()) @@ -1674,9 +1675,10 @@ def test_origen(self): class config(board_configs['origen']): partition_layout = 'reserved_bootfs_rootfs' - LOADER_MIN_SIZE_S = (boards.BoardConfig.SAMSUNG_V310_BL2_START + - boards.BoardConfig.SAMSUNG_V310_BL2_LEN - - boards.BoardConfig.SAMSUNG_V310_BL1_START) + LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start + + boards.BoardConfig.samsung_bl1_len + + boards.BoardConfig.samsung_bl2_len + + boards.BoardConfig.samsung_env_len) self.assertEquals( '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', config.get_sfdisk_cmd()) @@ -2212,10 +2214,10 @@ expected = [ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' 'seek=%d' % (sudo_args, bootloader_flavor, - boards.SMDKV310Config.SAMSUNG_V310_BL1_START), + boards.SMDKV310Config.samsung_bl1_start), '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' 'seek=%d' % (sudo_args, bootloader_flavor, - boards.SMDKV310Config.SAMSUNG_V310_BL2_START)] + boards.SMDKV310Config.samsung_bl2_start)] self.assertEqual(expected, fixture.mock.commands_executed) def test_install_origen_u_boot(self): @@ -2242,10 +2244,10 @@ expected = [ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' 'seek=%d' % (sudo_args, bootloader_flavor, - boards.OrigenConfig.SAMSUNG_V310_BL1_START), + boards.OrigenConfig.samsung_bl1_start), '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' 'seek=%d' % (sudo_args, bootloader_flavor, - boards.OrigenConfig.SAMSUNG_V310_BL2_START)] + boards.OrigenConfig.samsung_bl2_start)] self.assertEqual(expected, fixture.mock.commands_executed) def test_get_plain_boot_script_contents(self):