diff mbox series

[RFC,1/4] mkimage: add a flag to describe whether -A is specified

Message ID 20210617184621.4083311-2-icenowy@aosc.io
State RFC
Delegated to: Andre Przywara
Headers show
Series mkimage: sunxi_egon: add riscv support | expand

Commit Message

Icenowy Zheng June 17, 2021, 6:46 p.m. UTC
The sunxi_egon type used to take no -A argument (because we assume sunxi
targets are all ARM). However, as Allwinner D1 appears as the first
RISC-V sunxi target, we need to support -A; in addition, as external
projects rely on U-Boot mkimage to generate sunxi eGON.BT0 header, we
need to keep compatibility with command line without -A.

As the default value of arch in mkimage is not proper (IH_ARCH_PPC
instead of IH_ARCH_INVALID), to keep more compatibility, add an Aflag
field to image parameters to describe whether an architecture is
explicitly specified.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 tools/imagetool.h | 1 +
 tools/mkimage.c   | 1 +
 2 files changed, 2 insertions(+)

Comments

Tom Rini June 18, 2021, 4:38 p.m. UTC | #1
On Fri, Jun 18, 2021 at 02:46:18AM +0800, Icenowy Zheng wrote:

> The sunxi_egon type used to take no -A argument (because we assume sunxi
> targets are all ARM). However, as Allwinner D1 appears as the first
> RISC-V sunxi target, we need to support -A; in addition, as external
> projects rely on U-Boot mkimage to generate sunxi eGON.BT0 header, we
> need to keep compatibility with command line without -A.
> 
> As the default value of arch in mkimage is not proper (IH_ARCH_PPC
> instead of IH_ARCH_INVALID), to keep more compatibility, add an Aflag
> field to image parameters to describe whether an architecture is
> explicitly specified.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>

Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass June 26, 2021, 6:31 p.m. UTC | #2
Hi Icenowy,

On Thu, 17 Jun 2021 at 12:47, Icenowy Zheng <icenowy@aosc.io> wrote:
>
> The sunxi_egon type used to take no -A argument (because we assume sunxi
> targets are all ARM). However, as Allwinner D1 appears as the first
> RISC-V sunxi target, we need to support -A; in addition, as external
> projects rely on U-Boot mkimage to generate sunxi eGON.BT0 header, we
> need to keep compatibility with command line without -A.
>
> As the default value of arch in mkimage is not proper (IH_ARCH_PPC
> instead of IH_ARCH_INVALID), to keep more compatibility, add an Aflag
> field to image parameters to describe whether an architecture is
> explicitly specified.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  tools/imagetool.h | 1 +
>  tools/mkimage.c   | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/tools/imagetool.h b/tools/imagetool.h
> index e229a34ffc..5dc28312c2 100644
> --- a/tools/imagetool.h
> +++ b/tools/imagetool.h
> @@ -51,6 +51,7 @@ struct image_tool_params {
>         int pflag;
>         int vflag;
>         int xflag;
> +       int Aflag;

aflag

>         int skipcpy;
>         int os;
>         int arch;
> diff --git a/tools/mkimage.c b/tools/mkimage.c
> index cc7b242faf..54d8e3835a 100644
> --- a/tools/mkimage.c
> +++ b/tools/mkimage.c
> @@ -168,6 +168,7 @@ static void process_args(int argc, char **argv)
>                                 show_valid_options(IH_ARCH);
>                                 usage("Invalid architecture");
>                         }
> +                       params.Aflag = 1;
>                         break;
>                 case 'b':
>                         if (add_content(IH_TYPE_FLATDT, optarg)) {
> --
> 2.30.2

Regards,
Simon
diff mbox series

Patch

diff --git a/tools/imagetool.h b/tools/imagetool.h
index e229a34ffc..5dc28312c2 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -51,6 +51,7 @@  struct image_tool_params {
 	int pflag;
 	int vflag;
 	int xflag;
+	int Aflag;
 	int skipcpy;
 	int os;
 	int arch;
diff --git a/tools/mkimage.c b/tools/mkimage.c
index cc7b242faf..54d8e3835a 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -168,6 +168,7 @@  static void process_args(int argc, char **argv)
 				show_valid_options(IH_ARCH);
 				usage("Invalid architecture");
 			}
+			params.Aflag = 1;
 			break;
 		case 'b':
 			if (add_content(IH_TYPE_FLATDT, optarg)) {