Merge lp:~shawnguo/linaro-image-tools/add-dtb into lp:linaro-image-tools/11.11

Proposed by Shawn Guo
Status: Merged
Merged at revision: 319
Proposed branch: lp:~shawnguo/linaro-image-tools/add-dtb
Merge into: lp:linaro-image-tools/11.11
Diff against target: 562 lines (+152/-47)
2 files modified
linaro_image_tools/media_create/boards.py (+76/-25)
linaro_image_tools/media_create/tests/test_media_create.py (+76/-22)
To merge this branch: bzr merge lp:~shawnguo/linaro-image-tools/add-dtb
Reviewer Review Type Date Requested Status
Loïc Minier (community) Approve
Review via email: mp+57127@code.launchpad.net

Description of the change

This is the lmc dtb support for omap and mx5 at branch. Please help
review. Here are some notes for reviewers.

* I chose not to add any argument to lmc for differentiating the
  boards which do not support dt yet from those which already do.
  Instead, I use board properties 'dtb_addr' and 'dtb_name'. With
  this approach, all the changes will be limited in boards.py. And
  also considering that the current solution may be temporary and we
  will ultimately support dtb by appending it to kernel image, it may
  be reasonable to save one lmc argument for temporary dtb support.

* Board 'igep' is being split into 'igepv2' and 'igepv3', as they get
  different .dtb files.

* Boards 'vexpress' and 'ux500' do not get supported, as there is no
  dt support for them yet in kernel tree (no .dts for the boards).

* Though dt support for 'smdkv310' has been available in kernel tree,
  I did not add the dtb support in lmc for it, because bug 727978
  makes the board so unique in terms of installing and loading boot
  files. And I'm seeing some recent activity of addressing the bug,
  so I would hold this board for a while.

* Boards 'tegra-harmony', 'versatile-ab' and 'versatile-pb' have
  already got dt support in kernel tree, but lmc does not support
  them at all.

* It passed 'testr run' and was only tested on mx51evk board.

* This branch can not be merged into trunk for working with daily
  build hwpack before John Rigby gets .dtb files be there.

To post a comment you must log in.
Revision history for this message
Loïc Minier (lool) wrote :
Download full text (8.0 KiB)

 This is looking awesome, good job! Some questions below

On Mon, Apr 11, 2011, Shawn Guo wrote:
> * I chose not to add any argument to lmc for differentiating the
> boards which do not support dt yet from those which already do.
> Instead, I use board properties 'dtb_addr' and 'dtb_name'. With
> this approach, all the changes will be limited in boards.py. And
> also considering that the current solution may be temporary and we
> will ultimately support dtb by appending it to kernel image, it may
> be reasonable to save one lmc argument for temporary dtb support.

 Does it make sense to make DT support optional for boards which support
 it? I mean, if some thing are known not to work in a DT scenario, then
 we should allow people to disable DT even if it's present. So are
 there any known regressions for boards with DT support?

> * Board 'igep' is being split into 'igepv2' and 'igepv3', as they get
> different .dtb files.

 This is the right way to implement it, and I don't mind too much
 renaming "--dev igep" to "--dev igepv2", but do you actually have an
 IGEPv3 to test? We will eventually add support for using u-boot-linaro
 with IGEPv2 (bug #716627), and we don't have an IGEPv3 build of
 u-boot-linaro as we have no way to test it.

> * Boards 'vexpress' and 'ux500' do not get supported, as there is no
> dt support for them yet in kernel tree (no .dts for the boards).

 Probably something to discuss in some other place, but ARM has a DT
 support tree for their boards, so I'm pretty sure we can find a .dts
 for vexpress /somewhere/. :-) Lorenzo from ARM would know.

> * Though dt support for 'smdkv310' has been available in kernel tree,
> I did not add the dtb support in lmc for it, because bug 727978
> makes the board so unique in terms of installing and loading boot
> files. And I'm seeing some recent activity of addressing the bug,
> so I would hold this board for a while.

 Ok; we should file a bug to track this as to not forget about it; there
 is indeed a code revamp of smdkv310 pending, and it's going to look
 very similar to mx51/mx53 boards.

> * Boards 'tegra-harmony', 'versatile-ab' and 'versatile-pb' have
> already got dt support in kernel tree, but lmc does not support
> them at all.

 Yup; versatile-ab/-pb wont be supported any time soon as we don't have
 any armv5 userspace to run with them, and tegra-harmony isn't really a
 priority because we don't use Nvidia hardware in Linaro ATM.

> * This branch can not be merged into trunk for working with daily
> build hwpack before John Rigby gets .dtb files be there.

 Actually that's a bug: we still need to support images from the 10.11
 release, at least until the 11.05 release, so it would be good to
 support the absence of the DTB file. It's a bit more fragile, but we
 don't have a good way to track whether a .dtb file is present in a
 hwpack or not, this will be the case with HardwarePackV2 when that's
 implemented though.

