Merge lp:~mwaddel/linaro-image-tools/null-string-vexpress into lp:linaro-image-tools/11.11
- null-string-vexpress
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 309 |
Proposed branch: | lp:~mwaddel/linaro-image-tools/null-string-vexpress |
Merge into: | lp:linaro-image-tools/11.11 |
Diff against target: |
130 lines (+17/-16) 1 file modified
linaro_image_tools/media_create/boards.py (+17/-16) |
To merge this branch: | bzr merge lp:~mwaddel/linaro-image-tools/null-string-vexpress |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guilherme Salgado (community) | Approve | ||
Review via email:
|
Commit message
Description of the change
The call to make_boot_files() fails when boot_script_path isn't initialized. This happens in the Versatile Express because the boot script isn't used on this platform.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Loïc Minier (lool) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Guilherme Salgado (salgado) wrote : | # |
Hi Matt,
Thanks for this fix; I have just one suggestion below.
On Sat, 2011-04-02 at 05:21 +0000, Matt Waddel wrote:
[...]
> === modified file 'linaro_
> --- linaro_
> +++ linaro_
> @@ -287,7 +287,10 @@
> cmd_runner.run(
> ['cp', '-v', uboot_bin, boot_disk], as_root=
>
> - boot_script_path = os.path.
> + if cls.boot_script:
> + boot_script_path = os.path.
> + else:
> + boot_script_path = ''
I think it'd make more sense to just move the line you removed to the
_make_boot_files() methods that use it. For instance, in OmapConfig
we'd have:
boot_script_path = os.path.
[...]
make_
[...]
That means we'd duplicate the boot_script_path initialization in a few
different methods, but it's just one line and I think that's cleaner
than having it initialized in populate_boot() and passed all the way
down to _make_boot_files()
- 310. By Matt Waddel
-
Removes potentially uninitialized variable, boot_script_path, from calls to make_boot_files()
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Matt Waddel (mwaddel) wrote : | # |
Hi Salgado,
I have made the changes you suggested. The changes are a bit more extensive than the original fix, but I tested in both a beagle and a vexpress deploy and everything seems to work.
Beagle deploy command used:
./linaro-
Vexpress deploy command used:
./linaro-
I think it's ready for a merge review again.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Guilherme Salgado (salgado) wrote : | # |
Thanks for doing the changes, Matt. I'm happy to merge this but I think some tests will fail because of the signature change in make_boot_files(). Did you run the test suite ('testr run') to check?
If I'm not mistaken, you'll just have to remove the 'boot_disk/
Preview Diff
1 | === modified file 'linaro_image_tools/media_create/boards.py' | |||
2 | --- linaro_image_tools/media_create/boards.py 2011-04-01 14:18:41 +0000 | |||
3 | +++ linaro_image_tools/media_create/boards.py 2011-04-04 16:38:27 +0000 | |||
4 | @@ -250,16 +250,15 @@ | |||
5 | 250 | 250 | ||
6 | 251 | @classmethod | 251 | @classmethod |
7 | 252 | def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, | 252 | def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, |
10 | 253 | chroot_dir, rootfs_uuid, boot_dir, boot_script_path, | 253 | chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file): |
9 | 254 | boot_device_or_file): | ||
11 | 255 | boot_env = cls._get_boot_env(is_live, is_lowmem, consoles, rootfs_uuid) | 254 | boot_env = cls._get_boot_env(is_live, is_lowmem, consoles, rootfs_uuid) |
12 | 256 | cls._make_boot_files( | 255 | cls._make_boot_files( |
14 | 257 | uboot_parts_dir, boot_env, chroot_dir, boot_dir, boot_script_path, | 256 | uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
15 | 258 | boot_device_or_file) | 257 | boot_device_or_file) |
16 | 259 | 258 | ||
17 | 260 | @classmethod | 259 | @classmethod |
18 | 261 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, | 260 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
20 | 262 | boot_script_path, boot_device_or_file): | 261 | boot_device_or_file): |
21 | 263 | """Make the necessary boot files for this board. | 262 | """Make the necessary boot files for this board. |
22 | 264 | 263 | ||
23 | 265 | This is usually board-specific so ought to be defined in every | 264 | This is usually board-specific so ought to be defined in every |
24 | @@ -287,11 +286,9 @@ | |||
25 | 287 | cmd_runner.run( | 286 | cmd_runner.run( |
26 | 288 | ['cp', '-v', uboot_bin, boot_disk], as_root=True).wait() | 287 | ['cp', '-v', uboot_bin, boot_disk], as_root=True).wait() |
27 | 289 | 288 | ||
28 | 290 | boot_script_path = os.path.join(boot_disk, cls.boot_script) | ||
29 | 291 | |||
30 | 292 | cls.make_boot_files( | 289 | cls.make_boot_files( |
31 | 293 | uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, | 290 | uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, |
33 | 294 | rootfs_uuid, boot_disk, boot_script_path, boot_device_or_file) | 291 | rootfs_uuid, boot_disk, boot_device_or_file) |
34 | 295 | 292 | ||
35 | 296 | cmd_runner.run(['sync']).wait() | 293 | cmd_runner.run(['sync']).wait() |
36 | 297 | try: | 294 | try: |
37 | @@ -346,23 +343,23 @@ | |||
38 | 346 | 343 | ||
39 | 347 | @classmethod | 344 | @classmethod |
40 | 348 | def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, | 345 | def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, |
43 | 349 | chroot_dir, rootfs_uuid, boot_dir, boot_script_path, | 346 | chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file): |
42 | 350 | boot_device_or_file): | ||
44 | 351 | # XXX: This is also part of our temporary hack to fix bug 697824; we | 347 | # XXX: This is also part of our temporary hack to fix bug 697824; we |
45 | 352 | # need to call set_appropriate_serial_tty() before doing anything that | 348 | # need to call set_appropriate_serial_tty() before doing anything that |
46 | 353 | # may use cls.serial_tty. | 349 | # may use cls.serial_tty. |
47 | 354 | cls.set_appropriate_serial_tty(chroot_dir) | 350 | cls.set_appropriate_serial_tty(chroot_dir) |
48 | 355 | super(OmapConfig, cls).make_boot_files( | 351 | super(OmapConfig, cls).make_boot_files( |
49 | 356 | uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, | 352 | uboot_parts_dir, is_live, is_lowmem, consoles, chroot_dir, |
51 | 357 | rootfs_uuid, boot_dir, boot_script_path, boot_device_or_file) | 353 | rootfs_uuid, boot_dir, boot_device_or_file) |
52 | 358 | 354 | ||
53 | 359 | @classmethod | 355 | @classmethod |
54 | 360 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, | 356 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
56 | 361 | boot_script_path, boot_device_or_file): | 357 | boot_device_or_file): |
57 | 362 | install_omap_boot_loader(chroot_dir, boot_dir) | 358 | install_omap_boot_loader(chroot_dir, boot_dir) |
58 | 363 | make_uImage( | 359 | make_uImage( |
59 | 364 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) | 360 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) |
60 | 365 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) | 361 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) |
61 | 362 | boot_script_path = os.path.join(boot_dir, cls.boot_script) | ||
62 | 366 | make_boot_script(boot_env, boot_script_path) | 363 | make_boot_script(boot_env, boot_script_path) |
63 | 367 | make_boot_ini(boot_script_path, boot_dir) | 364 | make_boot_ini(boot_script_path, boot_dir) |
64 | 368 | 365 | ||
65 | @@ -414,10 +411,11 @@ | |||
66 | 414 | 411 | ||
67 | 415 | @classmethod | 412 | @classmethod |
68 | 416 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, | 413 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
70 | 417 | boot_script_path, boot_device_or_file): | 414 | boot_device_or_file): |
71 | 418 | make_uImage( | 415 | make_uImage( |
72 | 419 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) | 416 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) |
73 | 420 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) | 417 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) |
74 | 418 | boot_script_path = os.path.join(boot_dir, cls.boot_script) | ||
75 | 421 | make_boot_script(boot_env, boot_script_path) | 419 | make_boot_script(boot_env, boot_script_path) |
76 | 422 | make_boot_ini(boot_script_path, boot_dir) | 420 | make_boot_ini(boot_script_path, boot_dir) |
77 | 423 | 421 | ||
78 | @@ -440,10 +438,11 @@ | |||
79 | 440 | 438 | ||
80 | 441 | @classmethod | 439 | @classmethod |
81 | 442 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, | 440 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
83 | 443 | boot_script_path, boot_device_or_file): | 441 | boot_device_or_file): |
84 | 444 | make_uImage( | 442 | make_uImage( |
85 | 445 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) | 443 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) |
86 | 446 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) | 444 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) |
87 | 445 | boot_script_path = os.path.join(boot_dir, cls.boot_script) | ||
88 | 447 | make_boot_script(boot_env, boot_script_path) | 446 | make_boot_script(boot_env, boot_script_path) |
89 | 448 | 447 | ||
90 | 449 | 448 | ||
91 | @@ -485,13 +484,14 @@ | |||
92 | 485 | 484 | ||
93 | 486 | @classmethod | 485 | @classmethod |
94 | 487 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, | 486 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
96 | 488 | boot_script_path, boot_device_or_file): | 487 | boot_device_or_file): |
97 | 489 | uboot_file = os.path.join( | 488 | uboot_file = os.path.join( |
98 | 490 | chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor, 'u-boot.imx') | 489 | chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor, 'u-boot.imx') |
99 | 491 | install_mx5_boot_loader(uboot_file, boot_device_or_file) | 490 | install_mx5_boot_loader(uboot_file, boot_device_or_file) |
100 | 492 | make_uImage( | 491 | make_uImage( |
101 | 493 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) | 492 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) |
102 | 494 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) | 493 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) |
103 | 494 | boot_script_path = os.path.join(boot_dir, cls.boot_script) | ||
104 | 495 | make_boot_script(boot_env, boot_script_path) | 495 | make_boot_script(boot_env, boot_script_path) |
105 | 496 | 496 | ||
106 | 497 | 497 | ||
107 | @@ -542,7 +542,7 @@ | |||
108 | 542 | 542 | ||
109 | 543 | @classmethod | 543 | @classmethod |
110 | 544 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, | 544 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
112 | 545 | boot_script_path, boot_device_or_file): | 545 | boot_device_or_file): |
113 | 546 | make_uImage( | 546 | make_uImage( |
114 | 547 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) | 547 | cls.load_addr, uboot_parts_dir, cls.kernel_suffix, boot_dir) |
115 | 548 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) | 548 | make_uInitrd(uboot_parts_dir, cls.kernel_suffix, boot_dir) |
116 | @@ -604,7 +604,7 @@ | |||
117 | 604 | 604 | ||
118 | 605 | @classmethod | 605 | @classmethod |
119 | 606 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, | 606 | def _make_boot_files(cls, uboot_parts_dir, boot_env, chroot_dir, boot_dir, |
121 | 607 | boot_script_path, boot_device_or_file): | 607 | boot_device_or_file): |
122 | 608 | uboot_file = os.path.join( | 608 | uboot_file = os.path.join( |
123 | 609 | chroot_dir, 'usr', 'lib', 'u-boot', 'smdkv310', 'u-boot.v310') | 609 | chroot_dir, 'usr', 'lib', 'u-boot', 'smdkv310', 'u-boot.v310') |
124 | 610 | install_smdkv310_boot_loader(uboot_file, boot_device_or_file) | 610 | install_smdkv310_boot_loader(uboot_file, boot_device_or_file) |
125 | @@ -623,6 +623,7 @@ | |||
126 | 623 | 623 | ||
127 | 624 | # unused at the moment once FAT support enabled for the | 624 | # unused at the moment once FAT support enabled for the |
128 | 625 | # Samsung u-boot this can be used bug 727978 | 625 | # Samsung u-boot this can be used bug 727978 |
129 | 626 | #boot_script_path = os.path.join(boot_dir, cls.boot_script) | ||
130 | 626 | #make_boot_script(boot_env, boot_script_path) | 627 | #make_boot_script(boot_env, boot_script_path) |
131 | 627 | 628 | ||
132 | 628 | 629 |
On Sat, Apr 02, 2011, Matt Waddel wrote: join(boot_ disk, cls.boot_script)
> + if cls.boot_script:
> + boot_script_path = os.path.
> + else:
> + boot_script_path = ''
Can we make it None instead? '' + 'boot.scr' might actually work and
result in either '/boot.scr' on the host or 'boot.scr' in the current
working directory on the host, so I prefer we use None just in case
Perhaps something like: script_ path = None
boot_script_ path = os.path. join(boot_ disk, cls.boot_script)
boot_
if cls.boot_script:
--
Loïc Minier