riscv: Partially move to binman to generate u-boot.itb
Subsystems (3)
cover riscv: Partially move to binman to generate u-boot.itb
This series updates binman to handle creation of u-boot.itb image for RISC-V SiFive Unleashed board.
QEMU RISC-V remains unchanged, as binman uses a dtb to describe the image format, but for QEMU RISC-V there is no dtb as dtb is passed to U-Boot via CONFIG_OF_PRIOR_STAGE.
Not sure how such use case could be properly supported by binman?
Bin Meng (9):
common: kconfig: Correct a typo in SPL_LOAD_FIT
binman: Correct '-a' description in the doc
binman: Correct the comment for ATF entry type
binman: test: Rename 172_fit_fdt.dts to 170_fit_fdt.dts
binman: test: Correct the name of 170_fit_fdt_missing_prop.dts
binman: Add support for RISC-V OpenSBI fw_dynamic blob
makefile: Update clean rule to remove files generated by binman
makefile: Pass OpenSBI blob to binman make rules
riscv: sifive: unleashed: Switch to use binman to generate u-boot.itb
.gitignore | 4 +-
Makefile | 6 +-
arch/riscv/dts/binman.dtsi | 70 +++++++++++++++++++
.../dts/hifive-unleashed-a00-u-boot.dtsi | 1 +
board/sifive/unleashed/Kconfig | 1 +
common/Kconfig.boot | 2 +-
configs/sifive_unleashed_defconfig | 1 +
tools/binman/binman.rst | 4 +-
tools/binman/entries.rst | 13 ++++
tools/binman/etype/atf_bl31.py | 2 +-
tools/binman/etype/opensbi.py | 23 ++++++
tools/binman/ftest.py | 17 +++--
.../test/{172_fit_fdt.dts => 170_fit_fdt.dts} | 0
tools/binman/test/201_opensbi.dts | 16 +++++
14 files changed, 148 insertions(+), 12 deletions(-)
create mode 100644 arch/riscv/dts/binman.dtsi
create mode 100644 tools/binman/etype/opensbi.py
rename tools/binman/test/{172_fit_fdt.dts => 170_fit_fdt.dts} (100%)
create mode 100644 tools/binman/test/201_opensbi.dtsSignature · 1 line
2.25.1
PATCH 1/9 common: kconfig: Correct a typo in SPL_LOAD_FIT
It should be FDT, not FTD.
---
common/Kconfig.boot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/Kconfig.boot +1 -1
@@ -204,7 +204,7 @@ config SPL_LOAD_FIT This path has the following limitations: - 1. "loadables" images, other than FTDs, which do not have a "load" + 1. "loadables" images, other than FDTs, which do not have a "load" property will not be loaded. This limitation also applies to FPGA images with the correct "compatible" string. 2. For FPGA images, only the "compatible" = "u-boot,fpga-legacy"
Signature · 1 line
2.25.1
PATCH 1/9 common: kconfig: Correct a typo in SPL_LOAD_FIT
Quoted 8 lines · Bin Meng
It should be FDT, not FTD.
Signed-off-by Bin Meng <[email protected]>---
common/Kconfig.boot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 2/9 binman: Correct '-a' description in the doc
In reply to Bin MengIt needs a space around '-a'.
---
tools/binman/binman.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/binman/binman.rst +2 -2
@@ -322,9 +322,9 @@ Sometimes it is useful to pass binman the value of an entry property from the command line. For example some entries need access to files and it is not always convenient to put these filenames in the image definition (device tree). -The-a option supports this:: +The -a option supports this:: - -a<prop>=<value> + -a <prop>=<value> where::
Signature · 1 line
2.25.1
PATCH 2/9 binman: Correct '-a' description in the doc
Quoted 8 lines · Bin Meng
It needs a space around '-a'.
Signed-off-by Bin Meng <[email protected]>---
tools/binman/binman.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH 3/9 binman: Correct the comment for ATF entry type
In reply to Bin MengThis is wrongly referring to Intel ME, which should be ATF.
---
tools/binman/etype/atf_bl31.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/etype/atf_bl31.py +1 -1
@@ -2,7 +2,7 @@ # Copyright 2020 Google LLC # Written by Simon Glass <[email protected]> # -# Entry-type module for Intel Management Engine binary blob +# Entry-type module for ARM Trusted Firmware binary blob # from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
Signature · 1 line
2.25.1
PATCH 3/9 binman: Correct the comment for ATF entry type
Quoted 8 lines · Bin Meng
This is wrongly referring to Intel ME, which should be ATF.
Signed-off-by Bin Meng <[email protected]>---
tools/binman/etype/atf_bl31.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 4/9 binman: test: Rename 172_fit_fdt.dts to 170_fit_fdt.dts
In reply to Bin MengCurrently there are 2 binman test cases using the same 172 number. It seems that 172_fit_fdt.dts was originally named as 170_, but commit c0f1ebe9c1b9 ("binman: Allow selecting default FIT configuration") changed its name to 172_ for no reason. Let's change it back.
---
tools/binman/ftest.py | 12 ++++++------
.../binman/test/{172_fit_fdt.dts => 170_fit_fdt.dts} | 0
2 files changed, 6 insertions(+), 6 deletions(-)
rename tools/binman/test/{172_fit_fdt.dts => 170_fit_fdt.dts} (100%)tools/binman/ftest.py +6 -6
@@ -3826,7 +3826,7 @@ class TestFunctional(unittest.TestCase): 'default-dt': 'test-fdt2', } data = self._DoReadFileDtb( - '172_fit_fdt.dts', + '170_fit_fdt.dts', entry_args=entry_args, extra_indirs=[os.path.join(self._indir, TEST_FDT_SUBDIR)])[0] self.assertEqual(U_BOOT_NODTB_DATA, data[-len(U_BOOT_NODTB_DATA):])
@@ -3848,7 +3848,7 @@ class TestFunctional(unittest.TestCase): def testFitFdtMissingList(self): """Test handling of a missing 'of-list' entry arg""" with self.assertRaises(ValueError) as e: - self._DoReadFile('172_fit_fdt.dts') + self._DoReadFile('170_fit_fdt.dts') self.assertIn("Generator node requires 'of-list' entry argument", str(e.exception))
@@ -3862,7 +3862,7 @@ class TestFunctional(unittest.TestCase): def testFitFdtMissingProp(self): """Test handling of a missing 'fit,fdt-list' property""" with self.assertRaises(ValueError) as e: - self._DoReadFile('171_fit_fdt_missing_prop.dts') + self._DoReadFile('170_fit_fdt_missing_prop.dts') self.assertIn("Generator node requires 'fit,fdt-list' property", str(e.exception))
@@ -3871,7 +3871,7 @@ class TestFunctional(unittest.TestCase): entry_args = { 'of-list': '', } - data = self._DoReadFileDtb('172_fit_fdt.dts', entry_args=entry_args)[0] + data = self._DoReadFileDtb('170_fit_fdt.dts', entry_args=entry_args)[0] def testFitFdtMissing(self): """Test handling of a missing 'default-dt' entry arg"""
@@ -3880,7 +3880,7 @@ class TestFunctional(unittest.TestCase): } with self.assertRaises(ValueError) as e: self._DoReadFileDtb( - '172_fit_fdt.dts', + '170_fit_fdt.dts', entry_args=entry_args, extra_indirs=[os.path.join(self._indir, TEST_FDT_SUBDIR)])[0] self.assertIn("Generated 'default' node requires default-dt entry argument",
@@ -3894,7 +3894,7 @@ class TestFunctional(unittest.TestCase): } with self.assertRaises(ValueError) as e: self._DoReadFileDtb( - '172_fit_fdt.dts', + '170_fit_fdt.dts', entry_args=entry_args, extra_indirs=[os.path.join(self._indir, TEST_FDT_SUBDIR)])[0] self.assertIn("default-dt entry argument 'test-fdt3' not found in fdt list: test-fdt1, test-fdt2",
tools/binman/test/170_fit_fdt.dts renamed from tools/binman/test/172_fit_fdt.dts +0 -0
Signature · 1 line
2.25.1
PATCH 4/9 binman: test: Rename 172_fit_fdt.dts to 170_fit_fdt.dts
Quoted 6 lines · Bin Meng
Currently there are 2 binman test cases using the same 172 number. It seems that
172_fit_fdt.dtswas originally named as 170_, but commitc0f1ebe9c1b9("binman: Allow selecting default FIT configuration") changed its name to 172_ for no reason. Let's change it back.
Quoted 7 lines
Signed-off-by Bin Meng <[email protected]>---
tools/binman/ftest.py | 12 ++++++------ .../binman/test/{172_fit_fdt.dts => 170_fit_fdt.dts} | 0 2 files changed, 6 insertions(+), 6 deletions(-) rename tools/binman/test/{172_fit_fdt.dts => 170_fit_fdt.dts} (100%)
PATCH 5/9 binman: test: Correct the name of 170_fit_fdt_missing_prop.dts
In reply to Bin MengIt should be 171_fit_fdt_missing_prop.dts.
---
tools/binman/ftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/ftest.py +1 -1
@@ -3862,7 +3862,7 @@ class TestFunctional(unittest.TestCase): def testFitFdtMissingProp(self): """Test handling of a missing 'fit,fdt-list' property""" with self.assertRaises(ValueError) as e: - self._DoReadFile('170_fit_fdt_missing_prop.dts') + self._DoReadFile('171_fit_fdt_missing_prop.dts') self.assertIn("Generator node requires 'fit,fdt-list' property", str(e.exception))
Signature · 1 line
2.25.1
PATCH 5/9 binman: test: Correct the name of 170_fit_fdt_missing_prop.dts
Hi Bin,
Quoted 8 lines · Bin Meng
It should be
171_fit_fdt_missing_prop.dts.Signed-off-by Bin Meng <[email protected]>---
tools/binman/ftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Are you sure you are on upstream/master? Which commit?
CI should stop errors like this. I don't see it in my tree.
tools/binman/ftest.py class TestFunctional(unittest.TestCase): · line 3867
Quoted 13 lines
tools/binman/ftest.py +1
-1@@ -3862,7 +3862,7 @@ class TestFunctional(unittest.TestCase): def testFitFdtMissingProp(self): """Test handling of a missing 'fit,fdt-list' property""" with self.assertRaises(ValueError) as e: - self._DoReadFile('170_fit_fdt_missing_prop.dts') + self._DoReadFile('171_fit_fdt_missing_prop.dts') self.assertIn("Generator node requires 'fit,fdt-list' property", str(e.exception))
Regards,
Simon
PATCH 6/9 binman: Add support for RISC-V OpenSBI fw_dynamic blob
In reply to Bin MengAdd an entry for RISC-V OpenSBI's 'fw_dynamic' firmware payload.
---
tools/binman/entries.rst | 13 +++++++++++++ tools/binman/etype/opensbi.py | 23 +++++++++++++++++++++++ tools/binman/ftest.py | 7 +++++++ tools/binman/test/201_opensbi.dts | 16 ++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 tools/binman/etype/opensbi.py create mode 100644 tools/binman/test/201_opensbi.dts
tools/binman/entries.rst +13 -0
@@ -761,6 +761,19 @@ binman. +Entry: opensbi: RISC-V OpenSBI fw_dynamic blob +---------------------------------------------- + +Properties / Entry arguments: + - opensbi-path: Filename of file to read into entry. This is typically + called fw_dynamic.bin + +This entry holds the run-time firmware, typically started by U-Boot SPL. +See the U-Boot README for your architecture or board for how to use it. See +https://github.com/riscv/opensbi for more information about OpenSBI. + + + Entry: powerpc-mpc85xx-bootpg-resetvec: PowerPC mpc85xx bootpg + resetvec code for U-Boot -----------------------------------------------------------------------------------------
tools/binman/etype/opensbi.py new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2021, Bin Meng <[email protected]> +# +# Entry-type module for RISC-V OpenSBI binary blob +# + +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg + +class Entry_opensbi(Entry_blob_named_by_arg): + """RISC-V OpenSBI fw_dynamic blob + + Properties / Entry arguments: + - opensbi-path: Filename of file to read into entry. This is typically + called fw_dynamic.bin + + This entry holds the run-time firmware, typically started by U-Boot SPL. + See the U-Boot README for your architecture or board for how to use it. See + https://github.com/riscv/opensbi for more information about OpenSBI. + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node, 'opensbi') + self.external = True
tools/binman/ftest.py +7 -0
@@ -76,6 +76,7 @@ FSP_M_DATA = b'fsp_m' FSP_S_DATA = b'fsp_s' FSP_T_DATA = b'fsp_t' ATF_BL31_DATA = b'bl31' +OPENSBI_DATA = b'opensbi' SCP_DATA = b'scp' TEST_FDT1_DATA = b'fdt1' TEST_FDT2_DATA = b'test-fdt2'
@@ -178,6 +179,7 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('compress', COMPRESS_DATA) TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG) TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA) + TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA) TestFunctional._MakeInputFile('scp.bin', SCP_DATA) # Add a few .dtb files for testing
@@ -4535,5 +4537,10 @@ class TestFunctional(unittest.TestCase): expected += tools.GetBytes(0, 88 - len(expected)) + U_BOOT_NODTB_DATA self.assertEqual(expected, data) + def testPackOpenSBI(self): + """Test that an image with an OpenSBI binary can be created""" + data = self._DoReadFile('201_opensbi.dts') + self.assertEqual(OPENSBI_DATA, data[:len(OPENSBI_DATA)]) + if __name__ == "__main__": unittest.main()
tools/binman/test/201_opensbi.dts new file +16 -0
@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + opensbi { + filename = "fw_dynamic.bin"; + }; + }; +};
Signature · 1 line
2.25.1
PATCH 6/9 binman: Add support for RISC-V OpenSBI fw_dynamic blob
Hi Bin,
Quoted 6 lines · Bin Meng
Add an entry for RISC-V OpenSBI's '
fw_dynamic' firmware payload.Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
tools/binman/entries.rst | 13 +++++++++++++ tools/binman/etype/opensbi.py | 23 +++++++++++++++++++++++ tools/binman/ftest.py | 7 +++++++ tools/binman/test/201_opensbi.dts | 16 ++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 tools/binman/etype/opensbi.py create mode 100644 tools/binman/test/201_opensbi.dts
Is it possible to use a default filename for this, instead of having to specify it?
Quoted 91 lines
tools/binman/entries.rst +13
-0@@ -761,6 +761,19 @@ binman. +Entry: opensbi: RISC-V OpenSBI fw_dynamic blob +---------------------------------------------- + +Properties / Entry arguments: + - opensbi-path: Filename of file to read into entry. This is typically + called fw_dynamic.bin + +This entry holds the run-time firmware, typically started by U-Boot SPL. +See the U-Boot README for your architecture or board for how to use it. See +https://github.com/riscv/opensbi for more information about OpenSBI. + + + Entry: powerpc-mpc85xx-bootpg-resetvec: PowerPC mpc85xx bootpg + resetvec code for U-Boot -----------------------------------------------------------------------------------------tools/binman/etype/opensbi.py new file +23
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2021, Bin Meng <[email protected]> +# +# Entry-type module for RISC-V OpenSBI binary blob +# + +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg + +class Entry_opensbi(Entry_blob_named_by_arg): + """RISC-V OpenSBI fw_dynamic blob + + Properties / Entry arguments: + - opensbi-path: Filename of file to read into entry. This is typically + called fw_dynamic.bin + + This entry holds the run-time firmware, typically started by U-Boot SPL. + See the U-Boot README for your architecture or board for how to use it. See + https://github.com/riscv/opensbi for more information about OpenSBI. + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node, 'opensbi') + self.external = Truetools/binman/ftest.py +7
-0@@ -76,6 +76,7 @@ FSP_M_DATA = b'fsp_m' FSP_S_DATA = b'fsp_s' FSP_T_DATA = b'fsp_t' ATF_BL31_DATA = b'bl31' +OPENSBI_DATA = b'opensbi' SCP_DATA = b'scp' TEST_FDT1_DATA = b'fdt1' TEST_FDT2_DATA = b'test-fdt2'@@ -178,6 +179,7 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('compress', COMPRESS_DATA) TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG) TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA) + TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA) TestFunctional._MakeInputFile('scp.bin', SCP_DATA) # Add a few .dtb files for testing@@ -4535,5 +4537,10 @@ class TestFunctional(unittest.TestCase): expected += tools.GetBytes(0, 88 - len(expected)) + U_BOOT_NODTB_DATA self.assertEqual(expected, data) + def testPackOpenSBI(self): + """Test that an image with an OpenSBI binary can be created""" + data = self._DoReadFile('201_opensbi.dts') + self.assertEqual(OPENSBI_DATA, data[:len(OPENSBI_DATA)]) + if __name__ == "__main__": unittest.main()tools/binman/test/201_opensbi.dts new file +0
-0
tools/binman/test/201_opensbi.dts line 10
Quoted 10 lines
tools/binman/test/201_opensbi.dts new file +10
-0@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>;
Can you drop that?
Quoted 9 lines
tools/binman/test/201_opensbi.dts new file +6
-1+ + opensbi { + filename = "fw_dynamic.bin"; + }; + }; +}; --2.25.1
Regards,
Simon
PATCH 6/9 binman: Add support for RISC-V OpenSBI fw_dynamic blob
Hi Simon,
Quoted 18 lines · Simon Glass
Hi Bin,
Quoted 6 lines · Bin Meng
Add an entry for RISC-V OpenSBI's '
fw_dynamic' firmware payload.Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
tools/binman/entries.rst | 13 +++++++++++++ tools/binman/etype/opensbi.py | 23 +++++++++++++++++++++++ tools/binman/ftest.py | 7 +++++++ tools/binman/test/201_opensbi.dts | 16 ++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 tools/binman/etype/opensbi.py create mode 100644 tools/binman/test/201_opensbi.dts
Quoted 2 lines
Is it possible to use a default filename for this, instead of having to specify it?
I don't get what you meant. Would you please clarify?
Regards,
Bin
PATCH 6/9 binman: Add support for RISC-V OpenSBI fw_dynamic blob
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Simon,
Quoted 18 lines · Simon Glass
Hi Bin,
Quoted 13 lines · Bin Meng
Add an entry for RISC-V OpenSBI's '
fw_dynamic' firmware payload.Signed-off-by Bin Meng <[email protected]>---
tools/binman/entries.rst | 13 +++++++++++++ tools/binman/etype/opensbi.py | 23 +++++++++++++++++++++++ tools/binman/ftest.py | 7 +++++++ tools/binman/test/201_opensbi.dts | 16 ++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 tools/binman/etype/opensbi.py create mode 100644 tools/binman/test/201_opensbi.dts
Quoted 4 lines
Quoted 2 lines
Is it possible to use a default filename for this, instead of having to specify it?
I don't get what you meant. Would you please clarify?
I mean adding a GetDefaultFilename() argument. But I see that you are using a -a parameter, so perhaps there is no point.
Regards,
Simon
PATCH 7/9 makefile: Update clean rule to remove files generated by binman
In reply to Bin MengWhen using binman to generate an FIT image, these intermediate files "*.fit.fit" and "*.fit.itb" are generated from mkimage, which should be cleaned, and git ignored.
While we are here, clean the map file generated by "binman -m" as well.
---
.gitignore | 4 +++- Makefile | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)
.gitignore +3 -1
@@ -40,10 +40,12 @@ fit-dtb.blob* /MLO* /SPL* -/System.map /u-boot* /boards.cfg +/*.fit.fit +/*.fit.itb /*.log +/*.map # # git files that we don't want to ignore even it they are dot-files
Makefile +3 -2
@@ -1998,9 +1998,10 @@ CLEAN_DIRS += $(MODVERDIR) \ $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \ - boot* u-boot* MLO* SPL System.map fit-dtb.blob* \ + boot* u-boot* MLO* SPL *.map fit-dtb.blob* \ u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \ - lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \ + lpc32xx-* bl31.c bl31.elf bl31_*.bin tispl.bin* \ + *.fit.fit *.fit.itb \ idbloader.img flash.bin flash.log defconfig # Directories & files removed with 'make mrproper'
Signature · 1 line
2.25.1
PATCH 7/9 makefile: Update clean rule to remove files generated by binman
Hi Bin,
Quoted 5 lines · Bin Meng
When using binman to generate an FIT image, these intermediate files "*.fit.fit" and "*.fit.itb" are generated from mkimage, which should be cleaned, and git ignored.
Quoted 8 lines
While we are here, clean the map file generated by "binman -m" as well.
Signed-off-by Bin Meng <[email protected]>---
.gitignore | 4 +++- Makefile | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)
The thing is, binman can emit a lot of files and this is just some of them. We need a way to handle this in general.
Options I can think of:
- put intermedia files in a subdir
- have a way to ask binman to list the files it would have generated for any particular board, and 'rm' them in the Makefile
- have binman write out a list of generated files into something like binman.lst and remove those files
Regards,
Simon
PATCH 7/9 makefile: Update clean rule to remove files generated by binman
Hi Simon,
Quoted 21 lines · Simon Glass
Hi Bin,
Quoted 5 lines · Bin Meng
When using binman to generate an FIT image, these intermediate files "*.fit.fit" and "*.fit.itb" are generated from mkimage, which should be cleaned, and git ignored.
Quoted 8 lines
While we are here, clean the map file generated by "binman -m" as well.
Signed-off-by Bin Meng <[email protected]>---
.gitignore | 4 +++- Makefile | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)The thing is, binman can emit a lot of files and this is just some of them. We need a way to handle this in general.
Quoted 7 lines
Options I can think of:
- put intermedia files in a subdir
- have a way to ask binman to list the files it would have generated for any particular board, and 'rm' them in theMakefile
- have binman write out a list of generated files into something like binman.lst and remove those files
For binman generated files, these are options we can look at. But I am not sure if the same applies to mkimage generated ones? Is it worth changing in this series?
Regards,
Bin
PATCH 7/9 makefile: Update clean rule to remove files generated by binman
Hi Bin,
Quoted 33 lines · Bin Meng
Hi Simon,
Quoted 21 lines · Simon Glass
Hi Bin,
Quoted 5 lines · Bin Meng
When using binman to generate an FIT image, these intermediate files "*.fit.fit" and "*.fit.itb" are generated from mkimage, which should be cleaned, and git ignored.
Quoted 8 lines
While we are here, clean the map file generated by "binman -m" as well.
Signed-off-by Bin Meng <[email protected]>---
.gitignore | 4 +++- Makefile | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)The thing is, binman can emit a lot of files and this is just some of them. We need a way to handle this in general.
Quoted 7 lines
Options I can think of:
- put intermedia files in a subdir
- have a way to ask binman to list the files it would have generated for any particular board, and 'rm' them in theMakefile
- have binman write out a list of generated files into something like binman.lst and remove those files
Quoted 3 lines
For binman generated files, these are options we can look at. But I am not sure if the same applies to mkimage generated ones? Is it worth changing in this series?
But isn't mkimage invoked by binman?
I think this patch is best skipped if we cannot solve the problem fully. We can return to it another time perhaps.
Regards,
Simon
PATCH 8/9 makefile: Pass OpenSBI blob to binman make rules
In reply to Bin MengThis updates the make rules to pass OpenSBI blob to binman.
---
Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -1287,6 +1287,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \ -I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \ -a atf-bl31-path=${BL31} \ + -a opensbi-path=${OPENSBI} \ -a default-dt=$(default_dt) \ -a scp-path=$(SCP) \ -a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \
Signature · 1 line
2.25.1
PATCH 8/9 makefile: Pass OpenSBI blob to binman make rules
Quoted 8 lines · Bin Meng
This updates the make rules to pass OpenSBI blob to binman.
Signed-off-by Bin Meng <[email protected]>---
Makefile | 1 + 1 file changed, 1 insertion(+)
I suppose at some point we should separate this into a variable that we add to throughout the Makefile and then use $(foreach ) to add the -a flag to each one.
PATCH 9/9 riscv: sifive: unleashed: Switch to use binman to generate u-boot.itb
In reply to Bin MengAt present SiFive Unleashed board uses the Makefile to create the FIT, using USE_SPL_FIT_GENERATOR, which is deprecated as per the Makefile warning. Update to use binman instead.
---
arch/riscv/dts/binman.dtsi | 70 +++++++++++++++++++ .../dts/hifive-unleashed-a00-u-boot.dtsi | 1 + board/sifive/unleashed/Kconfig | 1 + configs/sifive_unleashed_defconfig | 1 + 4 files changed, 73 insertions(+) create mode 100644 arch/riscv/dts/binman.dtsi
arch/riscv/dts/binman.dtsi new file +70 -0
@@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2021, Bin Meng <[email protected]> + */ + +#include <config.h> + +/ { + binman: binman { + multiple-images; + }; +}; + +&binman { + itb { + filename = "u-boot.itb"; + + fit { + description = "Configuration to load OpenSBI before U-Boot"; + #address-cells = <1>; + fit,fdt-list = "of-list"; + + images { + uboot { + description = "U-Boot"; + type = "standalone"; + os = "U-Boot"; + arch = "riscv"; + compression = "none"; + load = <CONFIG_SYS_TEXT_BASE>; + + uboot_blob: blob-ext { + filename = "u-boot-nodtb.bin"; + }; + }; + + opensbi { + description = "OpenSBI fw_dynamic Firmware"; + type = "firmware"; + os = "opensbi"; + arch = "riscv"; + compression = "none"; + load = <CONFIG_SPL_OPENSBI_LOAD_ADDR>; + entry = <CONFIG_SPL_OPENSBI_LOAD_ADDR>; + + opensbi_blob: blob-ext { + filename = "fw_dynamic.bin"; + }; + }; + + @fdt-SEQ { + description = "NAME"; + type = "flat_dt"; + compression = "none"; + }; + }; + + configurations { + default = "conf-1"; + + @conf-SEQ { + description = "NAME"; + firmware = "opensbi"; + loadables = "uboot"; + fdt = "fdt-SEQ"; + }; + }; + }; + }; +};
arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi +1 -0
@@ -3,6 +3,7 @@ * Copyright (C) 2019 Jagan Teki <[email protected]> */ +#include "binman.dtsi" #include "fu540-c000-u-boot.dtsi" #include "fu540-hifive-unleashed-a00-ddr.dtsi"
board/sifive/unleashed/Kconfig +1 -0
@@ -27,6 +27,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy def_bool y select SIFIVE_FU540 select ENV_IS_IN_SPI_FLASH + select BINMAN if !USE_SPL_FIT_GENERATOR imply CMD_DHCP imply CMD_EXT2 imply CMD_EXT4
configs/sifive_unleashed_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_RISCV_SMODE=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x84000000 +# CONFIG_USE_SPL_FIT_GENERATOR is not set CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y CONFIG_MISC_INIT_R=y
Signature · 1 line
2.25.1
PATCH 9/9 riscv: sifive: unleashed: Switch to use binman to generate u-boot.itb
Quoted 7 lines · Bin Meng
At present SiFive Unleashed board uses the
Makefileto create the FIT, usingUSE_SPL_FIT_GENERATOR, which is deprecated as per theMakefilewarning. Update to use binman instead.Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/riscv/dts/binman.dtsi | 70 +++++++++++++++++++ .../dts/hifive-unleashed-a00-u-boot.dtsi | 1 + board/sifive/unleashed/Kconfig | 1 + configs/sifive_unleashed_defconfig | 1 + 4 files changed, 73 insertions(+) create mode 100644 arch/riscv/dts/binman.dtsi
Is it possible to migrate all the boards so as not to leave two paths in use?
cover riscv: Partially move to binman to generate u-boot.itb
In reply to Bin MengHi Bin,
Quoted 7 lines · Bin Meng
This series updates binman to handle creation of u-boot.itb image for RISC-V SiFive Unleashed board.
QEMU RISC-V remains unchanged, as binman uses a dtb to describe the image format, but for QEMU RISC-V there is no dtb as dtb is passed to U-Boot via
CONFIG_OF_PRIOR_STAGE.
That's odd. What software is providing the DTB? Not SPL?
Quoted 2 lines
Not sure how such use case could be properly supported by binman?
Perhaps by adding a .dts file in U-Boot, or making it available manually in some hacky way.
Regards,
Simon
cover riscv: Partially move to binman to generate u-boot.itb
Hi Simon,
Quoted 5 lines · Simon Glass
Hi Bin,
Quoted 1 line · Bin Meng
Quoted 8 lines
Quoted 6 lines
This series updates binman to handle creation of u-boot.itb image for RISC-V SiFive Unleashed board.
QEMU RISC-V remains unchanged, as binman uses a dtb to describe the image format, but for QEMU RISC-V there is no dtb as dtb is passed to U-Boot via
CONFIG_OF_PRIOR_STAGE.That's odd. What software is providing the DTB? Not SPL?
QEMU itself creates DTB on the fly, based on command parameters passed to QEMU. The DTB address will be passed to U-Boot by QEMU.
Quoted 5 lines
Quoted 2 lines
Not sure how such use case could be properly supported by binman?
Perhaps by adding a .dts file in U-Boot, or making it available manually in some hacky way.
I will see if I can do some hacky way :( Not sure if it brings any improvements compared to current CONFIG_SPL_FIT_GENERATOR scripts.
Regards,
Bin
cover riscv: Partially move to binman to generate u-boot.itb
Hi Bin,
Quoted 12 lines · Bin Meng
Hi Simon,
Quoted 8 lines · Simon Glass
Hi Bin,
Quoted 4 lines · Bin Meng
This series updates binman to handle creation of u-boot.itb image for RISC-V SiFive Unleashed board.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
QEMU RISC-V remains unchanged, as binman uses a dtb to describe the image format, but for QEMU RISC-V there is no dtb as dtb is passed to U-Boot via
CONFIG_OF_PRIOR_STAGE.That's odd. What software is providing the DTB? Not SPL?
QEMU itself creates DTB on the fly, based on command parameters passed to QEMU. The DTB address will be passed to U-Boot by QEMU.
OK. So the canonical DTB is in qemu? Then I think we need at least something in the U-Boot tree too, as you have done.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Not sure how such use case could be properly supported by binman?
Perhaps by adding a .dts file in U-Boot, or making it available manually in some hacky way.
I will see if I can do some hacky way :( Not sure if it brings any improvements compared to current
CONFIG_SPL_FIT_GENERATORscripts.
We should drop these scripts and use binman, as your patch does.
Regards,
Simon