* [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0
@ 2020-07-12 23:08 Ahmad Fatoum
2020-07-12 23:08 ` [PATCH 2/3] fixup! ARM: add imx6 based Protonic boads Ahmad Fatoum
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-07-12 23:08 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
When data.header_gap == 0, like on i.MX6, we seek to the start of the
file after writing the barebox header there and proceed to overwrite
it again.
Therefore we can no longer detect the filetype and affected images
can't be booted/flashed directly on < i.MX8 anymore. Fix this up:
- on i.MX8, there is nothing at the start, so it's ok to write there
- on i.MX6, we overwrite buf[0..sizeof_bb_header-1], but that's the way
it was before
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/imx/imx-image.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 64be682417e0..de04962b09d1 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -978,10 +978,7 @@ int main(int argc, char *argv[])
}
if (data.cpu_type == IMX_CPU_IMX35) {
- xwrite(outfd, add_barebox_header ? bb_header : buf,
- sizeof_bb_header);
- xwrite(outfd, buf + sizeof_bb_header,
- header_len - sizeof_bb_header);
+ xwrite(outfd, buf, header_len);
xwrite(outfd, buf, header_len);
} else {
if (add_barebox_header &&
@@ -990,9 +987,6 @@ int main(int argc, char *argv[])
exit(1);
}
- xwrite(outfd, add_barebox_header ? bb_header : buf,
- sizeof_bb_header);
-
if (lseek(outfd, data.header_gap, SEEK_SET) < 0) {
perror("lseek");
exit(1);
@@ -1001,6 +995,9 @@ int main(int argc, char *argv[])
xwrite(outfd, buf, header_len);
}
+ if (add_barebox_header)
+ pwrite(outfd, bb_header, sizeof_bb_header, 0);
+
xwrite(outfd, infile, insize);
/* pad until next 4k boundary */
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] fixup! ARM: add imx6 based Protonic boads
2020-07-12 23:08 [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0 Ahmad Fatoum
@ 2020-07-12 23:08 ` Ahmad Fatoum
2020-07-12 23:08 ` [PATCH 3/3] scripts: imx-image: throw descriptive error on encountering dcdofs Ahmad Fatoum
2020-07-14 18:20 ` [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0 Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-07-12 23:08 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
dcdofs was renamed to ivtofs meanwhile, which causes the build to fail.
Fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
| 2 +-
15 files changed, 15 insertions(+), 15 deletions(-)
--git a/arch/arm/boards/protonic-imx6/flash-header-alti6p.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-alti6p.imxcfg
index a73857cae9e9..c778391d7576 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-alti6p.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-alti6p.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-lanmcu.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-lanmcu.imxcfg
index d926cecc5f71..b08e14983454 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-lanmcu.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-lanmcu.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-plybas.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-plybas.imxcfg
index d91b38cc2ddb..dbbb9818b645 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-plybas.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-plybas.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-plym2m.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-plym2m.imxcfg
index d91b38cc2ddb..dbbb9818b645 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-plym2m.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-plym2m.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-prti6g.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-prti6g.imxcfg
index f58b0181eae0..ec9fb8410834 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-prti6g.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-prti6g.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x80000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
#include "padsetup-ul.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-prti6q.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-prti6q.imxcfg
index 8b7c9ea3b018..68b7909f82fd 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-prti6q.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-prti6q.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-prtmvt.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-prtmvt.imxcfg
index caffae26c772..1131174f70a6 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-prtmvt.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-prtmvt.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-prtrvt.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-prtrvt.imxcfg
index d91b38cc2ddb..dbbb9818b645 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-prtrvt.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-prtrvt.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-prtvt7.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-prtvt7.imxcfg
index c548d5f78e71..019696295de5 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-prtvt7.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-prtvt7.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-prtwd2.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-prtwd2.imxcfg
index 4e38ae42854c..5f847c004dce 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-prtwd2.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-prtwd2.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "lpddr2-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-prtwd3.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-prtwd3.imxcfg
index f7ad652cc16a..054043cc800e 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-prtwd3.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-prtwd3.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "lpddr2-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-victgo.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-victgo.imxcfg
index 55aa0594312b..d3de7b6aab4f 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-victgo.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-victgo.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-vicut1.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-vicut1.imxcfg
index 7ebb52c2ab80..9926fbf4a292 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-vicut1.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-vicut1.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-vicut1q.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-vicut1q.imxcfg
index fdc328d892ef..a73a2c6fd007 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-vicut1q.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-vicut1q.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--git a/arch/arm/boards/protonic-imx6/flash-header-vicutp.imxcfg b/arch/arm/boards/protonic-imx6/flash-header-vicutp.imxcfg
index 3ca21f683a2a..13887ade0b45 100644
--- a/arch/arm/boards/protonic-imx6/flash-header-vicutp.imxcfg
+++ b/arch/arm/boards/protonic-imx6/flash-header-vicutp.imxcfg
@@ -1,6 +1,6 @@
soc imx6
loadaddr 0x10000000
-dcdofs 0x400
+ivtofs 0x400
#include "ddr3-defines.imxcfg"
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] scripts: imx-image: throw descriptive error on encountering dcdofs
2020-07-12 23:08 [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0 Ahmad Fatoum
2020-07-12 23:08 ` [PATCH 2/3] fixup! ARM: add imx6 based Protonic boads Ahmad Fatoum
@ 2020-07-12 23:08 ` Ahmad Fatoum
2020-07-14 18:20 ` [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0 Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-07-12 23:08 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
With dcdofs renamed to ivtofs, out-of-tree boards will start to fail.
Make the migration easier by suggesting what needs to be changed on
stderr.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/imx/imx.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c
index 4d2f65af9bc8..1fb3922fcf34 100644
--- a/scripts/imx/imx.c
+++ b/scripts/imx/imx.c
@@ -221,6 +221,12 @@ static int do_ivt_offset(struct config_data *data, int argc, char *argv[])
return 0;
}
+static int do_dcdofs_error(struct config_data *data, int argc, char *argv[])
+{
+ fprintf(stderr, "ERROR: misnomer dcdofs has been renamed to ivtofs. imxcfg must be adapted.\n");
+ return -EINVAL;
+}
+
struct soc_type {
char *name;
int header_version;
@@ -588,6 +594,9 @@ struct command cmds[] = {
}, {
.name = "ivtofs",
.parse = do_ivt_offset,
+ }, {
+ .name = "dcdofs",
+ .parse = do_dcdofs_error,
}, {
.name = "soc",
.parse = do_soc,
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0
2020-07-12 23:08 [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0 Ahmad Fatoum
2020-07-12 23:08 ` [PATCH 2/3] fixup! ARM: add imx6 based Protonic boads Ahmad Fatoum
2020-07-12 23:08 ` [PATCH 3/3] scripts: imx-image: throw descriptive error on encountering dcdofs Ahmad Fatoum
@ 2020-07-14 18:20 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2020-07-14 18:20 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Jul 13, 2020 at 01:08:12AM +0200, Ahmad Fatoum wrote:
> When data.header_gap == 0, like on i.MX6, we seek to the start of the
> file after writing the barebox header there and proceed to overwrite
> it again.
>
> Therefore we can no longer detect the filetype and affected images
> can't be booted/flashed directly on < i.MX8 anymore. Fix this up:
>
> - on i.MX8, there is nothing at the start, so it's ok to write there
> - on i.MX6, we overwrite buf[0..sizeof_bb_header-1], but that's the way
> it was before
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> scripts/imx/imx-image.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
> index 64be682417e0..de04962b09d1 100644
> --- a/scripts/imx/imx-image.c
> +++ b/scripts/imx/imx-image.c
> @@ -978,10 +978,7 @@ int main(int argc, char *argv[])
> }
>
> if (data.cpu_type == IMX_CPU_IMX35) {
> - xwrite(outfd, add_barebox_header ? bb_header : buf,
> - sizeof_bb_header);
> - xwrite(outfd, buf + sizeof_bb_header,
> - header_len - sizeof_bb_header);
> + xwrite(outfd, buf, header_len);
> xwrite(outfd, buf, header_len);
> } else {
> if (add_barebox_header &&
> @@ -990,9 +987,6 @@ int main(int argc, char *argv[])
> exit(1);
> }
>
> - xwrite(outfd, add_barebox_header ? bb_header : buf,
> - sizeof_bb_header);
> -
> if (lseek(outfd, data.header_gap, SEEK_SET) < 0) {
> perror("lseek");
> exit(1);
> @@ -1001,6 +995,9 @@ int main(int argc, char *argv[])
> xwrite(outfd, buf, header_len);
> }
>
> + if (add_barebox_header)
> + pwrite(outfd, bb_header, sizeof_bb_header, 0);
> +
> xwrite(outfd, infile, insize);
>
> /* pad until next 4k boundary */
> --
> 2.27.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-14 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12 23:08 [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0 Ahmad Fatoum
2020-07-12 23:08 ` [PATCH 2/3] fixup! ARM: add imx6 based Protonic boads Ahmad Fatoum
2020-07-12 23:08 ` [PATCH 3/3] scripts: imx-image: throw descriptive error on encountering dcdofs Ahmad Fatoum
2020-07-14 18:20 ` [PATCH 1/3] fixup! scripts: imx-image: Fix writing image with IVT offset = 0 Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox