Merge lp:~tusharbehera/linaro-image-tools/origen-generic into lp:linaro-image-tools/11.11

Proposed by Tushar Behera
Status: Merged
Merged at revision: 590
Proposed branch: lp:~tusharbehera/linaro-image-tools/origen-generic
Merge into: lp:linaro-image-tools/11.11
Diff against target: 501 lines (+146/-85)
7 files modified
linaro_image_tools/hwpack/config.py (+40/-0)
linaro_image_tools/hwpack/hardwarepack.py (+16/-1)
linaro_image_tools/hwpack/hwpack_fields.py (+4/-0)
linaro_image_tools/hwpack/tests/test_config_v3.py (+12/-0)
linaro_image_tools/media_create/android_boards.py (+2/-2)
linaro_image_tools/media_create/boards.py (+60/-72)
linaro_image_tools/media_create/tests/test_media_create.py (+12/-10)
To merge this branch: bzr merge lp:~tusharbehera/linaro-image-tools/origen-generic
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Approve
Review via email: mp+138402@code.launchpad.net

Description of the change

Make l-(a)-m-c generic for Samsung Boards. The length and offset for BL1, BL2 and ENV are made generic and they can be loaded through board config files. This way, adding support for new boards would be easier.

To post a comment you must log in.
590. By Tushar Behera

test: Fix testr errors

Revision history for this message
Milo Casagrande (milo) wrote :
Download full text (7.2 KiB)

Hello Tushar,

thanks for working on this!

The general refactoring looks good to me, I have some comments that
follows inline, but nothing earth-shaking.

On Thu, Dec 6, 2012 at 11:02 AM, Tushar Behera <email address hidden> wrote:
>
> === modified file 'linaro_image_tools/media_create/boards.py'
> --- linaro_image_tools/media_create/boards.py 2012-10-22 06:57:20 +0000
> +++ linaro_image_tools/media_create/boards.py 2012-12-06 10:01:23 +0000
> @@ -425,37 +425,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)

Is the layout part not relevant anymore? Did it change or can it
change in the future?
It was handy to have around, at least for somebody looking at the code
and with not much knowledge of the Samsung layouts. If it is not
relevant anymore, fine by me to remove it.

> @@ -493,12 +482,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_start = None
> + cls.samsung_env_len = None
> + cls.samsung_bl2_start = None
> + cls.samsung_bl2_len = None
>
> # Set new values from metadata.
> cls.kernel_addr = cls.get_metadata_field('kernel_addr')
> @@ -594,31 +583,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')
> ...

Read more...

Revision history for this message
Milo Casagrande (milo) :
review: Needs Information
Revision history for this message
Данило Шеган (danilo) wrote :

Considering this changes boards.py as well, we need to ensure that l-m-c is not broken for existing builds, and that hardware packs (see https://wiki.linaro.org/HardwarePacksV3#Samsung_Parameters) still continue to work properly.

Revision history for this message
Tushar Behera (tusharbehera) wrote :
Download full text (8.5 KiB)

On 12/06/2012 06:37 PM, Milo Casagrande wrote:
> Hello Tushar,
>
> thanks for working on this!
>
> The general refactoring looks good to me, I have some comments that
> follows inline, but nothing earth-shaking.
>
> On Thu, Dec 6, 2012 at 11:02 AM, Tushar Behera <email address hidden> wrote:
>>
>> === modified file 'linaro_image_tools/media_create/boards.py'
>> --- linaro_image_tools/media_create/boards.py 2012-10-22 06:57:20 +0000
>> +++ linaro_image_tools/media_create/boards.py 2012-12-06 10:01:23 +0000
>> @@ -425,37 +425,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)
>
> Is the layout part not relevant anymore? Did it change or can it
> change in the future?
> It was handy to have around, at least for somebody looking at the code
> and with not much knowledge of the Samsung layouts. If it is not
> relevant anymore, fine by me to remove it.
>

The layout part is not fixed anymore. In the earlier case (for SMDKV310
and Origen), the layout was like below.

--------------------------------------------
 | BL1 | ENV | BL2 |
--------------------------------------------
 1 +32s 33 +32s 65 +1024 1089
--------------------------------------------

The newer layout is a bit flexible wherein ENV may lie before or after
BL2, depending on the specific u-boot. That is why the offset of ENV and
BL2 is no more fixed, rather should be provided through board config.

>> @@ -493,12 +482,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
>> + ...

Read more...

591. By Tushar Behera

Fix l-m-c issues after refactoring Samsung related code

Revision history for this message
Milo Casagrande (milo) wrote :

Hello Tushar,

overall it looks good to me. I tested creating a panda image and everything works as expected.
If somebody else can take a look and perform another image creation/installation, that would be better.

One thing that should also be done is documenting the two new fields (samsung_env_start, samsung_bl2_start) here:

https://wiki.linaro.org/HardwarePacksV3#Samsung_Parameters

In order to have all the fields listed and to keep track of them (also for people creating new hwpack configuration files).

