Merge lp:~fboudra/linaro-image-tools/highbank-support into lp:linaro-image-tools/11.11

Proposed by Fathi Boudra
Status: Merged
Approved by: Milo Casagrande
Approved revision: 620
Merged at revision: 619
Proposed branch: lp:~fboudra/linaro-image-tools/highbank-support
Merge into: lp:linaro-image-tools/11.11
Diff against target: 212 lines (+89/-18)
3 files modified
linaro_image_tools/media_create/boards.py (+41/-14)
linaro_image_tools/media_create/partitions.py (+9/-4)
linaro_image_tools/media_create/tests/test_media_create.py (+39/-0)
To merge this branch: bzr merge lp:~fboudra/linaro-image-tools/highbank-support
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Approve
Review via email: mp+157044@code.launchpad.net

Description of the change

Add Highbank support:
- load kernel/initrd from ext2 boot parttion
- load dtb provided by the firmware
- introduce load_interface (default is mmc)
- introduce bootfs_type (default is vfat)
- fix boot_cmd to boot from disk

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote :

Thanks Fabo for working on this! It looks good to go.

Am just wondering if we need to add a check for "self.bootfs_type" in order to make sure that through an hwpack config file a wrong value is not passed. But it is not really relevant to this MP.

review: Approve
Revision history for this message
Fathi Boudra (fboudra) wrote :

> Am just wondering if we need to add a check for "self.bootfs_type" in order to make sure that through an hwpack config file a wrong value is not passed. But it is not really relevant to this MP.