> - replacements = dict(
> - mmc_option=cls.mmc_option, kernel_addr=cls.kernel_addr,
> - initrd_addr=cls.initrd_addr)
> - return (
> - "fatload mmc %(mmc_option)s %(kerne...

Read more...

Revision history for this message
James Westby (james-w) wrote :

257 - 'igep': IgepConfig,
258 + 'igepv2': Igepv2Config,

Should we break --dev igep?

We could add an alias facility so that it keeps working, but it would
be a bunch more work.

(We can just put Igepv2Config in the dict twice, but I think it's better
to make it hidden so as not to confuse someone new with an igepv3 board.)

Thanks,

James

Revision history for this message
Loïc Minier (lool) wrote :

On Mon, Apr 11, 2011, James Westby wrote:
> (We can just put Igepv2Config in the dict twice, but I think it's better
> to make it hidden so as not to confuse someone new with an igepv3 board.)

 I think it's ok to break it; the new name is more correct and we can
 include this in the release notes; people who run the command by hand
 should notice the new name in the help output

--
Loïc Minier

Revision history for this message
Shawn Guo (shawnguo) wrote :
Download full text (9.9 KiB)

On 11 April 2011 18:29, Loïc Minier <email address hidden> wrote:
>  This is looking awesome, good job!  Some questions below
>
Thanks. And I'm still a Python beginner, so really need your expertise here.

> On Mon, Apr 11, 2011, Shawn Guo wrote:
>> * I chose not to add any argument to lmc for differentiating the
>>   boards which do not support dt yet from those which already do.
>>   Instead, I use board properties 'dtb_addr' and 'dtb_name'.  With
>>   this approach, all the changes will be limited in boards.py.  And
>>   also considering that the current solution may be temporary and we
>>   will ultimately support dtb by appending it to kernel image, it may
>>   be reasonable to save one lmc argument for temporary dtb support.
>
>  Does it make sense to make DT support optional for boards which support
>  it?  I mean, if some thing are known not to work in a DT scenario, then
>  we should allow people to disable DT even if it's present.  So are
>  there any known regressions for boards with DT support?
>
For this cycle, the DT support is very basic and limited, and I do not
see any possible regression for any board with DT support.

>> * Board 'igep' is being split into 'igepv2' and 'igepv3', as they get
>>   different .dtb files.
>
>  This is the right way to implement it, and I don't mind too much
>  renaming "--dev igep" to "--dev igepv2", but do you actually have an
>  IGEPv3 to test?  We will eventually add support for using u-boot-linaro
>  with IGEPv2 (bug #716627), and we don't have an IGEPv3 build of
>  u-boot-linaro as we have no way to test it.
>
All I have for testing is mx51evk :) I have never seen either IGEPv2
or IGEPv3. I'm seeing dts files 'isee-igep-v2.dts' and
'isee-igep-v3.dts' under linux-linaro-2.6.38/arch/arm/boot/dts (Nico's
tree), so I would say it's a direct reflecting of kernel tree.

>> * Boards 'vexpress' and 'ux500' do not get supported, as there is no
>>   dt support for them yet in kernel tree (no .dts for the boards).
>
>  Probably something to discuss in some other place, but ARM has a DT
>  support tree for their boards, so I'm pretty sure we can find a .dts
>  for vexpress /somewhere/.  :-)  Lorenzo from ARM would know.
>
I only keep my eyes on folder linux-linaro-2.6.38/arch/arm/boot/dts,
as I suppose lmc dt support only works with .deb built from John
Rigby's tree which is a downstream of Nico's tree.

>> * Though dt support for 'smdkv310' has been available in kernel tree,
>>   I did not add the dtb support in lmc for it, because bug 727978
>>   makes the board so unique in terms of installing and loading boot
>>   files.  And I'm seeing some recent activity of addressing the bug,
>>   so I would hold this board for a while.
>
>  Ok; we should file a bug to track this as to not forget about it; there
>  is indeed a code revamp of smdkv310 pending, and it's going to look
>  very similar to mx51/mx53 boards.
>
https://bugs.launchpad.net/linaro-image-tools/+bug/757694

>> * Boards 'tegra-harmony', 'versatile-ab' and 'versatile-pb' have
>>   already got dt support in kernel tree, but lmc does not support
>>   them at all.
>
>  Yup; versatile-ab/-pb wont be supported any time soon as we don't have
>  any armv...

Revision history for this message
Loïc Minier (lool) wrote :
Download full text (4.2 KiB)

On Tue, Apr 12, 2011, Shawn Guo wrote:
> >  This is the right way to implement it, and I don't mind too much
> >  renaming "--dev igep" to "--dev igepv2", but do you actually have an
> >  IGEPv3 to test?  We will eventually add support for using u-boot-linaro
> >  with IGEPv2 (bug #716627), and we don't have an IGEPv3 build of
> >  u-boot-linaro as we have no way to test it.
> >
> All I have for testing is mx51evk :) I have never seen either IGEPv2
> or IGEPv3. I'm seeing dts files 'isee-igep-v2.dts' and
> 'isee-igep-v3.dts' under linux-linaro-2.6.38/arch/arm/boot/dts (Nico's
> tree), so I would say it's a direct reflecting of kernel tree.

 Ok, so we only support IGEPv2; you could just keep the current "IGEP"
 name and add IGEPv2 specific things to it. I don't mind if you rename
 it to IGEPv2, but it's also counter-intuitive for people who were using
 the "igep" name, so I wouldn't bother and just let it be "igep". Don't
 add an IGEPv3 though, as we have no way to test it.

> >> * Boards 'vexpress' and 'ux500' do not get supported, as there is no
> >>   dt support for them yet in kernel tree (no .dts for the boards).
> >
> >  Probably something to discuss in some other place, but ARM has a DT
> >  support tree for their boards, so I'm pretty sure we can find a .dts
> >  for vexpress /somewhere/.  :-)  Lorenzo from ARM would know.
> >
> I only keep my eyes on folder linux-linaro-2.6.38/arch/arm/boot/dts,
> as I suppose lmc dt support only works with .deb built from John
> Rigby's tree which is a downstream of Nico's tree.

 Yup; not your duty to chase Vexpress support if it's not in the tree;
 just wanted to mention it for completeness.

> >> * This branch can not be merged into trunk for working with daily
> >>   build hwpack before John Rigby gets .dtb files be there.
> >  Actually that's a bug: we still need to support images from the 10.11
> >  release, at least until the 11.05 release, so it would be good to
> >  support the absence of the DTB file.  It's a bit more fragile, but we
> >  don't have a good way to track whether a .dtb file is present in a
> >  hwpack or not, this will be the case with HardwarePackV2 when that's
> >  implemented though.
> Will HardwarePackV2 be implemented for 11.05 release cycle? If yes, I
> will keep my eyes on it and start address the problem when it gets
> ready. Otherwise, please let me know what I need to do.

 No, it wont be done in 11.05. What needs to be done is to check
 whether the .dtb file is present; if it is, use it, otherwise default
 to non-dtb mode.

 You can test with os.path.exists().

> >>  class Mx51Config(Mx5Config):
> >> -    kernel_addr = '0x90000000'
> >> -    initrd_addr = '0x92000000'
> >> +    kernel_addr = '0x90800000'
> >> +    dtb_addr = '0x917f0000'
> >> +    initrd_addr = '0x91800000'
> >
> >  Mind giving some details about why these changes to kernel_addr and
> >  initrd_addr are required?
> >
> I think it's nice if they get aligned with mx53 address offset,
> because I do not want to get people wondering why mx51 needs to be
> different from mx53 in terms of the address offset or versus. But the
> changes are not required indeed for dtb support. That's why I got t...

Read more...

320. By Shawn Guo

Address the following review comments from Loic

* make .dtb presenting optional
* keep 'igep' unchanged and add isee-igep-v2.dtb for it
* make bootcmd(cls) a little simpler
* keep mx51 addresses unchanged and align mx53 with it
* add tests for dtb related functions

