mbox series

[0/5] Use Android DT image format for TI boards

Message ID 20180416203227.26523-1-semen.protsenko@linaro.org
Headers show
Series Use Android DT image format for TI boards | expand

Message

Sam Protsenko April 16, 2018, 8:32 p.m. UTC
Android documentation recommends using new image format for storing dtb
and dtbo files: [1]. Using that format, we can pack several dtb files to
dtb.img, and also pack several dtbo files to dtbo.img. Then those images
should be flashed to eMMC partitions, called "dtb" and "dtbo"
respectively.

This patch series introduces support for mentioned Android DT image
format, adds "dtimg" command to deal with that image format from U-Boot
shell, and provides new Android boot scheme to TI boards (AM57x and DRA7
boards). So with this patch series we will have next procedure for
Android boot:
 1. Read next images from eMMC partitions to RAM:
    - boot.img
    - dtb.img
    - dtbo.img
 2. Take addresses of desired dtb/dtbo files from that images (for
    current board)
 3. Apply dtbo overlays to main dtb, if needed
 4. Boot the kernel from Android boot image, using resulting dtb

It was tested on X15 and AM57x EVM boards.

[1] https://source.android.com/devices/architecture/dto/partitions

Sam Protsenko (5):
  common: Add support for Android DT image
  cmd: Add dtimg command
  arm: ti: boot: Extract PARTS_DEFAULT to boot.h
  arm: ti: boot: Add dtbo partition for Android boot
  arm: ti: boot: Implement Android boot using DT image format

 board/ti/common/Kconfig           |   1 +
 cmd/Kconfig                       |   8 ++
 cmd/Makefile                      |   1 +
 cmd/dtimg.c                       | 142 ++++++++++++++++++++++++++++++
 common/Makefile                   |   4 +
 common/image-android-dt.c         | 134 ++++++++++++++++++++++++++++
 configs/am57xx_evm_defconfig      |   1 +
 configs/am57xx_hs_evm_defconfig   |   1 +
 configs/dra7xx_evm_defconfig      |   1 +
 configs/dra7xx_hs_evm_defconfig   |   1 +
 include/configs/am57xx_evm.h      |  25 ------
 include/configs/cl-som-am57x.h    |   2 +
 include/configs/cm_t54.h          |   2 +
 include/configs/dra7xx_evm.h      |  25 ------
 include/configs/ti_armv7_common.h |   1 +
 include/dt_table.h                |  46 ++++++++++
 include/environment/ti/boot.h     |  68 ++++++++++++--
 include/image-android-dt.h        |  18 ++++
 18 files changed, 422 insertions(+), 59 deletions(-)
 create mode 100644 cmd/dtimg.c
 create mode 100644 common/image-android-dt.c
 create mode 100644 include/dt_table.h
 create mode 100644 include/image-android-dt.h

Comments

Andrew Davis April 17, 2018, 8:57 p.m. UTC | #1
On 04/16/2018 03:32 PM, Sam Protsenko wrote:
> Android documentation recommends using new image format for storing dtb
> and dtbo files: [1]. Using that format, we can pack several dtb files to
> dtb.img, and also pack several dtbo files to dtbo.img. Then those images
> should be flashed to eMMC partitions, called "dtb" and "dtbo"
> respectively.
> 


I'm not convinced adding yet another one-off Android specific partition
format is what we need right now. With FIT images this is a solved
problem, why does Android need to go down a different path here?


> This patch series introduces support for mentioned Android DT image
> format, adds "dtimg" command to deal with that image format from U-Boot
> shell, and provides new Android boot scheme to TI boards (AM57x and DRA7
> boards). So with this patch series we will have next procedure for
> Android boot:
>  1. Read next images from eMMC partitions to RAM:
>     - boot.img
>     - dtb.img
>     - dtbo.img
>  2. Take addresses of desired dtb/dtbo files from that images (for
>     current board)
>  3. Apply dtbo overlays to main dtb, if needed
>  4. Boot the kernel from Android boot image, using resulting dtb
> 


All the above logic ends up adding more to our environment scripting at
a time when we are working to reduce that..

Andrew


