Merge lp:~mabac/linaro-image-tools/bug-867416 into lp:linaro-image-tools/11.11

Proposed by Mattias Backman
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 439
Merged at revision: 442
Proposed branch: lp:~mabac/linaro-image-tools/bug-867416
Merge into: lp:linaro-image-tools/11.11
Diff against target: 132 lines (+40/-1)
2 files modified
linaro_image_tools/media_create/boards.py (+22/-1)
linaro_image_tools/media_create/tests/test_media_create.py (+18/-0)
To merge this branch: bzr merge lp:~mabac/linaro-image-tools/bug-867416
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Review via email: mp+78230@code.launchpad.net

Description of the change

Hi,

This branch disabled the set_appropriate_tty call for V2 hwpacks. This was needed for Omap V1 hwpacks and should not execute for V2.

Also add several asserts to catch similar problems.

Thanks,

Mattias

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks good.

review: Approve

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 2011-09-22 20:11:46 +0000
3+++ linaro_image_tools/media_create/boards.py 2011-10-05 11:01:35 +0000
4@@ -834,6 +834,8 @@
5 If the kernel found in the chroot dir is << 2.6.36 we use tyyS2, else
6 we use the default value (_serial_tty).
7 """
8+ # XXX: delete this method when hwpacks V1 can die
9+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
10 # XXX: This is also part of our temporary hack to fix bug 697824.
11 cls.serial_tty = classproperty(lambda cls: cls._serial_tty)
12 vmlinuz = _get_file_matching(
13@@ -852,7 +854,8 @@
14 # XXX: This is also part of our temporary hack to fix bug 697824; we
15 # need to call set_appropriate_serial_tty() before doing anything that
16 # may use cls.serial_tty.
17- cls.set_appropriate_serial_tty(chroot_dir)
18+ if cls.hwpack_format == HardwarepackHandler.FORMAT_1:
19+ cls.set_appropriate_serial_tty(chroot_dir)
20 super(OmapConfig, cls).make_boot_files(
21 uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir,
22 rootfs_uuid, boot_dir, boot_device_or_file)
23@@ -861,6 +864,8 @@
24 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
25 boot_device_or_file, k_img_data, i_img_data,
26 d_img_data):
27+ # XXX: delete this method when hwpacks V1 can die
28+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
29 install_omap_boot_loader(chroot_dir, boot_dir, cls)
30 make_uImage(cls.load_addr, k_img_data, boot_dir)
31 make_uInitrd(i_img_data, boot_dir)
32@@ -926,6 +931,8 @@
33 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
34 boot_device_or_file, k_img_data, i_img_data,
35 d_img_data):
36+ # XXX: delete this method when hwpacks V1 can die
37+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
38 make_uImage(cls.load_addr, k_img_data, boot_dir)
39 make_uInitrd(i_img_data, boot_dir)
40 make_dtb(d_img_data, boot_dir)
41@@ -962,6 +969,8 @@
42 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
43 boot_device_or_file, k_img_data, i_img_data,
44 d_img_data):
45+ # XXX: delete this method when hwpacks V1 can die
46+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
47 make_uImage(cls.load_addr, k_img_data, boot_dir)
48 make_uInitrd(i_img_data, boot_dir)
49 boot_script_path = os.path.join(boot_dir, cls.boot_script)
50@@ -979,6 +988,8 @@
51 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
52 boot_device_or_file, k_img_data, i_img_data,
53 d_img_data):
54+ # XXX: delete this method when hwpacks V1 can die
55+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
56 make_uImage(cls.load_addr, k_img_data, boot_dir)
57 boot_script_path = os.path.join(boot_dir, cls.boot_script)
58 make_boot_script(boot_env, boot_script_path)
59@@ -1032,6 +1043,8 @@
60 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
61 boot_device_or_file, k_img_data, i_img_data,
62 d_img_data):
63+ # XXX: delete this method when hwpacks V1 can die
64+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
65 make_uImage(cls.load_addr, k_img_data, boot_dir)
66 boot_script_path = os.path.join(boot_dir, cls.boot_script)
67 make_boot_script(boot_env, boot_script_path)
68@@ -1185,6 +1198,8 @@
69 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
70 boot_device_or_file, k_img_data, i_img_data,
71 d_img_data):
72+ # XXX: delete this method when hwpacks V1 can die
73+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
74 with cls.hardwarepack_handler:
75 uboot_file = cls.get_file('u_boot', default=os.path.join(
76 chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor,
77@@ -1299,6 +1314,8 @@
78 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
79 boot_device_or_file, k_img_data, i_img_data,
80 d_img_data):
81+ # XXX: delete this method when hwpacks V1 can die
82+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
83 cls.install_samsung_boot_loader(cls._get_samsung_spl(chroot_dir),
84 cls._get_samsung_uboot(chroot_dir),
85 boot_device_or_file)
86@@ -1316,6 +1333,8 @@
87
88 @classmethod
89 def _get_samsung_spl(cls, chroot_dir):
90+ # XXX: delete this method when hwpacks V1 can die
91+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
92 spl_dir = os.path.join(
93 chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor)
94 old_spl_path = os.path.join(spl_dir, 'v310_mmc_spl.bin')
95@@ -1339,6 +1358,8 @@
96
97 @classmethod
98 def _get_samsung_uboot(cls, chroot_dir):
99+ # XXX: delete this method when hwpacks V1 can die
100+ assert cls.hwpack_format == HardwarepackHandler.FORMAT_1
101 uboot_file = os.path.join(
102 chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor,
103 'u-boot.bin')
104
105=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
106--- linaro_image_tools/media_create/tests/test_media_create.py 2011-09-20 14:51:30 +0000
107+++ linaro_image_tools/media_create/tests/test_media_create.py 2011-10-05 11:01:35 +0000
108@@ -1066,6 +1066,24 @@
109 self.set_appropriate_serial_tty_called,
110 "make_boot_files didn't call set_appropriate_serial_tty")
111
112+ def test_omap_make_boot_files_v2(self):
113+ self.set_appropriate_serial_tty_called = False
114+ class config(boards.BeagleConfig):
115+ hwpack_format = HardwarepackHandler.FORMAT_2
116+ self.mock_set_appropriate_serial_tty(config)
117+ self.useFixture(MockSomethingFixture(
118+ boards.BoardConfig, 'make_boot_files',
119+ classmethod(lambda *args: None)))
120+ # We don't need to worry about what's passed to make_boot_files()
121+ # because we mock the method which does the real work above and here
122+ # we're only interested in ensuring that OmapConfig.make_boot_files()
123+ # does not call set_appropriate_serial_tty().
124+ config.make_boot_files(
125+ None, None, None, None, None, None, None, None)
126+ self.assertFalse(
127+ self.set_appropriate_serial_tty_called,
128+ "make_boot_files called set_appropriate_serial_tty")
129+
130 def test_set_appropriate_serial_tty_old_kernel(self):
131 tempdir = self.useFixture(CreateTempDirFixture()).tempdir
132 boot_dir = os.path.join(tempdir, 'boot')

Subscribers

People subscribed via source and target branches