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
1=== modified file 'linaro_image_tools/hwpack/config.py'
2--- linaro_image_tools/hwpack/config.py 2012-10-02 15:25:27 +0000
3+++ linaro_image_tools/hwpack/config.py 2012-12-07 10:41:19 +0000
4@@ -71,7 +71,9 @@
5 SAMSUNG_BL1_LEN_FIELD,
6 SAMSUNG_BL1_START_FIELD,
7 SAMSUNG_BL2_LEN_FIELD,
8+ SAMSUNG_BL2_START_FIELD,
9 SAMSUNG_ENV_LEN_FIELD,
10+ SAMSUNG_ENV_START_FIELD,
11 SERIAL_TTY_FIELD,
12 SNOWBALL_STARTUP_FILES_CONFIG_FIELD,
13 SOURCES_FIELD,
14@@ -298,7 +300,9 @@
15 self._validate_snowball_startup_files_config()
16 self._validate_samsung_bl1_start()
17 self._validate_samsung_bl1_len()
18+ self._validate_samsung_env_start()
19 self._validate_samsung_env_len()
20+ self._validate_samsung_bl2_start()
21 self._validate_samsung_bl2_len()
22
23 self._validate_sources()
24@@ -867,6 +871,14 @@
25 return self._get_option(SAMSUNG_BL1_LEN_FIELD)
26
27 @property
28+ def samsung_env_start(self):
29+ """Env start offset for Samsung boards.
30+
31+ A str.
32+ """
33+ return self._get_option(SAMSUNG_ENV_START_FIELD)
34+
35+ @property
36 def samsung_env_len(self):
37 """Env length for Samsung boards.
38
39@@ -875,6 +887,14 @@
40 return self._get_option(SAMSUNG_ENV_LEN_FIELD)
41
42 @property
43+ def samsung_bl2_start(self):
44+ """BL2 start offset for Samsung boards.
45+
46+ A str.
47+ """
48+ return self._get_option(SAMSUNG_BL2_START_FIELD)
49+
50+ @property
51 def samsung_bl2_len(self):
52 """BL2 length for Samsung boards.
53
54@@ -1269,6 +1289,16 @@
55 raise HwpackConfigError(
56 "Invalid samsung_bl1_len %s" % (samsung_bl1_len))
57
58+ def _validate_samsung_env_start(self):
59+ samsung_env_start = self.samsung_env_start
60+ if samsung_env_start is None:
61+ return
62+ try:
63+ assert int(samsung_env_start) > 0
64+ except:
65+ raise HwpackConfigError(
66+ "Invalid samsung_env_start %s" % (samsung_env_start))
67+
68 def _validate_samsung_env_len(self):
69 samsung_env_len = self.samsung_env_len
70 if samsung_env_len is None:
71@@ -1279,6 +1309,16 @@
72 raise HwpackConfigError(
73 "Invalid samsung_env_len %s" % (samsung_env_len))
74
75+ def _validate_samsung_bl2_start(self):
76+ samsung_bl2_start = self.samsung_bl2_start
77+ if samsung_bl2_start is None:
78+ return
79+ try:
80+ assert int(samsung_bl2_start) > 0
81+ except:
82+ raise HwpackConfigError(
83+ "Invalid samsung_bl2_start %s" % (samsung_bl2_start))
84+
85 def _validate_samsung_bl2_len(self):
86 samsung_bl2_len = self.samsung_bl2_len
87 if samsung_bl2_len is None:
88
89=== modified file 'linaro_image_tools/hwpack/hardwarepack.py'
90--- linaro_image_tools/hwpack/hardwarepack.py 2012-09-25 16:24:32 +0000
91+++ linaro_image_tools/hwpack/hardwarepack.py 2012-12-07 10:41:19 +0000
92@@ -64,7 +64,9 @@
93 SAMSUNG_BL1_LEN_FIELD,
94 SAMSUNG_BL1_START_FIELD,
95 SAMSUNG_BL2_LEN_FIELD,
96+ SAMSUNG_BL2_START_FIELD,
97 SAMSUNG_ENV_LEN_FIELD,
98+ SAMSUNG_ENV_START_FIELD,
99 SERIAL_TTY_FIELD,
100 SNOWBALL_STARTUP_FILES_CONFIG_FIELD,
101 SUPPORT_FIELD,
102@@ -129,7 +131,8 @@
103 extra_serial_opts=None, loader_start=None,
104 snowball_startup_files_config=None,
105 samsung_bl1_start=None, samsung_bl1_len=None,
106- samsung_env_len=None, samsung_bl2_len=None):
107+ samsung_env_start=None, samsung_env_len=None,
108+ samsung_bl2_start=None, samsung_bl2_len=None):
109 """Add fields that are specific to the new format.
110
111 These fields are not present in earlier config files.
112@@ -163,7 +166,9 @@
113 self.snowball_startup_files_config = snowball_startup_files_config
114 self.samsung_bl1_start = samsung_bl1_start
115 self.samsung_bl1_len = samsung_bl1_len
116+ self.samsung_env_start = samsung_env_start
117 self.samsung_env_len = samsung_env_len
118+ self.samsung_bl2_start = samsung_bl2_start
119 self.samsung_bl2_len = samsung_bl2_len
120
121 @classmethod
122@@ -224,7 +229,9 @@
123 samsung_bl1_len=config.samsung_bl1_len,
124 samsung_bl1_start=config.samsung_bl1_start,
125 samsung_bl2_len=config.samsung_bl2_len,
126+ samsung_bl2_start=config.samsung_bl2_start,
127 samsung_env_len=config.samsung_env_len,
128+ samsung_env_start=config.samsung_env_start,
129 serial_tty=config.serial_tty,
130 snowball_startup_files_config=snowball_startup_config,
131 spl_dd=config.spl_dd,
132@@ -329,8 +336,12 @@
133 metadata += dump({SAMSUNG_BL1_START_FIELD: self.samsung_bl1_start})
134 if self.samsung_bl1_len is not None:
135 metadata += dump({SAMSUNG_BL1_LEN_FIELD: self.samsung_bl1_len})
136+ if self.samsung_env_start is not None:
137+ metadata += dump({SAMSUNG_ENV_START_FIELD: self.samsung_env_start})
138 if self.samsung_env_len is not None:
139 metadata += dump({SAMSUNG_ENV_LEN_FIELD: self.samsung_env_len})
140+ if self.samsung_bl2_start is not None:
141+ metadata += dump({SAMSUNG_BL2_START_FIELD: self.samsung_bl2_start})
142 if self.samsung_bl2_len is not None:
143 metadata += dump({SAMSUNG_BL2_LEN_FIELD: self.samsung_bl2_len})
144 return metadata
145@@ -415,8 +426,12 @@
146 metadata += "SAMSUNG_BL1_START=%s\n" % self.samsung_bl1_start
147 if self.samsung_bl1_len is not None:
148 metadata += "SAMSUNG_BL1_LEN=%s\n" % self.samsung_bl1_len
149+ if self.samsung_env_start is not None:
150+ metadata += "SAMSUNG_ENV_START=%s\n" % self.samsung_env_start
151 if self.samsung_env_len is not None:
152 metadata += "SAMSUNG_ENV_LEN=%s\n" % self.samsung_env_len
153+ if self.samsung_bl2_start is not None:
154+ metadata += "SAMSUNG_BL2_START=%s\n" % self.samsung_bl2_start
155 if self.samsung_bl2_len is not None:
156 metadata += "SAMSUNG_BL2_LEN=%s\n" % self.samsung_bl2_len
157 return metadata
158
159=== modified file 'linaro_image_tools/hwpack/hwpack_fields.py'
160--- linaro_image_tools/hwpack/hwpack_fields.py 2012-10-02 14:53:56 +0000
161+++ linaro_image_tools/hwpack/hwpack_fields.py 2012-12-07 10:41:19 +0000
162@@ -76,7 +76,9 @@
163 SAMSUNG_BL1_LEN_FIELD = 'samsung_bl1_len'
164 SAMSUNG_BL1_START_FIELD = 'samsung_bl1_start'
165 SAMSUNG_BL2_LEN_FIELD = 'samsung_bl2_len'
166+SAMSUNG_BL2_START_FIELD = 'samsung_bl2_start'
167 SAMSUNG_ENV_LEN_FIELD = 'samsung_env_len'
168+SAMSUNG_ENV_START_FIELD = 'samsung_env_start'
169
170 # Snowball fields
171 SNOWBALL_STARTUP_FILES_CONFIG_FIELD = 'snowball_startup_files_config'
172@@ -137,7 +139,9 @@
173 SAMSUNG_BL1_LEN_FIELD: None,
174 SAMSUNG_BL1_START_FIELD: None,
175 SAMSUNG_ENV_LEN_FIELD: None,
176+ SAMSUNG_ENV_START_FIELD: None,
177 SAMSUNG_BL2_LEN_FIELD: None,
178+ SAMSUNG_BL2_START_FIELD: None,
179 SNOWBALL_STARTUP_FILES_CONFIG_FIELD: None,
180 SOURCES_FIELD: None,
181 BOOTLOADERS_FIELD: {
182
183=== modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py'
184--- linaro_image_tools/hwpack/tests/test_config_v3.py 2012-10-01 09:26:10 +0000
185+++ linaro_image_tools/hwpack/tests/test_config_v3.py 2012-12-07 10:41:19 +0000
186@@ -29,7 +29,9 @@
187 SAMSUNG_BL1_LEN_FIELD,
188 SAMSUNG_BL1_START_FIELD,
189 SAMSUNG_BL2_LEN_FIELD,
190+ SAMSUNG_BL2_START_FIELD,
191 SAMSUNG_ENV_LEN_FIELD,
192+ SAMSUNG_ENV_START_FIELD,
193 )
194
195
196@@ -816,11 +818,21 @@
197 SAMSUNG_BL2_LEN_FIELD + ': 1\n')
198 self.assertEqual(None, config._validate_keys())
199
200+ def test_valid_samsung_bl2_start_field(self):
201+ config = self.get_config(self.valid_start_v3 +
202+ SAMSUNG_BL2_START_FIELD + ': 1\n')
203+ self.assertEqual(None, config._validate_keys())
204+
205 def test_valid_samsung_env_len_field(self):
206 config = self.get_config(self.valid_start_v3 +
207 SAMSUNG_ENV_LEN_FIELD + ': 1\n')
208 self.assertEqual(None, config._validate_keys())
209
210+ def test_valid_samsung_env_start_field(self):
211+ config = self.get_config(self.valid_start_v3 +
212+ SAMSUNG_ENV_START_FIELD + ': 1\n')
213+ self.assertEqual(None, config._validate_keys())
214+
215 def test_samsung_field_wrong(self):
216 config = self.get_config(self.valid_start_v3 +
217 'samsung_wrong_field: 1\n')
218
219=== modified file 'linaro_image_tools/media_create/android_boards.py'
220--- linaro_image_tools/media_create/android_boards.py 2012-10-17 10:48:49 +0000
221+++ linaro_image_tools/media_create/android_boards.py 2012-12-07 10:41:19 +0000
222@@ -323,8 +323,8 @@
223 @classmethod
224 def get_sfdisk_cmd(cls, should_align_boot_part=False):
225 loaders_min_len = (
226- cls.SAMSUNG_V310_BL2_START + cls.SAMSUNG_V310_BL2_LEN -
227- cls.SAMSUNG_V310_BL1_START)
228+ cls.samsung_bl1_start + cls.samsung_bl1_len + cls.samsung_bl2_len +
229+ cls.samsung_env_len)
230
231 loader_start, loader_end, loader_len = align_partition(
232 1, loaders_min_len, 1, PART_ALIGN_S)
233
234=== modified file 'linaro_image_tools/media_create/boards.py'
235--- linaro_image_tools/media_create/boards.py 2012-10-22 06:57:20 +0000
236+++ linaro_image_tools/media_create/boards.py 2012-12-07 10:41:19 +0000
237@@ -425,37 +425,26 @@
238 # Support for dtb_files as per hwpack v3 format.
239 dtb_files = None
240
241- # Samsung v310 implementation notes and terminology
242+ # Samsung Boot-loader implementation notes and terminology
243 #
244 # * BL0, BL1 etc. are the various bootloaders in order of execution
245- # * BL0 is the first stage bootloader, located in ROM; it loads a 32s
246- # long BL1 from MMC offset +1s and runs it
247- # * BL1 is the secondary program loader (SPL), a small (< 14k) version
248+ # * BL0 is the first stage bootloader, located in ROM; it loads BL1/SPL
249+ # from MMC offset +1s and runs it.
250+ # * BL1 is the secondary program loader (SPL), a small version
251 # of U-Boot with a checksum; it inits DRAM and loads a 1024s long BL2
252- # to DRAM from MMC offset +65s
253- # * BL2 is U-Boot; it loads its 32s (16 KiB) long environment from MMC
254- # offset +33s which tells it to load a boot.scr from the first FAT
255- # partition of the MMC
256- #
257- # Layout:
258- # +0s: part table / MBR, 1s long
259- # +1s: BL1/SPL, 32s long
260- # +33s: U-Boot environment, 32s long
261- # +65s: U-Boot, 1024s long
262- # >= +1089s: FAT partition with boot script (boot.scr), kernel (uImage)
263- # and initrd (uInitrd)
264- SAMSUNG_V310_BL1_START = 1
265- SAMSUNG_V310_BL1_LEN = 32
266- SAMSUNG_V310_ENV_START = SAMSUNG_V310_BL1_START + SAMSUNG_V310_BL1_LEN
267- SAMSUNG_V310_ENV_LEN = 32
268- assert SAMSUNG_V310_ENV_START == 33, (
269- "BL1 expects u-boot environment at +33s")
270- assert SAMSUNG_V310_ENV_LEN * SECTOR_SIZE == 16 * 1024, (
271- "BL1 expects u-boot environment to be 16 KiB")
272- SAMSUNG_V310_BL2_START = SAMSUNG_V310_ENV_START + SAMSUNG_V310_ENV_LEN
273- SAMSUNG_V310_BL2_LEN = 1024
274- assert SAMSUNG_V310_BL2_LEN * SECTOR_SIZE == 512 * 1024, (
275- "BL1 expects BL2 (u-boot) to be 512 KiB")
276+ # from MMC and runs it.
277+ # * BL2 is the U-Boot.
278+ #
279+ # samsung_bl1_{start,len}: Offset and maximum size for BL1
280+ # samsung_bl2_{start,len}: Offset and maximum size for BL2
281+ # samsung_env_{start,len}: Offset and maximum size for Environment settings
282+ #
283+ samsung_bl1_start = 1
284+ samsung_bl1_len = 32
285+ samsung_bl2_start = 65
286+ samsung_bl2_len = 1024
287+ samsung_env_start = 33
288+ samsung_env_len = 32
289
290 hardwarepack_handler = None
291
292@@ -493,12 +482,12 @@
293 cls.kernel_flavors = None
294 cls.mmc_option = None
295 cls.mmc_part_offset = None
296- cls.SAMSUNG_V310_BL1_START = None
297- cls.SAMSUNG_V310_BL1_LEN = None
298- cls.SAMSUNG_V310_ENV_START = None
299- cls.SAMSUNG_V310_ENV_LEN = None
300- cls.SAMSUNG_V310_BL2_START = None
301- cls.SAMSUNG_V310_BL2_LEN = None
302+ cls.samsung_bl1_start = None
303+ cls.samsung_bl1_len = None
304+ cls.samsung_env_len = None
305+ cls.samsung_bl2_len = None
306+ # cls.samsung_bl2_start and cls.samsung_env_start should
307+ # be initialized to default value for backward compatibility.
308
309 # Set new values from metadata.
310 cls.kernel_addr = cls.get_metadata_field('kernel_addr')
311@@ -594,31 +583,30 @@
312 loader_start = cls.get_metadata_field('loader_start')
313 if loader_start is not None:
314 cls.LOADER_START_S = int(loader_start)
315+
316 samsung_bl1_start = cls.get_metadata_field('samsung_bl1_start')
317 if samsung_bl1_start is not None:
318- cls.SAMSUNG_V310_BL1_START = int(samsung_bl1_start)
319+ cls.samsung_bl1_start = int(samsung_bl1_start)
320+
321 samsung_bl1_len = cls.get_metadata_field('samsung_bl1_len')
322 if samsung_bl1_len is not None:
323- cls.SAMSUNG_V310_BL1_LEN = int(samsung_bl1_len)
324+ cls.samsung_bl1_len = int(samsung_bl1_len)
325+
326+ samsung_bl2_len = cls.get_metadata_field('samsung_bl2_len')
327+ if samsung_bl2_len is not None:
328+ cls.samsung_bl2_len = int(samsung_bl2_len)
329+
330+ samsung_bl2_start = cls.get_metadata_field('samsung_bl2_start')
331+ if samsung_bl2_start is not None:
332+ cls.samsung_bl2_start = int(samsung_bl2_start)
333+
334 samsung_env_len = cls.get_metadata_field('samsung_env_len')
335 if samsung_env_len is not None:
336- cls.SAMSUNG_V310_ENV_LEN = int(samsung_env_len)
337- assert cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE == 16 * 1024, (
338- "BL1 expects u-boot environment to be 16 KiB")
339- samsung_bl2_len = cls.get_metadata_field('samsung_bl2_len')
340- if samsung_bl2_len is not None:
341- cls.SAMSUNG_V310_BL2_LEN = int(samsung_bl2_len)
342- assert cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE == 512 * 1024, (
343- "BL1 expects BL2 (u-boot) to be 512 KiB")
344+ cls.samsung_env_len = int(samsung_env_len)
345
346- if (cls.SAMSUNG_V310_BL1_START and cls.SAMSUNG_V310_BL1_LEN):
347- cls.SAMSUNG_V310_ENV_START = (cls.SAMSUNG_V310_BL1_START +
348- cls.SAMSUNG_V310_BL1_LEN)
349- assert cls.SAMSUNG_V310_ENV_START == 33, (
350- "BL1 expects u-boot environment at +33s")
351- if (cls.SAMSUNG_V310_ENV_START and cls.SAMSUNG_V310_ENV_LEN):
352- cls.SAMSUNG_V310_BL2_START = (cls.SAMSUNG_V310_ENV_START +
353- cls.SAMSUNG_V310_ENV_LEN)
354+ samsung_env_start = cls.get_metadata_field('samsung_env_start')
355+ if samsung_env_start is not None:
356+ cls.samsung_env_start = int(samsung_env_start)
357
358 cls.bootloader_copy_files = cls.hardwarepack_handler.get_field(
359 "bootloader_copy_files")[0]
360@@ -922,11 +910,11 @@
361 def install_samsung_boot_loader(cls, samsung_spl_file, bootloader_file,
362 boot_device_or_file):
363 cls._dd_file(samsung_spl_file, boot_device_or_file,
364- cls.SAMSUNG_V310_BL1_START,
365- cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE)
366+ cls.samsung_bl1_start,
367+ cls.samsung_bl1_len * SECTOR_SIZE)
368 cls._dd_file(bootloader_file, boot_device_or_file,
369- cls.SAMSUNG_V310_BL2_START,
370- cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE)
371+ cls.samsung_bl2_start,
372+ cls.samsung_bl2_len * SECTOR_SIZE)
373
374 @classmethod
375 def _make_boot_files_v2(cls, boot_env, chroot_dir, boot_dir,
376@@ -974,12 +962,12 @@
377 if cls.env_dd:
378 # Do we need to zero out the env before flashing it?
379 _dd("/dev/zero", boot_device_or_file,
380- count=cls.SAMSUNG_V310_ENV_LEN,
381- seek=cls.SAMSUNG_V310_ENV_START)
382- env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE
383+ count=cls.samsung_env_len,
384+ seek=cls.samsung_env_start)
385+ env_size = cls.samsung_env_len * SECTOR_SIZE
386 env_file = make_flashable_env(boot_env, env_size)
387 cls._dd_file(env_file, boot_device_or_file,
388- cls.SAMSUNG_V310_ENV_START)
389+ cls.samsung_env_start)
390
391 @classmethod
392 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
393@@ -1677,8 +1665,8 @@
394 def get_v1_sfdisk_cmd(cls, should_align_boot_part=False):
395 # bootloaders partition needs to hold BL1, U-Boot environment, and BL2
396 loaders_min_len = (
397- cls.SAMSUNG_V310_BL2_START + cls.SAMSUNG_V310_BL2_LEN -
398- cls.SAMSUNG_V310_BL1_START)
399+ cls.samsung_bl1_start + cls.samsung_bl1_len + cls.samsung_bl2_len +
400+ cls.samsung_env_len)
401
402 # bootloaders partition
403 loaders_start, loaders_end, loaders_len = align_partition(
404@@ -1706,9 +1694,9 @@
405 assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
406 cls.install_samsung_boot_loader(cls._get_samsung_spl(chroot_dir),
407 cls._get_samsung_bootloader(chroot_dir), boot_device_or_file)
408- env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE
409+ env_size = cls.samsung_env_len * SECTOR_SIZE
410 env_file = make_flashable_env(boot_env, env_size)
411- _dd(env_file, boot_device_or_file, seek=cls.SAMSUNG_V310_ENV_START)
412+ _dd(env_file, boot_device_or_file, seek=cls.samsung_env_start)
413
414 make_uImage(cls.load_addr, k_img_data, boot_dir)
415 make_uInitrd(i_img_data, boot_dir)
416@@ -1755,19 +1743,19 @@
417 @classmethod
418 def populate_raw_partition(cls, boot_device_or_file, chroot_dir):
419 # Zero the env so that the boot_script will get loaded
420- _dd("/dev/zero", boot_device_or_file, count=cls.SAMSUNG_V310_ENV_LEN,
421- seek=cls.SAMSUNG_V310_ENV_START)
422+ _dd("/dev/zero", boot_device_or_file, count=cls.samsung_env_len,
423+ seek=cls.samsung_env_start)
424 # Populate created raw partition with BL1 and u-boot
425 spl_file = os.path.join(chroot_dir, 'boot', 'u-boot-mmc-spl.bin')
426 assert os.path.getsize(spl_file) <= (
427- cls.SAMSUNG_V310_BL1_LEN * SECTOR_SIZE), (
428- "%s is larger than SAMSUNG_V310_BL1_LEN" % spl_file)
429- _dd(spl_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL1_START)
430+ cls.samsung_bl1_len * SECTOR_SIZE), (
431+ "%s is larger than Samsung BL1 size" % spl_file)
432+ _dd(spl_file, boot_device_or_file, seek=cls.samsung_bl1_start)
433 uboot_file = os.path.join(chroot_dir, 'boot', 'u-boot.bin')
434 assert os.path.getsize(uboot_file) <= (
435- cls.SAMSUNG_V310_BL2_LEN * SECTOR_SIZE), (
436- "%s is larger than SAMSUNG_V310_BL2_LEN" % uboot_file)
437- _dd(uboot_file, boot_device_or_file, seek=cls.SAMSUNG_V310_BL2_START)
438+ cls.samsung_bl2_len * SECTOR_SIZE), (
439+ "%s is larger than Samsung BL2 size" % uboot_file)
440+ _dd(uboot_file, boot_device_or_file, seek=cls.samsung_bl2_start)
441
442
443 class SMDKV310Config(SamsungConfig):
444
445=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
446--- linaro_image_tools/media_create/tests/test_media_create.py 2012-10-17 08:59:25 +0000
447+++ linaro_image_tools/media_create/tests/test_media_create.py 2012-12-07 10:41:19 +0000
448@@ -1664,9 +1664,10 @@
449 def test_smdkv310(self):
450 class config(board_configs['smdkv310']):
451 partition_layout = 'reserved_bootfs_rootfs'
452- LOADER_MIN_SIZE_S = (boards.BoardConfig.SAMSUNG_V310_BL2_START +
453- boards.BoardConfig.SAMSUNG_V310_BL2_LEN -
454- boards.BoardConfig.SAMSUNG_V310_BL1_START)
455+ LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start +
456+ boards.BoardConfig.samsung_bl1_len +
457+ boards.BoardConfig.samsung_bl2_len +
458+ boards.BoardConfig.samsung_env_len)
459 self.assertEquals(
460 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
461 config.get_sfdisk_cmd())
462@@ -1674,9 +1675,10 @@
463 def test_origen(self):
464 class config(board_configs['origen']):
465 partition_layout = 'reserved_bootfs_rootfs'
466- LOADER_MIN_SIZE_S = (boards.BoardConfig.SAMSUNG_V310_BL2_START +
467- boards.BoardConfig.SAMSUNG_V310_BL2_LEN -
468- boards.BoardConfig.SAMSUNG_V310_BL1_START)
469+ LOADER_MIN_SIZE_S = (boards.BoardConfig.samsung_bl1_start +
470+ boards.BoardConfig.samsung_bl1_len +
471+ boards.BoardConfig.samsung_bl2_len +
472+ boards.BoardConfig.samsung_env_len)
473 self.assertEquals(
474 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
475 config.get_sfdisk_cmd())
476@@ -2212,10 +2214,10 @@
477 expected = [
478 '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc '
479 'seek=%d' % (sudo_args, bootloader_flavor,
480- boards.SMDKV310Config.SAMSUNG_V310_BL1_START),
481+ boards.SMDKV310Config.samsung_bl1_start),
482 '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc '
483 'seek=%d' % (sudo_args, bootloader_flavor,
484- boards.SMDKV310Config.SAMSUNG_V310_BL2_START)]
485+ boards.SMDKV310Config.samsung_bl2_start)]
486 self.assertEqual(expected, fixture.mock.commands_executed)
487
488 def test_install_origen_u_boot(self):
489@@ -2242,10 +2244,10 @@
490 expected = [
491 '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc '
492 'seek=%d' % (sudo_args, bootloader_flavor,
493- boards.OrigenConfig.SAMSUNG_V310_BL1_START),
494+ boards.OrigenConfig.samsung_bl1_start),
495 '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc '
496 'seek=%d' % (sudo_args, bootloader_flavor,
497- boards.OrigenConfig.SAMSUNG_V310_BL2_START)]
498+ boards.OrigenConfig.samsung_bl2_start)]
499 self.assertEqual(expected, fixture.mock.commands_executed)
500
501 def test_get_plain_boot_script_contents(self):

Subscribers

People subscribed via source and target branches