Revision history for this message
Shawn Guo (shawnguo) wrote :

Hi Loic,

I just updated the branch with your comments addressed. Can you please start anther round of review and let me know if you have further comments.

The updates include:
* make the present of .dtb file optional
* keep 'igep' as the original and add isee-igep-v2.dtb support for 'igep' board
* take your suggestion to make bootcmd(cls) a little simpler
* keep mx51 addresses as the original and align mx53 with it to keep initrd image ~32M away from kernel
* add tests for dtb related functions per your suggestion

Regards,
Shawn

Revision history for this message
Loïc Minier (lool) wrote :

 review: approve

On Tue, Apr 12, 2011, Shawn Guo wrote:
> I just updated the branch with your comments addressed. Can you
> please start anther round of review and let me know if you have
> further comments.

 Yup; in the future, please try to commit separate changes separately.

 In _get_kflavor_files, I'd use two different names for cls.dtb_name and
 the result of _get_file_matching; the latter is a pathname while the
 former is just the last part of the pathname.

 But there is an actually even nicer change you could do: include the
 dtb_name in the regexp:
 DT_GLOB = 'dt-*-%(kernel_flavor)s/%(dtb_name)'

 dregex = DT_GLOB % {'kernel_flavor': flavor, 'dtb_name': cls.dtb_name}

 You could add a comment in the function to state that the dtb is
 optional, or better: expand the inline doc to state that dtb might be
 None in the output:
- """Search for kernel, initrd and dtb in path."""
+ """Search for kernel, initrd and optional dtb in path."""

 Don't set cls.dtb_name = cls.dtb_addr in this function; we don't change
 class variables down there, and the values you set should already be
 set if the definition is correct.

 I don't understand the layout though: is it supposed to be
 /boot/dt-something-2.6.38-1/mx51-babbage.dtb?

 What are the possible values for "something" above?

 Are these files provided directly by the kernel package?

 In make_dtb(), I don't really like the name of the file, but I can't
 think of a better filename. :-/

 There are a couple gratuitous changes in the diff, but they seem
 harmless:
 * make_boot_files(): you move the _get_kflavor_files call one line up,
   doesn't seem to matter
 * in test_igep, switching from board_configs['igep'] to
   boards.IgepConfig
 these don't matter to me either way.

--
Loïc Minier

review: Approve
Revision history for this message
Shawn Guo (shawnguo) wrote :
Download full text (3.4 KiB)

On 13 April 2011 01:12, Loïc Minier <email address hidden> wrote:
> Review: Approve
>  review: approve
>
> On Tue, Apr 12, 2011, Shawn Guo wrote:
>> I just updated the branch with your comments addressed.  Can you
>> please start anther round of review and let me know if you have
>> further comments.
>
>  Yup; in the future, please try to commit separate changes separately.
>
Ok. I actually intended to do so, but the Preview Diff on review page
squash all the commits, which led me thought that the separate is not
important in Bzr. Clearly, I'm wrong here. So what is the benefit of
doing this? Will all those separate commits show up on trunk with
merge?

>  In _get_kflavor_files, I'd use two different names for cls.dtb_name and
>  the result of _get_file_matching; the latter is a pathname while the
>  former is just the last part of the pathname.
>
>  But there is an actually even nicer change you could do: include the
>  dtb_name in the regexp:
>  DT_GLOB = 'dt-*-%(kernel_flavor)s/%(dtb_name)'
>
>  dregex = DT_GLOB % {'kernel_flavor': flavor, 'dtb_name': cls.dtb_name}
>
It does look nice to me.

>  You could add a comment in the function to state that the dtb is
>  optional, or better: expand the inline doc to state that dtb might be
>  None in the output:
> -        """Search for kernel, initrd and dtb in path."""
> +        """Search for kernel, initrd and optional dtb in path."""
>
Ok.

>  Don't set cls.dtb_name = cls.dtb_addr in this function; we don't change
>  class variables down there, and the values you set should already be
>  set if the definition is correct.
>
I need the setting of 'cls.dtb_name = cls.dtb_addr = None' to make
.dtb file optional. If _get_file_matching returns None, that means
the .dtb file is absent, and we need to set cls.dtb_name and
cls.dtb_addr None to let bootcmd(cls) and make_dtb bypass the .dtb
handling.

I do not think it's good to set class variables here either. But I
did not come up with any better idea to do that in the simple manner
as it is currently.

>  I don't understand the layout though: is it supposed to be
>  /boot/dt-something-2.6.38-1/mx51-babbage.dtb?
>
Yes, it's something like /boot/dt-2.6.38-1001-linaro-mx51/mx51-babbage.dtb

>  What are the possible values for "something" above?
>
The 'something' is the exactly same one in
vmlinuz-2.6.38-1001-linaro-mx51 and initrd.img-2.6.38-1001-linaro-mx51

>  Are these files provided directly by the kernel package?
>
Yes.

>  In make_dtb(), I don't really like the name of the file, but I can't
>  think of a better filename.  :-/
>
If you remember, I asked for suggestion on linaro-dev, but no one gave.

>  There are a couple gratuitous changes in the diff, but they seem
>  harmless:
>  * make_boot_files(): you move the _get_kflavor_files call one line up,
>   doesn't seem to matter

It actually matters. We have to set cls.dtb_name and cls.dtb_addr
None in case that .dtb is absent before bootcmd(cls) and make-dtb()
functions are called. These two functions will actually bypass the
.dtb handling when cls.dtb_name and cls.dtb_addr are set None in
_get_kflavor_files.

>  * in test_igep, switching from board_configs['igep'] to
>   boards.IgepConfig

Ah, r...

Read more...

Revision history for this message
Loïc Minier (lool) wrote :

On Wed, Apr 13, 2011, Shawn Guo wrote:
> Ok. I actually intended to do so, but the Preview Diff on review page
> squash all the commits, which led me thought that the separate is not
> important in Bzr. Clearly, I'm wrong here. So what is the benefit of
> doing this? Will all those separate commits show up on trunk with
> merge?

 I can still open the individual revisions from the review page and see
 each diff individually, or download the branch locally and diff the
 revisions myself or browse them with "bzr vis" or other GUIs.

 They stay as separate commits in the merged tree in the end too.