> It was tested on X15 and AM57x EVM boards.
> 
> [1] https://source.android.com/devices/architecture/dto/partitions
> 
> Sam Protsenko (5):
>   common: Add support for Android DT image
>   cmd: Add dtimg command
>   arm: ti: boot: Extract PARTS_DEFAULT to boot.h
>   arm: ti: boot: Add dtbo partition for Android boot
>   arm: ti: boot: Implement Android boot using DT image format
> 
>  board/ti/common/Kconfig           |   1 +
>  cmd/Kconfig                       |   8 ++
>  cmd/Makefile                      |   1 +
>  cmd/dtimg.c                       | 142 ++++++++++++++++++++++++++++++
>  common/Makefile                   |   4 +
>  common/image-android-dt.c         | 134 ++++++++++++++++++++++++++++
>  configs/am57xx_evm_defconfig      |   1 +
>  configs/am57xx_hs_evm_defconfig   |   1 +
>  configs/dra7xx_evm_defconfig      |   1 +
>  configs/dra7xx_hs_evm_defconfig   |   1 +
>  include/configs/am57xx_evm.h      |  25 ------
>  include/configs/cl-som-am57x.h    |   2 +
>  include/configs/cm_t54.h          |   2 +
>  include/configs/dra7xx_evm.h      |  25 ------
>  include/configs/ti_armv7_common.h |   1 +
>  include/dt_table.h                |  46 ++++++++++
>  include/environment/ti/boot.h     |  68 ++++++++++++--
>  include/image-android-dt.h        |  18 ++++
>  18 files changed, 422 insertions(+), 59 deletions(-)
>  create mode 100644 cmd/dtimg.c
>  create mode 100644 common/image-android-dt.c
>  create mode 100644 include/dt_table.h
>  create mode 100644 include/image-android-dt.h
>
Sam Protsenko April 19, 2018, 8:22 p.m. UTC | #2
On 17 April 2018 at 23:57, Andrew F. Davis <afd@ti.com> wrote:
> On 04/16/2018 03:32 PM, Sam Protsenko wrote:
>> Android documentation recommends using new image format for storing dtb
>> and dtbo files: [1]. Using that format, we can pack several dtb files to
>> dtb.img, and also pack several dtbo files to dtbo.img. Then those images
>> should be flashed to eMMC partitions, called "dtb" and "dtbo"
>> respectively.
>>
>
>
> I'm not convinced adding yet another one-off Android specific partition
> format is what we need right now. With FIT images this is a solved
> problem, why does Android need to go down a different path here?
>

We are already in discussion with Google engineers regarding that
question. Both approaches (FIT and Android DT) work fine. This is just
a policy question: if Google doesn't mind us using FIT, we can go with
FIT. Otherwise we are forced to go with Android DT image format.
That's why we decided to implement DT image support: to have it
functional and upstreamed in a case if Google tells us it's mandatory.

>
>> This patch series introduces support for mentioned Android DT image
>> format, adds "dtimg" command to deal with that image format from U-Boot
>> shell, and provides new Android boot scheme to TI boards (AM57x and DRA7
>> boards). So with this patch series we will have next procedure for
>> Android boot:
>>  1. Read next images from eMMC partitions to RAM:
>>     - boot.img
>>     - dtb.img
>>     - dtbo.img
>>  2. Take addresses of desired dtb/dtbo files from that images (for
>>     current board)
>>  3. Apply dtbo overlays to main dtb, if needed
>>  4. Boot the kernel from Android boot image, using resulting dtb
>>
>
>
> All the above logic ends up adding more to our environment scripting at
> a time when we are working to reduce that..
>

Frankly, I don't see a better solution here. Adding another separate
command to do Android boot just for TI case won't be accepted in
upstream obviously, because we already have bootm command for this. If
you see a better way of doing that (in upstream, of course, without
any hacks) -- please advice. Otherwise we will go with this one, in
case Google responds it's mandatory.