review: Approve
Revision history for this message
Tushar Behera (tusharbehera) wrote :
Revision history for this message
Milo Casagrande (milo) wrote :

Thanks Tushar!
This has now been merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 10:41:19 +0000
@@ -71,7 +71,9 @@
71 SAMSUNG_BL1_LEN_FIELD,71 SAMSUNG_BL1_LEN_FIELD,
72 SAMSUNG_BL1_START_FIELD,72 SAMSUNG_BL1_START_FIELD,
73 SAMSUNG_BL2_LEN_FIELD,73 SAMSUNG_BL2_LEN_FIELD,
74 SAMSUNG_BL2_START_FIELD,
74 SAMSUNG_ENV_LEN_FIELD,75 SAMSUNG_ENV_LEN_FIELD,
76 SAMSUNG_ENV_START_FIELD,
75 SERIAL_TTY_FIELD,77 SERIAL_TTY_FIELD,
76 SNOWBALL_STARTUP_FILES_CONFIG_FIELD,78 SNOWBALL_STARTUP_FILES_CONFIG_FIELD,
77 SOURCES_FIELD,79 SOURCES_FIELD,
@@ -298,7 +300,9 @@
298 self._validate_snowball_startup_files_config()300 self._validate_snowball_startup_files_config()
299 self._validate_samsung_bl1_start()301 self._validate_samsung_bl1_start()
300 self._validate_samsung_bl1_len()302 self._validate_samsung_bl1_len()
303 self._validate_samsung_env_start()
301 self._validate_samsung_env_len()304 self._validate_samsung_env_len()
305 self._validate_samsung_bl2_start()
302 self._validate_samsung_bl2_len()306 self._validate_samsung_bl2_len()
303307
304 self._validate_sources()308 self._validate_sources()
@@ -867,6 +871,14 @@
867 return self._get_option(SAMSUNG_BL1_LEN_FIELD)871 return self._get_option(SAMSUNG_BL1_LEN_FIELD)
868872
869 @property873 @property
874 def samsung_env_start(self):
875 """Env start offset for Samsung boards.
876
877 A str.
878 """
879 return self._get_option(SAMSUNG_ENV_START_FIELD)
880
881 @property
870 def samsung_env_len(self):882 def samsung_env_len(self):
871 """Env length for Samsung boards.883 """Env length for Samsung boards.
872884
@@ -875,6 +887,14 @@
875 return self._get_option(SAMSUNG_ENV_LEN_FIELD)887 return self._get_option(SAMSUNG_ENV_LEN_FIELD)
876888
877 @property889 @property
890 def samsung_bl2_start(self):
891 """BL2 start offset for Samsung boards.
892
893 A str.
894 """
895 return self._get_option(SAMSUNG_BL2_START_FIELD)
896
897 @property
878 def samsung_bl2_len(self):898 def samsung_bl2_len(self):
879 """BL2 length for Samsung boards.899 """BL2 length for Samsung boards.
880900
@@ -1269,6 +1289,16 @@
1269 raise HwpackConfigError(1289 raise HwpackConfigError(
1270 "Invalid samsung_bl1_len %s" % (samsung_bl1_len))1290 "Invalid samsung_bl1_len %s" % (samsung_bl1_len))
12711291
1292 def _validate_samsung_env_start(self):
1293 samsung_env_start = self.samsung_env_start
1294 if samsung_env_start is None:
1295 return
1296 try:
1297 assert int(samsung_env_start) > 0
1298 except:
1299 raise HwpackConfigError(
1300 "Invalid samsung_env_start %s" % (samsung_env_start))
1301
1272 def _validate_samsung_env_len(self):1302 def _validate_samsung_env_len(self):
1273 samsung_env_len = self.samsung_env_len1303 samsung_env_len = self.samsung_env_len
1274 if samsung_env_len is None:1304 if samsung_env_len is None:
@@ -1279,6 +1309,16 @@
1279 raise HwpackConfigError(1309 raise HwpackConfigError(
1280 "Invalid samsung_env_len %s" % (samsung_env_len))1310 "Invalid samsung_env_len %s" % (samsung_env_len))
12811311
1312 def _validate_samsung_bl2_start(self):
1313 samsung_bl2_start = self.samsung_bl2_start
1314 if samsung_bl2_start is None:
1315 return
1316 try:
1317 assert int(samsung_bl2_start) > 0
1318 except:
1319 raise HwpackConfigError(
1320 "Invalid samsung_bl2_start %s" % (samsung_bl2_start))
1321
1282 def _validate_samsung_bl2_len(self):1322 def _validate_samsung_bl2_len(self):
1283 samsung_bl2_len = self.samsung_bl2_len1323 samsung_bl2_len = self.samsung_bl2_len
1284 if samsung_bl2_len is None:1324 if samsung_bl2_len is None:
12851325
=== 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 10:41:19 +0000
@@ -64,7 +64,9 @@
64 SAMSUNG_BL1_LEN_FIELD,64 SAMSUNG_BL1_LEN_FIELD,
65 SAMSUNG_BL1_START_FIELD,65 SAMSUNG_BL1_START_FIELD,
66 SAMSUNG_BL2_LEN_FIELD,66 SAMSUNG_BL2_LEN_FIELD,
67 SAMSUNG_BL2_START_FIELD,
67 SAMSUNG_ENV_LEN_FIELD,68 SAMSUNG_ENV_LEN_FIELD,
69 SAMSUNG_ENV_START_FIELD,
68 SERIAL_TTY_FIELD,70 SERIAL_TTY_FIELD,
69 SNOWBALL_STARTUP_FILES_CONFIG_FIELD,71 SNOWBALL_STARTUP_FILES_CONFIG_FIELD,
70 SUPPORT_FIELD,72 SUPPORT_FIELD,
@@ -129,7 +131,8 @@
129 extra_serial_opts=None, loader_start=None,131 extra_serial_opts=None, loader_start=None,
130 snowball_startup_files_config=None,132 snowball_startup_files_config=None,
131 samsung_bl1_start=None, samsung_bl1_len=None,133 samsung_bl1_start=None, samsung_bl1_len=None,
132 samsung_env_len=None, samsung_bl2_len=None):134 samsung_env_start=None, samsung_env_len=None,
135 samsung_bl2_start=None, samsung_bl2_len=None):
133 """Add fields that are specific to the new format.136 """Add fields that are specific to the new format.
134137
135 These fields are not present in earlier config files.138 These fields are not present in earlier config files.
@@ -163,7 +166,9 @@
163 self.snowball_startup_files_config = snowball_startup_files_config166 self.snowball_startup_files_config = snowball_startup_files_config
164 self.samsung_bl1_start = samsung_bl1_start167 self.samsung_bl1_start = samsung_bl1_start
165 self.samsung_bl1_len = samsung_bl1_len168 self.samsung_bl1_len = samsung_bl1_len
169 self.samsung_env_start = samsung_env_start
166 self.samsung_env_len = samsung_env_len170 self.samsung_env_len = samsung_env_len
171 self.samsung_bl2_start = samsung_bl2_start
167 self.samsung_bl2_len = samsung_bl2_len172 self.samsung_bl2_len = samsung_bl2_len
168173
169 @classmethod174 @classmethod
@@ -224,7 +229,9 @@
224 samsung_bl1_len=config.samsung_bl1_len,229 samsung_bl1_len=config.samsung_bl1_len,
225 samsung_bl1_start=config.samsung_bl1_start,230 samsung_bl1_start=config.samsung_bl1_start,
226 samsung_bl2_len=config.samsung_bl2_len,231 samsung_bl2_len=config.samsung_bl2_len,
232 samsung_bl2_start=config.samsung_bl2_start,
227 samsung_env_len=config.samsung_env_len,233 samsung_env_len=config.samsung_env_len,
234 samsung_env_start=config.samsung_env_start,
228 serial_tty=config.serial_tty,235 serial_tty=config.serial_tty,
229 snowball_startup_files_config=snowball_startup_config,236 snowball_startup_files_config=snowball_startup_config,
230 spl_dd=config.spl_dd,237 spl_dd=config.spl_dd,
@@ -329,8 +336,12 @@
329 metadata += dump({SAMSUNG_BL1_START_FIELD: self.samsung_bl1_start})336 metadata += dump({SAMSUNG_BL1_START_FIELD: self.samsung_bl1_start})
330 if self.samsung_bl1_len is not None:337 if self.samsung_bl1_len is not None:
331 metadata += dump({SAMSUNG_BL1_LEN_FIELD: self.samsung_bl1_len})338 metadata += dump({SAMSUNG_BL1_LEN_FIELD: self.samsung_bl1_len})
339 if self.samsung_env_start is not None:
340 metadata += dump({SAMSUNG_ENV_START_FIELD: self.samsung_env_start})
332 if self.samsung_env_len is not None:341 if self.samsung_env_len is not None:
333 metadata += dump({SAMSUNG_ENV_LEN_FIELD: self.samsung_env_len})342 metadata += dump({SAMSUNG_ENV_LEN_FIELD: self.samsung_env_len})
343 if self.samsung_bl2_start is not None:
344 metadata += dump({SAMSUNG_BL2_START_FIELD: self.samsung_bl2_start})
334 if self.samsung_bl2_len is not None:345 if self.samsung_bl2_len is not None:
335 metadata += dump({SAMSUNG_BL2_LEN_FIELD: self.samsung_bl2_len})346 metadata += dump({SAMSUNG_BL2_LEN_FIELD: self.samsung_bl2_len})
336 return metadata347 return metadata
@@ -415,8 +426,12 @@
415 metadata += "SAMSUNG_BL1_START=%s\n" % self.samsung_bl1_start426 metadata += "SAMSUNG_BL1_START=%s\n" % self.samsung_bl1_start
416 if self.samsung_bl1_len is not None:427 if self.samsung_bl1_len is not None:
417 metadata += "SAMSUNG_BL1_LEN=%s\n" % self.samsung_bl1_len428 metadata += "SAMSUNG_BL1_LEN=%s\n" % self.samsung_bl1_len
429 if self.samsung_env_start is not None:
430 metadata += "SAMSUNG_ENV_START=%s\n" % self.samsung_env_start
418 if self.samsung_env_len is not None:431 if self.samsung_env_len is not None:
419 metadata += "SAMSUNG_ENV_LEN=%s\n" % self.samsung_env_len432 metadata += "SAMSUNG_ENV_LEN=%s\n" % self.samsung_env_len
433 if self.samsung_bl2_start is not None:
434 metadata += "SAMSUNG_BL2_START=%s\n" % self.samsung_bl2_start
420 if self.samsung_bl2_len is not None:435 if self.samsung_bl2_len is not None:
421 metadata += "SAMSUNG_BL2_LEN=%s\n" % self.samsung_bl2_len436 metadata += "SAMSUNG_BL2_LEN=%s\n" % self.samsung_bl2_len
422 return metadata437 return metadata
423438
=== modified file 'linaro_image_tools/hwpack/hwpack_fields.py'
--- linaro_image_tools/hwpack/hwpack_fields.py 2012-10-02 14:53:56 +0000
+++ linaro_image_tools/hwpack/hwpack_fields.py 2012-12-07 10:41:19 +0000
@@ -76,7 +76,9 @@
76SAMSUNG_BL1_LEN_FIELD = 'samsung_bl1_len'76SAMSUNG_BL1_LEN_FIELD = 'samsung_bl1_len'
77SAMSUNG_BL1_START_FIELD = 'samsung_bl1_start'77SAMSUNG_BL1_START_FIELD = 'samsung_bl1_start'
78SAMSUNG_BL2_LEN_FIELD = 'samsung_bl2_len'78SAMSUNG_BL2_LEN_FIELD = 'samsung_bl2_len'
79SAMSUNG_BL2_START_FIELD = 'samsung_bl2_start'
79SAMSUNG_ENV_LEN_FIELD = 'samsung_env_len'80SAMSUNG_ENV_LEN_FIELD = 'samsung_env_len'
81SAMSUNG_ENV_START_FIELD = 'samsung_env_start'
8082
81# Snowball fields83# Snowball fields
82SNOWBALL_STARTUP_FILES_CONFIG_FIELD = 'snowball_startup_files_config'84SNOWBALL_STARTUP_FILES_CONFIG_FIELD = 'snowball_startup_files_config'
@@ -137,7 +139,9 @@
137 SAMSUNG_BL1_LEN_FIELD: None,139 SAMSUNG_BL1_LEN_FIELD: None,
138 SAMSUNG_BL1_START_FIELD: None,140 SAMSUNG_BL1_START_FIELD: None,
139 SAMSUNG_ENV_LEN_FIELD: None,141 SAMSUNG_ENV_LEN_FIELD: None,
142 SAMSUNG_ENV_START_FIELD: None,
140 SAMSUNG_BL2_LEN_FIELD: None,143 SAMSUNG_BL2_LEN_FIELD: None,
144 SAMSUNG_BL2_START_FIELD: None,
141 SNOWBALL_STARTUP_FILES_CONFIG_FIELD: None,145 SNOWBALL_STARTUP_FILES_CONFIG_FIELD: None,
142 SOURCES_FIELD: None,146 SOURCES_FIELD: None,
143 BOOTLOADERS_FIELD: {147 BOOTLOADERS_FIELD: {
144148
=== 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 10:41:19 +0000
@@ -29,7 +29,9 @@
29 SAMSUNG_BL1_LEN_FIELD,29 SAMSUNG_BL1_LEN_FIELD,
30 SAMSUNG_BL1_START_FIELD,30 SAMSUNG_BL1_START_FIELD,
31 SAMSUNG_BL2_LEN_FIELD,31 SAMSUNG_BL2_LEN_FIELD,
32 SAMSUNG_BL2_START_FIELD,
32 SAMSUNG_ENV_LEN_FIELD,33 SAMSUNG_ENV_LEN_FIELD,
34 SAMSUNG_ENV_START_FIELD,
33)35)
3436
3537
@@ -816,11 +818,21 @@
816 SAMSUNG_BL2_LEN_FIELD + ': 1\n')818 SAMSUNG_BL2_LEN_FIELD + ': 1\n')
817 self.assertEqual(None, config._validate_keys())819 self.assertEqual(None, config._validate_keys())
818820
821 def test_valid_samsung_bl2_start_field(self):
822 config = self.get_config(self.valid_start_v3 +
823 SAMSUNG_BL2_START_FIELD + ': 1\n')
824 self.assertEqual(None, config._validate_keys())
825
819 def test_valid_samsung_env_len_field(self):826 def test_valid_samsung_env_len_field(self):
820 config = self.get_config(self.valid_start_v3 +827 config = self.get_config(self.valid_start_v3 +
821 SAMSUNG_ENV_LEN_FIELD + ': 1\n')828 SAMSUNG_ENV_LEN_FIELD + ': 1\n')
822 self.assertEqual(None, config._validate_keys())829 self.assertEqual(None, config._validate_keys())
823830
831 def test_valid_samsung_env_start_field(self):
832 config = self.get_config(self.valid_start_v3 +
833 SAMSUNG_ENV_START_FIELD + ': 1\n')
834 self.assertEqual(None, config._validate_keys())
835
824 def test_samsung_field_wrong(self):836 def test_samsung_field_wrong(self):
825 config = self.get_config(self.valid_start_v3 +837 config = self.get_config(self.valid_start_v3 +
826 'samsung_wrong_field: 1\n')838 'samsung_wrong_field: 1\n')
827839
=== 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-07 10:41:19 +0000
@@ -323,8 +323,8 @@
323 @classmethod323 @classmethod
324 def get_sfdisk_cmd(cls, should_align_boot_part=False):324 def get_sfdisk_cmd(cls, should_align_boot_part=False):
325 loaders_min_len = (325 loaders_min_len = (
326 cls.SAMSUNG_V310_BL2_START + cls.SAMSUNG_V310_BL2_LEN -326 cls.samsung_bl1_start + cls.samsung_bl1_len + cls.samsung_bl2_len +
327 cls.SAMSUNG_V310_BL1_START)327 cls.samsung_env_len)
328328
329 loader_start, loader_end, loader_len = align_partition(329 loader_start, loader_end, loader_len = align_partition(
330 1, loaders_min_len, 1, PART_ALIGN_S)330 1, loaders_min_len, 1, PART_ALIGN_S)
331331
=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py 2012-10-22 06:57:20 +0000
+++ linaro_image_tools/media_create/boards.py 2012-12-07 10:41:19 +0000
@@ -425,37 +425,26 @@
425 # Support for dtb_files as per hwpack v3 format.425 # Support for dtb_files as per hwpack v3 format.
426 dtb_files = None426 dtb_files = None
427427
428 # Samsung v310 implementation notes and terminology428 # Samsung Boot-loader implementation notes and terminology
429 #429 #
430 # * BL0, BL1 etc. are the various bootloaders in order of execution430 # * BL0, BL1 etc. are the various bootloaders in order of execution
431 # * BL0 is the first stage bootloader, located in ROM; it loads a 32s431 # * BL0 is the first stage bootloader, located in ROM; it loads BL1/SPL
432 # long BL1 from MMC offset +1s and runs it432 # from MMC offset +1s and runs it.
433 # * BL1 is the secondary program loader (SPL), a small (< 14k) version433 # * BL1 is the secondary program loader (SPL), a small version
434 # of U-Boot with a checksum; it inits DRAM and loads a 1024s long BL2434 # of U-Boot with a checksum; it inits DRAM and loads a 1024s long BL2
435 # to DRAM from MMC offset +65s435 # from MMC and runs it.
436 # * BL2 is U-Boot; it loads its 32s (16 KiB) long environment from MMC436 # * BL2 is the U-Boot.
437 # offset +33s which tells it to load a boot.scr from the first FAT437 #
438 # partition of the MMC438 # samsung_bl1_{start,len}: Offset and maximum size for BL1
439 #439 # samsung_bl2_{start,len}: Offset and maximum size for BL2
440 # Layout:440 # samsung_env_{start,len}: Offset and maximum size for Environment settings
441 # +0s: part table / MBR, 1s long441 #
442 # +1s: BL1/SPL, 32s long442 samsung_bl1_start = 1
443 # +33s: U-Boot environment, 32s long443 samsung_bl1_len = 32
444 # +65s: U-Boot, 1024s long444 samsung_bl2_start = 65
445 # >= +1089s: FAT partition with boot script (boot.scr), kernel (uImage)445 samsung_bl2_len = 1024
446 # and initrd (uInitrd)446 samsung_env_start = 33
447 SAMSUNG_V310_BL1_START = 1447 samsung_env_len = 32
448 SAMSUNG_V310_BL1_LEN = 32
449 SAMSUNG_V310_ENV_START = SAMSUNG_V310_BL1_START + SAMSUNG_V310_BL1_LEN
450 SAMSUNG_V310_ENV_LEN = 32
451 assert SAMSUNG_V310_ENV_START == 33, (
452 "BL1 expects u-boot environment at +33s")
453 assert SAMSUNG_V310_ENV_LEN * SECTOR_SIZE == 16 * 1024, (
454 "BL1 expects u-boot environment to be 16 KiB")
455 SAMSUNG_V310_BL2_START = SAMSUNG_V310_ENV_START + SAMSUNG_V310_ENV_LEN
456 SAMSUNG_V310_BL2_LEN = 1024
457 assert SAMSUNG_V310_BL2_LEN * SECTOR_SIZE == 512 * 1024, (
458 "BL1 expects BL2 (u-boot) to be 512 KiB")
459448
460 hardwarepack_handler = None449 hardwarepack_handler = None
461450
@@ -493,12 +482,12 @@
493 cls.kernel_flavors = None482 cls.kernel_flavors = None
494 cls.mmc_option = None483 cls.mmc_option = None
495 cls.mmc_part_offset = None484 cls.mmc_part_offset = None
496 cls.SAMSUNG_V310_BL1_START = None485 cls.samsung_bl1_start = None
497 cls.SAMSUNG_V310_BL1_LEN = None486 cls.samsung_bl1_len = None
498 cls.SAMSUNG_V310_ENV_START = None487 cls.samsung_env_len = None
499 cls.SAMSUNG_V310_ENV_LEN = None488 cls.samsung_bl2_len = None
500 cls.SAMSUNG_V310_BL2_START = None489 # cls.samsung_bl2_start and cls.samsung_env_start should
501 cls.SAMSUNG_V310_BL2_LEN = None490 # be initialized to default value for backward compatibility.
502491
503 # Set new values from metadata.492 # Set new values from metadata.
504 cls.kernel_addr = cls.get_metadata_field('kernel_addr')493 cls.kernel_addr = cls.get_metadata_field('kernel_addr')
@@ -594,31 +583,30 @@
594 loader_start = cls.get_metadata_field('loader_start')583 loader_start = cls.get_metadata_field('loader_start')
595 if loader_start is not None:584 if loader_start is not None:
596 cls.LOADER_START_S = int(loader_start)585 cls.LOADER_START_S = int(loader_start)
586
597 samsung_bl1_start = cls.get_metadata_field('samsung_bl1_start')587 samsung_bl1_start = cls.get_metadata_field('samsung_bl1_start')
598 if samsung_bl1_start is not None:588 if samsung_bl1_start is not None:
599 cls.SAMSUNG_V310_BL1_START = int(samsung_bl1_start)589 cls.samsung_bl1_start = int(samsung_bl1_start)
590
600 samsung_bl1_len = cls.get_metadata_field('samsung_bl1_len')591 samsung_bl1_len = cls.get_metadata_field('samsung_bl1_len')
601 if samsung_bl1_len is not None:592 if samsung_bl1_len is not None:
602 cls.SAMSUNG_V310_BL1_LEN = int(samsung_bl1_len)593 cls.samsung_bl1_len = int(samsung_bl1_len)
594
595 samsung_bl2_len = cls.get_metadata_field('samsung_bl2_len')
596 if samsung_bl2_len is not None:
597 cls.samsung_bl2_len = int(samsung_bl2_len)
598
599 samsung_bl2_start = cls.get_metadata_field('samsung_bl2_start')
600 if samsung_bl2_start is not None:
601 cls.samsung_bl2_start = int(samsung_bl2_start)
602
603 samsung_env_len = cls.get_metadata_field('samsung_env_len')603 samsung_env_len = cls.get_metadata_field('samsung_env_len')
604 if samsung_env_len is not None:604 if samsung_env_len is not None:
605 cls.SAMSUNG_V310_ENV_LEN = int(samsung_env_len)605 cls.samsung_env_len = int(samsung_env_len)
606 assert cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE == 16 * 1024, (
607 "BL1 expects u-boot environment to be 16 KiB")
608 samsung_bl2_len = cls.get_metadata_field('samsung_bl2_len')
609 if samsung_bl2_len is not None:
610 cls.SAMSUNG_V310_BL2_LEN = int(samsung_bl2_len)
611 assert cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE == 512 * 1024, (
612 "BL1 expects BL2 (u-boot) to be 512 KiB")
613606
614 if (cls.SAMSUNG_V310_BL1_START and cls.SAMSUNG_V310_BL1_LEN):607 samsung_env_start = cls.get_metadata_field('samsung_env_start')
615 cls.SAMSUNG_V310_ENV_START = (cls.SAMSUNG_V310_BL1_START +608 if samsung_env_start is not None:
616 cls.SAMSUNG_V310_BL1_LEN)609 cls.samsung_env_start = int(samsung_env_start)
617 assert cls.SAMSUNG_V310_ENV_START == 33, (
618 "BL1 expects u-boot environment at +33s")
619 if (cls.SAMSUNG_V310_ENV_START and cls.SAMSUNG_V310_ENV_LEN):
620 cls.SAMSUNG_V310_BL2_START = (cls.SAMSUNG_V310_ENV_START +
621 cls.SAMSUNG_V310_ENV_LEN)
622610
623 cls.bootloader_copy_files = cls.hardwarepack_handler.get_field(611 cls.bootloader_copy_files = cls.hardwarepack_handler.get_field(
624 "bootloader_copy_files")[0]612 "bootloader_copy_files")[0]
@@ -922,11 +910,11 @@
922 def install_samsung_boot_loader(cls, samsung_spl_file, bootloader_file,910 def install_samsung_boot_loader(cls, samsung_spl_file, bootloader_file,
923 boot_device_or_file):911 boot_device_or_file):
924 cls._dd_file(samsung_spl_file, boot_device_or_file,912 cls._dd_file(samsung_spl_file, boot_device_or_file,
925 cls.SAMSUNG_V310_BL1_START,913 cls.samsung_bl1_start,
926 cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE)914 cls.samsung_bl1_len * SECTOR_SIZE)
927 cls._dd_file(bootloader_file, boot_device_or_file,915 cls._dd_file(bootloader_file, boot_device_or_file,
928 cls.SAMSUNG_V310_BL2_START,916 cls.samsung_bl2_start,
929 cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE)917 cls.samsung_bl2_len * SECTOR_SIZE)
930918
931 @classmethod919 @classmethod
932 def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,920 def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,
@@ -974,12 +962,12 @@
974 if cls.env_dd:962 if cls.env_dd:
975 # Do we need to zero out the env before flashing it?963 # Do we need to zero out the env before flashing it?
976 _dd("/dev/zero", boot_device_or_file,964 _dd("/dev/zero", boot_device_or_file,
977 count=cls.SAMSUNG_V310_ENV_LEN,965 count=cls.samsung_env_len,
978 seek=cls.SAMSUNG_V310_ENV_START)966 seek=cls.samsung_env_start)
979 env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE967 env_size = cls.samsung_env_len * SECTOR_SIZE
980 env_file = make_flashable_env(boot_env, env_size)968 env_file = make_flashable_env(boot_env, env_size)
981 cls._dd_file(env_file, boot_device_or_file,969 cls._dd_file(env_file, boot_device_or_file,
982 cls.SAMSUNG_V310_ENV_START)970 cls.samsung_env_start)
983971
984 @classmethod972 @classmethod
985 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,973 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
@@ -1677,8 +1665,8 @@
1677 def get_v1_sfdisk_cmd(cls, should_align_boot_part=False):1665 def get_v1_sfdisk_cmd(cls, should_align_boot_part=False):
1678 # bootloaders partition needs to hold BL1, U-Boot environment, and BL21666 # bootloaders partition needs to hold BL1, U-Boot environment, and BL2
1679 loaders_min_len = (1667 loaders_min_len = (
1680 cls.SAMSUNG_V310_BL2_START + cls.SAMSUNG_V310_BL2_LEN -1668 cls.samsung_bl1_start + cls.samsung_bl1_len + cls.samsung_bl2_len +
1681 cls.SAMSUNG_V310_BL1_START)1669 cls.samsung_env_len)
16821670
1683 # bootloaders partition1671 # bootloaders partition
1684 loaders_start, loaders_end, loaders_len = align_partition(1672 loaders_start, loaders_end, loaders_len = align_partition(
@@ -1706,9 +1694,9 @@
1706 assert cls.hwpack_format == HardwarepackHandler.FORMAT_11694 assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
1707 cls.install_samsung_boot_loader(cls._get_samsung_spl(chroot_dir),1695 cls.install_samsung_boot_loader(cls._get_samsung_spl(chroot_dir),
1708 cls._get_samsung_bootloader(chroot_dir), boot_device_or_file)1696 cls._get_samsung_bootloader(chroot_dir), boot_device_or_file)
1709 env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE1697 env_size = cls.samsung_env_len * SECTOR_SIZE
1710 env_file = make_flashable_env(boot_env, env_size)1698 env_file = make_flashable_env(boot_env, env_size)
1711 _dd(env_file, boot_device_or_file, seek=cls.SAMSUNG_V310_ENV_START)1699 _dd(env_file, boot_device_or_file, seek=cls.samsung_env_start)
17121700
1713 make_uImage(cls.load_addr, k_img_data, boot_dir)1701 make_uImage(cls.load_addr, k_img_data, boot_dir)
1714 make_uInitrd(i_img_data, boot_dir)1702 make_uInitrd(i_img_data, boot_dir)
@@ -1755,19 +1743,19 @@
1755 @classmethod1743 @classmethod
1756 def populate_raw_partition(cls, boot_device_or_file, chroot_dir):1744 def populate_raw_partition(cls, boot_device_or_file, chroot_dir):
1757 # Zero the env so that the boot_script will get loaded1745 # Zero the env so that the boot_script will get loaded
1758 _dd("/dev/zero", boot_device_or_file, count=cls.SAMSUNG_V310_ENV_LEN,1746 _dd("/dev/zero", boot_device_or_file, count=cls.samsung_env_len,
1759 seek=cls.SAMSUNG_V310_ENV_START)1747 seek=cls.samsung_env_start)
1760 # Populate created raw partition with BL1 and u-boot1748 # Populate created raw partition with BL1 and u-boot
1761 spl_file = os.path.join(chroot_dir, 'boot', 'u-boot-mmc-spl.bin')1749 spl_file = os.path.join(chroot_dir, 'boot', 'u-boot-mmc-spl.bin')
1762 assert os.path.getsize(spl_file) <= (1750 assert os.path.getsize(spl_file) <= (
1763 cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE), (1751 cls.samsung_bl1_len * SECTOR_SIZE), (
1764 "%s is larger than SAMSUNG_V310_BL1_LEN" % spl_file)1752 "%s is larger than Samsung BL1 size" % spl_file)
1765 _dd(spl_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL1_START)1753 _dd(spl_file, boot_device_or_file, seek=cls.samsung_bl1_start)
1766 uboot_file = os.path.join(chroot_dir, 'boot', 'u-boot.bin')1754 uboot_file = os.path.join(chroot_dir, 'boot', 'u-boot.bin')
1767 assert os.path.getsize(uboot_file) <= (1755 assert os.path.getsize(uboot_file) <= (
1768 cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE), (1756 cls.samsung_bl2_len * SECTOR_SIZE), (
1769 "%s is larger than SAMSUNG_V310_BL2_LEN" % uboot_file)1757 "%s is larger than Samsung BL2 size" % uboot_file)
1770 _dd(uboot_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL2_START)1758 _dd(uboot_file, boot_device_or_file, seek=cls.samsung_bl2_start)
17711759
17721760
1773class SMDKV310Config(SamsungConfig):1761class SMDKV310Config(SamsungConfig):
17741762
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py 2012-10-17 08:59:25 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py 2012-12-07 10:41:19 +0000
@@ -1664,9 +1664,10 @@
1664 def test_smdkv310(self):1664 def test_smdkv310(self):
1665 class config(board_configs['smdkv310']):1665 class config(board_configs['smdkv310']):
1666 partition_layout = 'reserved_bootfs_rootfs'1666 partition_layout = 'reserved_bootfs_rootfs'
1667 LOADER_MIN_SIZE_S = (boards.BoardConfig.SAMSUNG_V310_BL2_START +1667 LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start +
1668 boards.BoardConfig.SAMSUNG_V310_BL2_LEN -1668 boards.BoardConfig.samsung_bl1_len +
1669 boards.BoardConfig.SAMSUNG_V310_BL1_START)1669 boards.BoardConfig.samsung_bl2_len +
1670 boards.BoardConfig.samsung_env_len)
1670 self.assertEquals(1671 self.assertEquals(
1671 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',1672 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
1672 config.get_sfdisk_cmd())1673 config.get_sfdisk_cmd())
@@ -1674,9 +1675,10 @@
1674 def test_origen(self):1675 def test_origen(self):
1675 class config(board_configs['origen']):1676 class config(board_configs['origen']):
1676 partition_layout = 'reserved_bootfs_rootfs'1677 partition_layout = 'reserved_bootfs_rootfs'
1677 LOADER_MIN_SIZE_S = (boards.BoardConfig.SAMSUNG_V310_BL2_START +1678 LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start +
1678 boards.BoardConfig.SAMSUNG_V310_BL2_LEN -1679 boards.BoardConfig.samsung_bl1_len +
1679 boards.BoardConfig.SAMSUNG_V310_BL1_START)1680 boards.BoardConfig.samsung_bl2_len +
1681 boards.BoardConfig.samsung_env_len)
1680 self.assertEquals(1682 self.assertEquals(
1681 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',1683 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
1682 config.get_sfdisk_cmd())1684 config.get_sfdisk_cmd())
@@ -2212,10 +2214,10 @@
2212 expected = [2214 expected = [
2213 '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc '2215 '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc '
2214 'seek=%d' % (sudo_args, bootloader_flavor,2216 'seek=%d' % (sudo_args, bootloader_flavor,
2215 boards.SMDKV310Config.SAMSUNG_V310_BL1_START),2217 boards.SMDKV310Config.samsung_bl1_start),
2216 '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc '2218 '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc '
2217 'seek=%d' % (sudo_args, bootloader_flavor,2219 'seek=%d' % (sudo_args, bootloader_flavor,
2218 boards.SMDKV310Config.SAMSUNG_V310_BL2_START)]2220 boards.SMDKV310Config.samsung_bl2_start)]
2219 self.assertEqual(expected, fixture.mock.commands_executed)2221 self.assertEqual(expected, fixture.mock.commands_executed)
22202222
2221 def test_install_origen_u_boot(self):2223 def test_install_origen_u_boot(self):
@@ -2242,10 +2244,10 @@
2242 expected = [2244 expected = [
2243 '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc '2245 '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc '
2244 'seek=%d' % (sudo_args, bootloader_flavor,2246 'seek=%d' % (sudo_args, bootloader_flavor,
2245 boards.OrigenConfig.SAMSUNG_V310_BL1_START),2247 boards.OrigenConfig.samsung_bl1_start),
2246 '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc '2248 '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc '
2247 'seek=%d' % (sudo_args, bootloader_flavor,2249 'seek=%d' % (sudo_args, bootloader_flavor,
2248 boards.OrigenConfig.SAMSUNG_V310_BL2_START)]2250 boards.OrigenConfig.samsung_bl2_start)]
2249 self.assertEqual(expected, fixture.mock.commands_executed)2251 self.assertEqual(expected, fixture.mock.commands_executed)
22502252
2251 def test_get_plain_boot_script_contents(self):2253 def test_get_plain_boot_script_contents(self):

Subscribers

People subscribed via source and target branches