> >  I don't understand the layout though: is it supposed to be
> >  /boot/dt-something-2.6.38-1/mx51-babbage.dtb?
> >
> Yes, it's something like /boot/dt-2.6.38-1001-linaro-mx51/mx51-babbage.dtb
>
> >  What are the possible values for "something" above?
> >
> The 'something' is the exactly same one in
> vmlinuz-2.6.38-1001-linaro-mx51 and initrd.img-2.6.38-1001-linaro-mx51

 Oh sorry, I'm just being confused by myself; I had forgotten that
 kernel_flavor was lacking the kernel version; that's the reason for the
 first *-.

> >  In make_dtb(), I don't really like the name of the file, but I can't
> >  think of a better filename.  :-/
> If you remember, I asked for suggestion on linaro-dev, but no one gave.

 By any chance, did you find out how ppc does this?

> I need the setting of 'cls.dtb_name = cls.dtb_addr = None' to make
> .dtb file optional. If _get_file_matching returns None, that means
> the .dtb file is absent, and we need to set cls.dtb_name and
> cls.dtb_addr None to let bootcmd(cls) and make_dtb bypass the .dtb
> handling.
>
> I do not think it's good to set class variables here either. But I
> did not come up with any better idea to do that in the simple manner
> as it is currently.
[...]
> >  There are a couple gratuitous changes in the diff, but they seem
> >  harmless:
> >  * make_boot_files(): you move the _get_kflavor_files call one line up,
> >   doesn't seem to matter
>
> It actually matters. We have to set cls.dtb_name and cls.dtb_addr
> None in case that .dtb is absent before bootcmd(cls) and make-dtb()
> functions are called. These two functions will actually bypass the
> .dtb handling when cls.dtb_name and cls.dtb_addr are set None in
> _get_kflavor_files.

 Ok; I guess this means that optional dtb is a bit more work than I had
 hoped: it seems we need to pass the real dtb pathname down to bootcmd
 computation, so that cls.bootcmd can't be a @classproperty anymore but
 needs to be changed to a _get_boot_cmd() function. Fortunately, it's
 only used in one spot which already takes optional parameters like
 "is_live".

 For make_dtb, it should be a bit simpler; you can:
    if d_img_data is not None:
        make_dtb()
 or handle it in the make_dtb function itself (less occurrences, but a
 bit inconsistent with other make_*() functions' interfaces) -- I'm fine
 either way.

--
Loïc Minier

Revision history for this message
Shawn Guo (shawnguo) wrote :

On 13 April 2011 15:36, Loïc Minier <email address hidden> wrote:
> On Wed, Apr 13, 2011, Shawn Guo wrote:
[...]
>> >  In make_dtb(), I don't really like the name of the file, but I can't
>> >  think of a better filename.  :-/
>> If you remember, I asked for suggestion on linaro-dev, but no one gave.
>
>  By any chance, did you find out how ppc does this?
>

This is what I got from Grant.

--- quote begins ---
On Tue, Mar 29, 2011 at 11:03:25PM +0800, Shawn Guo wrote:
> Hi Grant,
>
> Do you happen to know where powerpc releases put dtb? If we could
> possibly align with existing approach, I would do.

They don't. All of the powerpc systems supported by packaged kernels
in the major distros use real OpenFirmware which provides the device
tree. For the embedded boards, most users are building and deploying
the kernel+dtb with their own solutions. We're very much in new
territory here.
--- quote ends ---

>> I need the setting of 'cls.dtb_name = cls.dtb_addr = None'  to make
>> .dtb file optional.  If _get_file_matching returns None, that means
>> the .dtb file is absent, and we need to set cls.dtb_name and
>> cls.dtb_addr None to let bootcmd(cls) and make_dtb bypass the .dtb
>> handling.
>>
>> I do not think it's good to set class variables here either.  But I
>> did not come up with any better idea to do that in the simple manner
>> as it is currently.
> [...]
>> >  There are a couple gratuitous changes in the diff, but they seem
>> >  harmless:
>> >  * make_boot_files(): you move the _get_kflavor_files call one line up,
>> >   doesn't seem to matter
>>
>> It actually matters.  We have to set cls.dtb_name and cls.dtb_addr
>> None in case that .dtb is absent before bootcmd(cls) and make-dtb()
>> functions are called.  These two functions will actually bypass the
>> .dtb handling when cls.dtb_name and cls.dtb_addr are set None in
>> _get_kflavor_files.
>
>  Ok; I guess this means that optional dtb is a bit more work than I had
>  hoped: it seems we need to pass the real dtb pathname down to bootcmd
>  computation, so that cls.bootcmd can't be a @classproperty anymore but
>  needs to be changed to a _get_boot_cmd() function.  Fortunately, it's
>  only used in one spot which already takes optional parameters like
>  "is_live".
>
>  For make_dtb, it should be a bit simpler; you can:
>    if d_img_data is not None:
>        make_dtb()
>  or handle it in the make_dtb function itself (less occurrences, but a
>  bit inconsistent with other make_*() functions' interfaces) -- I'm fine
>  either way.
>
Ok, so you think the current implementation is quick but dirty, and I
will try to implement what you suggest here.

--
Regards,
Shawn

321. By Shawn Guo

Improve _get_kflavor_files comment to state that dtb is optional

322. By Shawn Guo

Change DT_GLOB to DTB_GLOB to include dtb_name, so that the meaning
of 'dtb' and 'cls.dtb_name' in _get_kflavor_files can be clear.

323. By Shawn Guo

Change @classproperty bootcmd to @classmethod _get_bootcmd, and pass
full path name of .dtb file, so that we can get the correct bootcmd
with .dtb being optional.

324. By Shawn Guo

Fix lines longer than 80 characters introduced by dtb changes

Revision history for this message
Shawn Guo (shawnguo) wrote :

Hi Loic,

I just pushed revisions 321 ~ 324 to address your last round comments. Please review them. Thanks.

Regards,
Shawn

Revision history for this message
Loïc Minier (lool) 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-04-11 10:43:43 +0000
3+++ linaro_image_tools/media_create/boards.py 2011-04-15 07:31:40 +0000
4@@ -38,6 +38,7 @@
5
6 KERNEL_GLOB = 'vmlinuz-*-%(kernel_flavor)s'
7 INITRD_GLOB = 'initrd.img-*-%(kernel_flavor)s'
8+DTB_GLOB = 'dt-*-%(kernel_flavor)s/%(dtb_name)s'
9
10 # Notes:
11 # * since we align partitions on 4 MiB by default, geometry is currently 128
12@@ -153,6 +154,8 @@
13 kernel_addr = None
14 initrd_addr = None
15 load_addr = None
16+ dtb_addr = None
17+ dtb_name = None
18 kernel_flavors = None
19 boot_script = None
20 serial_tty = None
21@@ -246,20 +249,28 @@
22 system_start, _system_len, cache_start, cache_start, _cache_len,
23 userdata_start, _userdata_len, sdcard_start)
24
25- @classproperty
26- def bootcmd(cls):
27+ @classmethod
28+ def _get_bootcmd(cls, d_img_data):
29 """Get the bootcmd for this board.
30
31 In general subclasses should not have to override this.
32 """
33 replacements = dict(
34 mmc_option=cls.mmc_option, kernel_addr=cls.kernel_addr,
35- initrd_addr=cls.initrd_addr)
36- return (
37- "fatload mmc %(mmc_option)s %(kernel_addr)s "
38- "uImage; fatload mmc %(mmc_option)s %(initrd_addr)s uInitrd; "
39- "bootm %(kernel_addr)s %(initrd_addr)s"
40+ initrd_addr=cls.initrd_addr, dtb_addr=cls.dtb_addr)
41+ boot_script = (
42+ "fatload mmc %(mmc_option)s %(kernel_addr)s uImage; "
43+ "fatload mmc %(mmc_option)s %(initrd_addr)s uInitrd; "
44+ % replacements)
45+ if d_img_data is not None:
46+ boot_script += (
47+ "fatload mmc %(mmc_option)s %(dtb_addr)s board.dtb; "
48+ "bootm %(kernel_addr)s %(initrd_addr)s %(dtb_addr)s"
49 % replacements)
50+ else:
51+ boot_script += (
52+ "bootm %(kernel_addr)s %(initrd_addr)s" % replacements)
53+ return boot_script
54
55 @classmethod
56 def _get_bootargs(cls, is_live, is_lowmem, consoles, rootfs_uuid):
57@@ -292,7 +303,8 @@
58 % replacements)
59
60 @classmethod
61- def _get_boot_env(cls, is_live, is_lowmem, consoles, rootfs_uuid):
62+ def _get_boot_env(cls, is_live, is_lowmem, consoles, rootfs_uuid,
63+ d_img_data):
64 """Get the boot environment for this board.
65
66 In general subclasses should not have to override this.
67@@ -300,21 +312,24 @@
68 boot_env = {}
69 boot_env["bootargs"] = cls._get_bootargs(
70 is_live, is_lowmem, consoles, rootfs_uuid)
71- boot_env["bootcmd"] = cls.bootcmd
72+ boot_env["bootcmd"] = cls._get_bootcmd(d_img_data)
73 return boot_env
74
75 @classmethod
76 def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles,
77 chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file):
78- boot_env = cls._get_boot_env(is_live, is_lowmem, consoles, rootfs_uuid)
79- (k_img_data, i_img_data) = cls._get_kflavor_files(uboot_parts_dir)
80+ (k_img_data, i_img_data, d_img_data) = cls._get_kflavor_files(
81+ uboot_parts_dir)
82+ boot_env = cls._get_boot_env(is_live, is_lowmem, consoles, rootfs_uuid,
83+ d_img_data)
84 cls._make_boot_files(
85 boot_env, chroot_dir, boot_dir,
86- boot_device_or_file, k_img_data, i_img_data)
87+ boot_device_or_file, k_img_data, i_img_data, d_img_data)
88
89 @classmethod
90 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
91- boot_device_or_file, k_img_data, i_img_data):
92+ boot_device_or_file, k_img_data, i_img_data,
93+ d_img_data):
94 """Make the necessary boot files for this board.
95
96 This is usually board-specific so ought to be defined in every
97@@ -354,15 +369,20 @@
98
99 @classmethod
100 def _get_kflavor_files(cls, path):
101- """Search for kernel and initrd in path."""
102+ """Search for kernel, initrd and optional dtb in path."""
103 for flavor in cls.kernel_flavors:
104 kregex = KERNEL_GLOB % {'kernel_flavor' : flavor}
105 iregex = INITRD_GLOB % {'kernel_flavor' : flavor}
106+ dregex = DTB_GLOB % {'kernel_flavor' : flavor,
107+ 'dtb_name' : cls.dtb_name}
108 kernel = _get_file_matching(os.path.join(path, kregex))
109 if kernel is not None:
110 initrd = _get_file_matching(os.path.join(path, iregex))
111 if initrd is not None:
112- return (kernel, initrd)
113+ dtb = None
114+ if cls.dtb_name is not None:
115+ dtb = _get_file_matching(os.path.join(path, dregex))
116+ return (kernel, initrd, dtb)
117 raise ValueError(
118 "Found kernel for flavor %s but no initrd matching %s" % (
119 flavor, iregex))
120@@ -428,10 +448,12 @@
121
122 @classmethod
123 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
124- boot_device_or_file, k_img_data, i_img_data):
125+ boot_device_or_file, k_img_data, i_img_data,
126+ d_img_data):
127 install_omap_boot_loader(chroot_dir, boot_dir)
128 make_uImage(cls.load_addr, k_img_data, boot_dir)
129 make_uInitrd(i_img_data, boot_dir)
130+ make_dtb(d_img_data, boot_dir)
131 boot_script_path = os.path.join(boot_dir, cls.boot_script)
132 make_boot_script(boot_env, boot_script_path)
133 make_boot_ini(boot_script_path, boot_dir)
134@@ -439,10 +461,12 @@
135
136 class BeagleConfig(OmapConfig):
137 uboot_flavor = 'omap3_beagle'
138+ dtb_name = 'omap3-beagle.dtb'
139 _serial_tty = 'ttyO2'
140 _extra_serial_opts = 'console=tty0 console=%s,115200n8'
141 _live_serial_opts = 'serialtty=%s'
142 kernel_addr = '0x80000000'
143+ dtb_addr = '0x815f0000'
144 initrd_addr = '0x81600000'
145 load_addr = '0x80008000'
146 boot_script = 'boot.scr'
147@@ -453,9 +477,11 @@
148
149 class OveroConfig(OmapConfig):
150 uboot_flavor = 'omap3_overo'
151+ dtb_name = 'omap3-overo.dtb'
152 _serial_tty = 'ttyO2'
153 _extra_serial_opts = 'console=tty0 console=%s,115200n8'
154 kernel_addr = '0x80000000'
155+ dtb_addr = '0x815f0000'
156 initrd_addr = '0x81600000'
157 load_addr = '0x80008000'
158 boot_script = 'boot.scr'
159@@ -466,10 +492,12 @@
160
161 class PandaConfig(OmapConfig):
162 uboot_flavor = 'omap4_panda'
163+ dtb_name = 'omap4-panda.dtb'
164 _serial_tty = 'ttyO2'
165 _extra_serial_opts = 'console=tty0 console=%s,115200n8'
166 _live_serial_opts = 'serialtty=%s'
167 kernel_addr = '0x80200000'
168+ dtb_addr = '0x815f0000'
169 initrd_addr = '0x81600000'
170 load_addr = '0x80008000'
171 boot_script = 'boot.scr'
172@@ -481,12 +509,15 @@
173 class IgepConfig(BeagleConfig):
174 uboot_in_boot_part = False
175 uboot_flavor = None
176+ dtb_name = 'isee-igep-v2.dtb'
177
178 @classmethod
179 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
180- boot_device_or_file, k_img_data, i_img_data):
181+ boot_device_or_file, k_img_data, i_img_data,
182+ d_img_data):
183 make_uImage(cls.load_addr, k_img_data, boot_dir)
184 make_uInitrd(i_img_data, boot_dir)
185+ make_dtb(d_img_data, boot_dir)
186 boot_script_path = os.path.join(boot_dir, cls.boot_script)
187 make_boot_script(boot_env, boot_script_path)
188 make_boot_ini(boot_script_path, boot_dir)
189@@ -510,7 +541,8 @@
190
191 @classmethod
192 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
193- boot_device_or_file, k_img_data, i_img_data):
194+ boot_device_or_file, k_img_data, i_img_data,
195+ d_img_data):
196 make_uImage(cls.load_addr, k_img_data, boot_dir)
197 make_uInitrd(i_img_data, boot_dir)
198 boot_script_path = os.path.join(boot_dir, cls.boot_script)
199@@ -555,44 +587,52 @@
200
201 @classmethod
202 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
203- boot_device_or_file, k_img_data, i_img_data):
204+ boot_device_or_file, k_img_data, i_img_data,
205+ d_img_data):
206 uboot_file = os.path.join(
207 chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor, 'u-boot.imx')
208 install_mx5_boot_loader(uboot_file, boot_device_or_file)
209 make_uImage(cls.load_addr, k_img_data, boot_dir)
210 make_uInitrd(i_img_data, boot_dir)
211+ make_dtb(d_img_data, boot_dir)
212 boot_script_path = os.path.join(boot_dir, cls.boot_script)
213 make_boot_script(boot_env, boot_script_path)
214
215
216 class Mx51Config(Mx5Config):
217 kernel_addr = '0x90000000'
218+ dtb_addr = '0x91ff0000'
219 initrd_addr = '0x92000000'
220 load_addr = '0x90008000'
221 kernel_flavors = ['linaro-mx51', 'linaro-lt-mx5']
222
223
224 class Mx53Config(Mx5Config):
225- kernel_addr = '0x70800000'
226- initrd_addr = '0x71800000'
227+ kernel_addr = '0x70000000'
228+ dtb_addr = '0x71ff0000'
229+ initrd_addr = '0x72000000'
230 load_addr = '0x70008000'
231 kernel_flavors = ['linaro-lt-mx53', 'linaro-lt-mx5']
232
233
234 class EfikamxConfig(Mx51Config):
235 uboot_flavor = 'efikamx'
236+ dtb_name = 'genesi-efikamx.dtb'
237
238
239 class EfikasbConfig(Mx51Config):
240 uboot_flavor = 'efikasb'
241+ dtb_name = 'genesi-efikasb.dtb'
242
243
244 class Mx51evkConfig(Mx51Config):
245 uboot_flavor = 'mx51evk'
246+ dtb_name = 'mx51-babbage.dtb'
247
248
249 class Mx53LoCoConfig(Mx53Config):
250 uboot_flavor = 'mx53loco'
251+ dtb_name = 'mx53-loco.dtb'
252
253
254 class VexpressConfig(BoardConfig):
255@@ -612,7 +652,8 @@
256
257 @classmethod
258 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
259- boot_device_or_file, k_img_data, i_img_data):
260+ boot_device_or_file, k_img_data, i_img_data,
261+ d_img_data):
262 make_uImage(cls.load_addr, k_img_data, boot_dir)
263 make_uInitrd(i_img_data, boot_dir)
264
265@@ -654,9 +695,10 @@
266 loader_start, loader_len, boot_start, boot_len, root_start)
267
268 @classmethod
269- def _get_boot_env(cls, is_live, is_lowmem, consoles, rootfs_uuid):
270+ def _get_boot_env(cls, is_live, is_lowmem, consoles, rootfs_uuid,
271+ d_img_data):
272 boot_env = super(SMDKV310Config, cls)._get_boot_env(
273- is_live, is_lowmem, consoles, rootfs_uuid)
274+ is_live, is_lowmem, consoles, rootfs_uuid, d_img_data)
275
276 boot_env["ethact"] = "smc911x-0"
277 boot_env["ethaddr"] = "00:40:5c:26:0a:5b"
278@@ -673,7 +715,8 @@
279
280 @classmethod
281 def _make_boot_files(cls, boot_env, chroot_dir, boot_dir,
282- boot_device_or_file, k_img_data, i_img_data):
283+ boot_device_or_file, k_img_data, i_img_data,
284+ d_img_data):
285 uboot_file = os.path.join(
286 chroot_dir, 'usr', 'lib', 'u-boot', 'smdkv310', 'u-boot.v310')
287 install_smdkv310_boot_loader(uboot_file, boot_device_or_file)
288@@ -775,6 +818,14 @@
289 return img
290
291
292+def make_dtb(img_data, boot_disk):
293+ img = None
294+ if img_data is not None:
295+ img = '%s/board.dtb' % boot_disk
296+ cmd_runner.run(['cp', img_data, img], as_root=True).wait()
297+ return img
298+
299+
300 def make_boot_script(boot_env, boot_script_path):
301 boot_script_data = (
302 "setenv bootcmd '%(bootcmd)s'\n"
303
304=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
305--- linaro_image_tools/media_create/tests/test_media_create.py 2011-04-11 10:43:43 +0000
306+++ linaro_image_tools/media_create/tests/test_media_create.py 2011-04-15 07:31:40 +0000
307@@ -50,6 +50,7 @@
308 make_boot_script,
309 make_uImage,
310 make_uInitrd,
311+ make_dtb,
312 _get_file_matching,
313 _get_mlo_file,
314 _run_mkimage,
315@@ -176,7 +177,7 @@
316
317 def make_boot_files(self, config):
318 def _get_kflavor_files_mock(cls, path):
319- return (path, path)
320+ return (path, path, path)
321
322 self.useFixture(MockSomethingFixture(
323 config, '_get_kflavor_files',
324@@ -195,7 +196,7 @@
325 self.make_boot_files(SomeMx5Config)
326 expected = [
327 'install_mx5_boot_loader', 'make_uImage', 'make_uInitrd',
328- 'make_boot_script']
329+ 'make_dtb', 'make_boot_script']
330 self.assertEqual(expected, self.funcs_calls)
331
332 def test_smdkv310_steps(self):
333@@ -217,7 +218,7 @@
334 self.make_boot_files(boards.PandaConfig)
335 expected = [
336 'install_omap_boot_loader', 'make_uImage', 'make_uInitrd',
337- 'make_boot_script', 'make_boot_ini']
338+ 'make_dtb', 'make_boot_script', 'make_boot_ini']
339 self.assertEqual(expected, self.funcs_calls)
340
341 def test_beagle_steps(self):
342@@ -225,14 +226,14 @@
343 self.make_boot_files(boards.BeagleConfig)
344 expected = [
345 'install_omap_boot_loader', 'make_uImage', 'make_uInitrd',
346- 'make_boot_script', 'make_boot_ini']
347+ 'make_dtb', 'make_boot_script', 'make_boot_ini']
348 self.assertEqual(expected, self.funcs_calls)
349
350 def test_igep_steps(self):
351 self.mock_set_appropriate_serial_tty(boards.IgepConfig)
352 self.make_boot_files(boards.IgepConfig)
353 expected = [
354- 'make_uImage', 'make_uInitrd', 'make_boot_script',
355+ 'make_uImage', 'make_uInitrd', 'make_dtb', 'make_boot_script',
356 'make_boot_ini']
357 self.assertEqual(expected, self.funcs_calls)
358
359@@ -241,7 +242,7 @@
360 self.make_boot_files(boards.OveroConfig)
361 expected = [
362 'install_omap_boot_loader', 'make_uImage', 'make_uInitrd',
363- 'make_boot_script', 'make_boot_ini']
364+ 'make_dtb', 'make_boot_script', 'make_boot_ini']
365 self.assertEqual(expected, self.funcs_calls)
366
367
368@@ -340,7 +341,7 @@
369 def test_vexpress(self):
370 boot_commands = board_configs['vexpress']._get_boot_env(
371 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
372- rootfs_uuid="deadbeef")
373+ rootfs_uuid="deadbeef", d_img_data=None)
374 expected = {
375 'bootargs': 'console=tty0 console=ttyAMA0,38400n8 '
376 'console=ttyXXX root=UUID=deadbeef rootwait ro',
377@@ -352,19 +353,20 @@
378 def test_mx51(self):
379 boot_commands = boards.Mx51Config._get_boot_env(
380 is_live=False, is_lowmem=False, consoles=[],
381- rootfs_uuid="deadbeef")
382+ rootfs_uuid="deadbeef", d_img_data="mx51.dtb")
383 expected = {
384 'bootargs': 'console=tty0 console=ttymxc0,115200n8 '
385 'root=UUID=deadbeef rootwait ro',
386 'bootcmd': 'fatload mmc 0:2 0x90000000 uImage; '
387 'fatload mmc 0:2 0x92000000 uInitrd; '
388- 'bootm 0x90000000 0x92000000'}
389+ 'fatload mmc 0:2 0x91ff0000 board.dtb; '
390+ 'bootm 0x90000000 0x92000000 0x91ff0000'}
391 self.assertEqual(expected, boot_commands)
392
393 def test_smdkv310(self):
394 boot_commands = board_configs['smdkv310']._get_boot_env(
395 is_live=False, is_lowmem=False, consoles=[],
396- rootfs_uuid="deadbeef")
397+ rootfs_uuid="deadbeef", d_img_data="smdkv310.dtb")
398 expected = {
399 'bootargs': 'console=ttySAC1,115200n8 root=UUID=deadbeef '
400 'rootwait ro',
401@@ -378,7 +380,7 @@
402 def test_ux500(self):
403 boot_commands = board_configs['ux500']._get_boot_env(
404 is_live=False, is_lowmem=False, consoles=[],
405- rootfs_uuid="deadbeef")
406+ rootfs_uuid="deadbeef", d_img_data=None)
407 expected = {
408 'bootargs': 'console=tty0 console=ttyAMA2,115200n8 '
409 'root=UUID=deadbeef rootwait ro earlyprintk '
410@@ -399,7 +401,7 @@
411 config.serial_tty = config._serial_tty
412 boot_commands = config._get_boot_env(
413 is_live=False, is_lowmem=False, consoles=[],
414- rootfs_uuid="deadbeef")
415+ rootfs_uuid="deadbeef", d_img_data="panda.dtb")
416 expected = {
417 'bootargs': 'console=tty0 console=ttyO2,115200n8 '
418 'root=UUID=deadbeef rootwait ro earlyprintk fixrtc '
419@@ -407,7 +409,8 @@
420 'mem=456M@0x80000000 mem=512M@0xA0000000',
421 'bootcmd': 'fatload mmc 0:1 0x80200000 uImage; '
422 'fatload mmc 0:1 0x81600000 uInitrd; '
423- 'bootm 0x80200000 0x81600000'}
424+ 'fatload mmc 0:1 0x815f0000 board.dtb; '
425+ 'bootm 0x80200000 0x81600000 0x815f0000'}
426 self.assertEqual(expected, boot_commands)
427
428 def test_beagle(self):
429@@ -418,7 +421,7 @@
430 config.serial_tty = config._serial_tty
431 boot_commands = config._get_boot_env(
432 is_live=False, is_lowmem=False, consoles=[],
433- rootfs_uuid="deadbeef")
434+ rootfs_uuid="deadbeef", d_img_data="beagle.dtb")
435 expected = {
436 'bootargs': 'console=tty0 console=ttyO2,115200n8 '
437 'root=UUID=deadbeef rootwait ro earlyprintk fixrtc '
438@@ -426,18 +429,19 @@
439 'omapfb.mode=dvi:1280x720MR-16@60',
440 'bootcmd': 'fatload mmc 0:1 0x80000000 uImage; '
441 'fatload mmc 0:1 0x81600000 uInitrd; '
442- 'bootm 0x80000000 0x81600000'}
443+ 'fatload mmc 0:1 0x815f0000 board.dtb; '
444+ 'bootm 0x80000000 0x81600000 0x815f0000'}
445 self.assertEqual(expected, boot_commands)
446
447 def test_igep(self):
448 # XXX: To fix bug 697824 we have to change class attributes of our
449 # OMAP board configs, and some tests do that so to make sure they
450 # don't interfere with us we'll reset that before doing anything.
451- config = board_configs['igep']
452+ config = boards.IgepConfig
453 config.serial_tty = config._serial_tty
454 boot_cmd = config._get_boot_env(
455 is_live=False, is_lowmem=False, consoles=[],
456- rootfs_uuid="deadbeef")
457+ rootfs_uuid="deadbeef", d_img_data="igep.dtb")
458 expected = {
459 'bootargs': 'console=tty0 console=ttyO2,115200n8 '
460 'root=UUID=deadbeef rootwait ro earlyprintk fixrtc '
461@@ -445,7 +449,8 @@
462 'omapfb.mode=dvi:1280x720MR-16@60',
463 'bootcmd': 'fatload mmc 0:1 0x80000000 uImage; '
464 'fatload mmc 0:1 0x81600000 uInitrd; '
465- 'bootm 0x80000000 0x81600000'}
466+ 'fatload mmc 0:1 0x815f0000 board.dtb; '
467+ 'bootm 0x80000000 0x81600000 0x815f0000'}
468 self.assertEqual(expected, boot_cmd)
469
470 def test_overo(self):
471@@ -456,7 +461,7 @@
472 config.serial_tty = config._serial_tty
473 boot_commands = config._get_boot_env(
474 is_live=False, is_lowmem=False, consoles=[],
475- rootfs_uuid="deadbeef")
476+ rootfs_uuid="deadbeef", d_img_data="overo.dtb")
477 expected = {
478 'bootargs': 'console=tty0 console=ttyO2,115200n8 '
479 'root=UUID=deadbeef rootwait ro earlyprintk '
480@@ -465,7 +470,8 @@
481 'omapdss.def_disp=dvi',
482 'bootcmd': 'fatload mmc 0:1 0x80000000 uImage; '
483 'fatload mmc 0:1 0x81600000 uInitrd; '
484- 'bootm 0x80000000 0x81600000'}
485+ 'fatload mmc 0:1 0x815f0000 board.dtb; '
486+ 'bootm 0x80000000 0x81600000 0x815f0000'}
487 self.assertEqual(expected, boot_commands)
488
489
490@@ -542,6 +548,15 @@
491 'boot_disk/uInitrd' % sudo_args]
492 self.assertEqual(expected, fixture.mock.commands_executed)
493
494+ def test_make_dtb(self):
495+ self._mock_get_file_matching()
496+ fixture = self._mock_Popen()
497+ make_dtb('parts_dir/dt-*-sub_arch/board_name.dtb', 'boot_disk')
498+ expected = [
499+ '%s cp parts_dir/dt-*-sub_arch/board_name.dtb '
500+ 'boot_disk/board.dtb' % sudo_args]
501+ self.assertEqual(expected, fixture.mock.commands_executed)
502+
503 def test_make_flashable_env_too_small_env(self):
504 env = {'verylong': 'evenlonger'}
505 self.assertRaises(AssertionError, make_flashable_env, env, 8)
506@@ -627,7 +642,27 @@
507 ifile = os.path.join(tempdir, 'initrd.img-1-%s' % f)
508 open(kfile, "w").close()
509 open(ifile, "w").close()
510- self.assertEqual((kfile, ifile), config._get_kflavor_files(tempdir))
511+ self.assertEqual(
512+ (kfile, ifile, None), config._get_kflavor_files(tempdir))
513+
514+ def test_get_dt_kflavor_files_more_specific(self):
515+ tempdir = self.useFixture(CreateTempDirFixture()).tempdir
516+ flavorx = 'flavorX'
517+ flavorxy = 'flavorXY'
518+ class config(boards.BoardConfig):
519+ kernel_flavors = [flavorx, flavorxy]
520+ dtb_name = 'board_name.dtb'
521+ for f in reversed(config.kernel_flavors):
522+ kfile = os.path.join(tempdir, 'vmlinuz-1-%s' % f)
523+ ifile = os.path.join(tempdir, 'initrd.img-1-%s' % f)
524+ dt = os.path.join(tempdir, 'dt-1-%s' % f)
525+ os.mkdir(dt)
526+ dfile = os.path.join(dt, config.dtb_name)
527+ open(kfile, "w").close()
528+ open(ifile, "w").close()
529+ open(dfile, "w").close()
530+ self.assertEqual(
531+ (kfile, ifile, dfile), config._get_kflavor_files(tempdir))
532
533 def test_get_kflavor_files_later_in_flavors(self):
534 tempdir = self.useFixture(CreateTempDirFixture()).tempdir
535@@ -639,7 +674,26 @@
536 ifile = os.path.join(tempdir, 'initrd.img-1-%s' % flavor1)
537 open(kfile, "w").close()
538 open(ifile, "w").close()
539- self.assertEqual((kfile, ifile), config._get_kflavor_files(tempdir))
540+ self.assertEqual(
541+ (kfile, ifile, None), config._get_kflavor_files(tempdir))
542+
543+ def test_get_dt_kflavor_files_later_in_flavors(self):
544+ tempdir = self.useFixture(CreateTempDirFixture()).tempdir
545+ flavor1 = 'flavorXY'
546+ flavor2 = 'flavorAA'
547+ class config(boards.BoardConfig):
548+ kernel_flavors = [flavor1, flavor2]
549+ dtb_name = 'board_name.dtb'
550+ kfile = os.path.join(tempdir, 'vmlinuz-1-%s' % flavor1)
551+ ifile = os.path.join(tempdir, 'initrd.img-1-%s' % flavor1)
552+ dt = os.path.join(tempdir, 'dt-1-%s' % flavor1)
553+ os.mkdir(dt)
554+ dfile = os.path.join(dt, config.dtb_name)
555+ open(kfile, "w").close()
556+ open(ifile, "w").close()
557+ open(dfile, "w").close()
558+ self.assertEqual(
559+ (kfile, ifile, dfile), config._get_kflavor_files(tempdir))
560
561 def test_get_kflavor_files_raises_when_no_match(self):
562 tempdir = self.useFixture(CreateTempDirFixture()).tempdir

Subscribers

People subscribed via source and target branches