> Andrew
>
>
>> It was tested on X15 and AM57x EVM boards.
>>
>> [1] https://source.android.com/devices/architecture/dto/partitions
>>
>> Sam Protsenko (5):
>>   common: Add support for Android DT image
>>   cmd: Add dtimg command
>>   arm: ti: boot: Extract PARTS_DEFAULT to boot.h
>>   arm: ti: boot: Add dtbo partition for Android boot
>>   arm: ti: boot: Implement Android boot using DT image format
>>
>>  board/ti/common/Kconfig           |   1 +
>>  cmd/Kconfig                       |   8 ++
>>  cmd/Makefile                      |   1 +
>>  cmd/dtimg.c                       | 142 ++++++++++++++++++++++++++++++
>>  common/Makefile                   |   4 +
>>  common/image-android-dt.c         | 134 ++++++++++++++++++++++++++++
>>  configs/am57xx_evm_defconfig      |   1 +
>>  configs/am57xx_hs_evm_defconfig   |   1 +
>>  configs/dra7xx_evm_defconfig      |   1 +
>>  configs/dra7xx_hs_evm_defconfig   |   1 +
>>  include/configs/am57xx_evm.h      |  25 ------
>>  include/configs/cl-som-am57x.h    |   2 +
>>  include/configs/cm_t54.h          |   2 +
>>  include/configs/dra7xx_evm.h      |  25 ------
>>  include/configs/ti_armv7_common.h |   1 +
>>  include/dt_table.h                |  46 ++++++++++
>>  include/environment/ti/boot.h     |  68 ++++++++++++--
>>  include/image-android-dt.h        |  18 ++++
>>  18 files changed, 422 insertions(+), 59 deletions(-)
>>  create mode 100644 cmd/dtimg.c
>>  create mode 100644 common/image-android-dt.c
>>  create mode 100644 include/dt_table.h
>>  create mode 100644 include/image-android-dt.h
>>
Sam Protsenko April 19, 2018, 8:23 p.m. UTC | #3
On 16 April 2018 at 23:32, Sam Protsenko <semen.protsenko@linaro.org> wrote:
> Android documentation recommends using new image format for storing dtb
> and dtbo files: [1]. Using that format, we can pack several dtb files to
> dtb.img, and also pack several dtbo files to dtbo.img. Then those images
> should be flashed to eMMC partitions, called "dtb" and "dtbo"
> respectively.
>
> This patch series introduces support for mentioned Android DT image
> format, adds "dtimg" command to deal with that image format from U-Boot
> shell, and provides new Android boot scheme to TI boards (AM57x and DRA7
> boards). So with this patch series we will have next procedure for
> Android boot:
>  1. Read next images from eMMC partitions to RAM:
>     - boot.img
>     - dtb.img
>     - dtbo.img
>  2. Take addresses of desired dtb/dtbo files from that images (for
>     current board)
>  3. Apply dtbo overlays to main dtb, if needed
>  4. Boot the kernel from Android boot image, using resulting dtb
>
> It was tested on X15 and AM57x EVM boards.
>
> [1] https://source.android.com/devices/architecture/dto/partitions
>
> Sam Protsenko (5):
>   common: Add support for Android DT image
>   cmd: Add dtimg command
>   arm: ti: boot: Extract PARTS_DEFAULT to boot.h
>   arm: ti: boot: Add dtbo partition for Android boot
>   arm: ti: boot: Implement Android boot using DT image format
>
>  board/ti/common/Kconfig           |   1 +
>  cmd/Kconfig                       |   8 ++
>  cmd/Makefile                      |   1 +
>  cmd/dtimg.c                       | 142 ++++++++++++++++++++++++++++++
>  common/Makefile                   |   4 +
>  common/image-android-dt.c         | 134 ++++++++++++++++++++++++++++
>  configs/am57xx_evm_defconfig      |   1 +
>  configs/am57xx_hs_evm_defconfig   |   1 +
>  configs/dra7xx_evm_defconfig      |   1 +
>  configs/dra7xx_hs_evm_defconfig   |   1 +
>  include/configs/am57xx_evm.h      |  25 ------
>  include/configs/cl-som-am57x.h    |   2 +
>  include/configs/cm_t54.h          |   2 +
>  include/configs/dra7xx_evm.h      |  25 ------
>  include/configs/ti_armv7_common.h |   1 +
>  include/dt_table.h                |  46 ++++++++++
>  include/environment/ti/boot.h     |  68 ++++++++++++--
>  include/image-android-dt.h        |  18 ++++
>  18 files changed, 422 insertions(+), 59 deletions(-)
>  create mode 100644 cmd/dtimg.c
>  create mode 100644 common/image-android-dt.c
>  create mode 100644 include/dt_table.h
>  create mode 100644 include/image-android-dt.h
>
> --
> 2.17.0
>

Abandon this change. I'm going to send v2 soon.
Simon Glass April 22, 2018, 8:12 p.m. UTC | #4
Hi,

On 17 April 2018 at 14:57, Andrew F. Davis <afd@ti.com> wrote:
> On 04/16/2018 03:32 PM, Sam Protsenko wrote:
>> Android documentation recommends using new image format for storing dtb
>> and dtbo files: [1]. Using that format, we can pack several dtb files to
>> dtb.img, and also pack several dtbo files to dtbo.img. Then those images
>> should be flashed to eMMC partitions, called "dtb" and "dtbo"
>> respectively.
>>
>
>
> I'm not convinced adding yet another one-off Android specific partition
> format is what we need right now. With FIT images this is a solved
> problem, why does Android need to go down a different path here?

Agreed.

Regards,
Simon