bootfs_type isn't exposed in hwpack format v3 at this point.
We'll need such check when we'll update the format and make available
load_interface/bootfs_type to the users.
I guess it should be part of the format update merge proposal :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro_image_tools/media_create/boards.py'
2--- linaro_image_tools/media_create/boards.py 2013-04-03 15:12:24 +0000
3+++ linaro_image_tools/media_create/boards.py 2013-04-04 08:17:26 +0000
4@@ -169,6 +169,8 @@
5 self.extra_boot_args_options = None
6 self.fat_size = 32
7 self.fatload_command = 'fatload'
8+ self.load_interface = 'mmc'
9+ self.bootfs_type = 'vfat'
10 self.fdt_high = '0xffffffff'
11 self.hardwarepack_handler = None
12 self.hwpack_format = None
13@@ -448,13 +450,17 @@
14
15 :param should_align_boot_part: Whether to align the boot partition too.
16
17- This returns a boot vfat partition of type FAT16
18- or FAT32, followed by a root partition.
19+ This returns a boot partition of type FAT16 or FAT32 or Linux,
20+ followed by a root partition.
21 """
22- if self.fat_size == 32:
23- partition_type = '0x0C'
24+
25+ if self.bootfs_type == 'vfat':
26+ if self.fat_size == 32:
27+ partition_type = '0x0C'
28+ else:
29+ partition_type = '0x0E'
30 else:
31- partition_type = '0x0E'
32+ partition_type = '0x83'
33
34 # align on sector 63 for compatibility with broken versions of x-loader
35 # unless align_boot_part is set
36@@ -522,23 +528,26 @@
37 replacements = dict(
38 fatload_command=self.fatload_command, uimage_path=self.uimage_path,
39 mmc_option=self.mmc_option, kernel_addr=self.kernel_addr,
40- initrd_addr=self.initrd_addr, dtb_addr=self.dtb_addr)
41+ initrd_addr=self.initrd_addr, dtb_addr=self.dtb_addr,
42+ load_interface=self.load_interface)
43+
44 boot_script = (
45- ("%(fatload_command)s mmc %(mmc_option)s %(kernel_addr)s " +
46- "%(uimage_path)suImage; ")) % replacements
47+ ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
48+ "%(kernel_addr)s %(uimage_path)suImage; ")) % replacements
49 if i_img_data is not None:
50 boot_script += (
51- ("%(fatload_command)s mmc %(mmc_option)s %(initrd_addr)s " +
52- "%(uimage_path)suInitrd; ")) % replacements
53+ ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
54+ "%(initrd_addr)s %(uimage_path)suInitrd; ")) % replacements
55 if d_img_data is not None:
56 assert self.dtb_addr is not None, (
57 "Need a dtb_addr when passing d_img_data")
58- boot_script += ("%(fatload_command)s mmc %(mmc_option)s "
59- "%(dtb_addr)s board.dtb; " % replacements)
60+ boot_script += (
61+ ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
62+ "%(dtb_addr)s board.dtb; ")) % replacements
63 boot_script += (("bootm %(kernel_addr)s")) % replacements
64 if i_img_data is not None:
65 boot_script += ((" %(initrd_addr)s")) % replacements
66- if d_img_data is not None:
67+ if self.dtb_addr is not None:
68 boot_script += ((" %(dtb_addr)s")) % replacements
69 return boot_script
70
71@@ -1317,7 +1326,8 @@
72 class Mx53Config(Mx5Config):
73 def __init__(self):
74 super(Mx53Config, self).__init__()
75- self.dtb_addr = '0x71ff0000'
76+ # XXX: Is dtb_addr really needed?
77+ #self.dtb_addr = '0x71ff0000'
78 self.initrd_addr = '0x72000000'
79 self.kernel_addr = '0x70000000'
80 self.kernel_flavors = ['linaro-lt-mx53', 'linaro-lt-mx5']
81@@ -1680,6 +1690,22 @@
82 return bl0_file
83
84
85+class HighBankConfig(BoardConfig):
86+ def __init__(self):
87+ super(HighBankConfig, self).__init__()
88+ self.boot_script = 'boot.scr'
89+ self.bootloader_flavor = 'highbank'
90+ self.kernel_flavors = ['highbank']
91+ self.serial_tty = 'ttyAMA0'
92+ self.fatload_command = 'ext2load'
93+ self.load_interface = 'scsi'
94+ self.bootfs_type = 'ext2'
95+ self.dtb_addr = '0x00001000'
96+ self.initrd_addr = '0x01000000'
97+ self.kernel_addr = '0x00800000'
98+ self.load_addr = '0x00000000'
99+
100+
101 class I386Config(BoardConfig):
102 # define bootloader
103 BOOTLOADER_CMD = 'grub-install'
104@@ -1751,6 +1777,7 @@
105 'efikamx': EfikamxConfig,
106 'efikasb': EfikasbConfig,
107 'fastmodel': FastModelConfig,
108+ 'highbank': HighBankConfig,
109 'i386': I386Config,
110 'igep': IgepConfig,
111 'mx51evk': Mx51evkConfig,
112
113=== modified file 'linaro_image_tools/media_create/partitions.py'
114--- linaro_image_tools/media_create/partitions.py 2013-02-17 13:53:41 +0000
115+++ linaro_image_tools/media_create/partitions.py 2013-04-04 08:17:26 +0000
116@@ -164,10 +164,15 @@
117
118 if should_format_bootfs:
119 print "\nFormating boot partition\n"
120- proc = cmd_runner.run(
121- ['mkfs.vfat', '-F', str(board_config.fat_size), bootfs, '-n',
122- bootfs_label],
123- as_root=True)
124+ mkfs = 'mkfs.%s' % board_config.bootfs_type
125+ if board_config.bootfs_type == 'vfat':
126+ proc = cmd_runner.run(
127+ [mkfs, '-F', str(board_config.fat_size), bootfs, '-n',
128+ bootfs_label],
129+ as_root=True)
130+ else:
131+ proc = cmd_runner.run(
132+ [mkfs, bootfs, '-L', bootfs_label], as_root=True)
133 proc.wait()
134
135 if should_format_rootfs:
136
137=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
138--- linaro_image_tools/media_create/tests/test_media_create.py 2013-04-03 15:12:24 +0000
139+++ linaro_image_tools/media_create/tests/test_media_create.py 2013-04-04 08:17:26 +0000
140@@ -1423,6 +1423,12 @@
141 'make_dtb', 'make_boot_script', 'make_boot_ini']
142 self.assertEqual(expected, self.funcs_calls)
143
144+ def test_highbank_steps(self):
145+ board_conf = boards.HighBankConfig()
146+ board_conf.hwpack_format = HardwarepackHandler.FORMAT_1
147+ expected = []
148+ self.assertEqual(expected, self.funcs_calls)
149+
150
151 class TestPopulateRawPartition(TestCaseWithFixtures):
152
153@@ -1544,6 +1550,11 @@
154 expected = []
155 self.assertEqual(expected, self.funcs_calls)
156
157+ def test_highbank_raw(self):
158+ self.populate_raw_partition(boards.HighBankConfig())
159+ expected = []
160+ self.assertEqual(expected, self.funcs_calls)
161+
162
163 class TestPopulateRawPartitionAndroid(TestCaseWithFixtures):
164
165@@ -1843,6 +1854,13 @@
166 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
167 board_conf.get_sfdisk_cmd())
168
169+ def test_highbank(self):
170+ board_conf = get_board_config('highbank')
171+ self.set_up_config(board_conf)
172+ self.assertEquals(
173+ '63,106432,0x83,*\n106496,,,-',
174+ board_conf.get_sfdisk_cmd())
175+
176 def test_panda_android(self):
177 self.assertEqual(
178 '63,270272,0x0C,*\n270336,1048576,L\n1318912,524288,L\n'
179@@ -1958,6 +1976,13 @@
180 '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
181 board_conf.get_sfdisk_cmd())
182
183+ def test_highbank(self):
184+ board_conf = get_board_config('highbank')
185+ board_conf.partition_layout = 'bootfs_rootfs'
186+ self.assertEquals(
187+ '63,106432,0x83,*\n106496,,,-',
188+ board_conf.get_sfdisk_cmd())
189+
190
191 class TestGetBootCmd(TestCase):
192
193@@ -2202,6 +2227,20 @@
194 'initrd_high': '0xffffffff'}
195 self.assertEqual(expected, boot_commands)
196
197+ def test_highbank(self):
198+ board_conf = get_board_config('highbank')
199+ boot_commands = board_conf._get_boot_env(
200+ is_live=False, is_lowmem=False, consoles=[],
201+ rootfs_id="UUID=deadbeef", i_img_data="initrd", d_img_data=None)
202+ expected = {
203+ 'bootargs': 'root=UUID=deadbeef rootwait ro',
204+ 'bootcmd': 'ext2load scsi 0:1 0x00800000 uImage; '
205+ 'ext2load scsi 0:1 0x01000000 uInitrd; '
206+ 'bootm 0x00800000 0x01000000 0x00001000',
207+ 'fdt_high': '0xffffffff',
208+ 'initrd_high': '0xffffffff'}
209+ self.assertEqual(expected, boot_commands)
210+
211
212 class TestExtraBootCmd(TestCaseWithFixtures):
213

Subscribers

People subscribed via source and target branches