* [PATCH 1/2] gen-dtb-s: support x86 and other platforms with 16-bit .word
@ 2020-10-05 8:28 Ahmad Fatoum
2020-10-05 8:28 ` [PATCH 2/2] sandbox: compile in a fallback device tree Ahmad Fatoum
0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2020-10-05 8:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
On ARM, .word is 32-bit as expected in the script, but on x86 it's
16-bit, which leads to truncation.
.int on the other hand is 32-bit both on ARM and x86 and very likely
all other platforms we support, so change the .word to .int.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/gen-dtb-s | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index 0649247f934d..4f8c62a0b84c 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -62,9 +62,9 @@ echo ".section .dtbz.rodata.${name},\"a\""
echo ".balign STRUCT_ALIGNMENT"
echo ".global __dtb_z_${name}_start"
echo "__dtb_z_${name}_start:"
-printf ".word 0x%08x\n" 0x7b66bcbd
-printf ".word 0x%08x\n" $compressed
-printf ".word 0x%08x\n" $uncompressed
+printf ".int 0x%08x\n" 0x7b66bcbd
+printf ".int 0x%08x\n" $compressed
+printf ".int 0x%08x\n" $uncompressed
echo ".incbin \"$dtb.lzo\""
echo "__dtb_z_${name}_end:"
echo ".global __dtb_z_${name}_end"
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] sandbox: compile in a fallback device tree
2020-10-05 8:28 [PATCH 1/2] gen-dtb-s: support x86 and other platforms with 16-bit .word Ahmad Fatoum
@ 2020-10-05 8:28 ` Ahmad Fatoum
2020-10-07 8:14 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2020-10-05 8:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The sandbox architecture is device tree only and so far when no --dtb
was passed, it created a basic one itself and used that.
Instead of creating the default device tree in C, just build the dtb
into barebox like we do on other platforms.
When --dtb is specified, that device tree will be used instead.
This results in functional change: Model and hostname are now more
accurate.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/sandbox/board/devices.c | 3 ---
arch/sandbox/board/dtb.c | 18 +++++-------------
arch/sandbox/dts/Makefile | 4 ++--
arch/sandbox/dts/sandbox.dts | 3 ++-
4 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/arch/sandbox/board/devices.c b/arch/sandbox/board/devices.c
index 1fd1913ae60f..26152a8b90a0 100644
--- a/arch/sandbox/board/devices.c
+++ b/arch/sandbox/board/devices.c
@@ -26,9 +26,6 @@ static int sandbox_device_init(void)
{
struct device_d *dev, *tmp;
- barebox_set_model("barebox sandbox");
- barebox_set_hostname("barebox");
-
list_for_each_entry_safe(dev, tmp, &sandbox_device_list, list) {
/* reset the list_head before registering for real */
dev->list.prev = NULL;
diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c
index da2452199273..fc8793dbe038 100644
--- a/arch/sandbox/board/dtb.c
+++ b/arch/sandbox/board/dtb.c
@@ -32,24 +32,16 @@ int barebox_register_dtb(const void *new_dtb)
return 0;
}
+extern char __dtb_sandbox_start[];
+
static int of_sandbox_init(void)
{
struct device_node *root;
- int ret;
-
- if (dtb) {
- root = of_unflatten_dtb(dtb);
- } else {
- root = of_new_node(NULL, NULL);
- ret = of_property_write_u32(root, "#address-cells", 2);
- if (ret)
- return ret;
+ if (!dtb)
+ dtb = __dtb_sandbox_start;
- ret = of_property_write_u32(root, "#size-cells", 2);
- if (ret)
- return ret;
- }
+ root = of_unflatten_dtb(dtb);
if (IS_ERR(root))
return PTR_ERR(root);
diff --git a/arch/sandbox/dts/Makefile b/arch/sandbox/dts/Makefile
index 6f4344da68b4..c8d83141ceab 100644
--- a/arch/sandbox/dts/Makefile
+++ b/arch/sandbox/dts/Makefile
@@ -1,5 +1,5 @@
-always-$(CONFIG_OFTREE) += \
- sandbox.dtb
+obj-$(CONFIG_OFTREE) += \
+ sandbox.dtb.o
# just to build a built-in.o. Otherwise compilation fails when no devicetree is
# created.
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index 2595aa13fa62..4576e873d9cb 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -3,5 +3,6 @@
#include "skeleton.dtsi"
/ {
-
+ model = "Sandbox";
+ compatible = "barebox,sandbox";
};
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] sandbox: compile in a fallback device tree
2020-10-05 8:28 ` [PATCH 2/2] sandbox: compile in a fallback device tree Ahmad Fatoum
@ 2020-10-07 8:14 ` Sascha Hauer
2020-10-07 17:22 ` Ahmad Fatoum
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2020-10-07 8:14 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Oct 05, 2020 at 10:28:35AM +0200, Ahmad Fatoum wrote:
> The sandbox architecture is device tree only and so far when no --dtb
> was passed, it created a basic one itself and used that.
> Instead of creating the default device tree in C, just build the dtb
> into barebox like we do on other platforms.
>
> When --dtb is specified, that device tree will be used instead.
> This results in functional change: Model and hostname are now more
> accurate.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/sandbox/board/devices.c | 3 ---
> arch/sandbox/board/dtb.c | 18 +++++-------------
> arch/sandbox/dts/Makefile | 4 ++--
> arch/sandbox/dts/sandbox.dts | 3 ++-
> 4 files changed, 9 insertions(+), 19 deletions(-)
>
> diff --git a/arch/sandbox/board/devices.c b/arch/sandbox/board/devices.c
> index 1fd1913ae60f..26152a8b90a0 100644
> --- a/arch/sandbox/board/devices.c
> +++ b/arch/sandbox/board/devices.c
> @@ -26,9 +26,6 @@ static int sandbox_device_init(void)
> {
> struct device_d *dev, *tmp;
>
> - barebox_set_model("barebox sandbox");
> - barebox_set_hostname("barebox");
> -
> list_for_each_entry_safe(dev, tmp, &sandbox_device_list, list) {
> /* reset the list_head before registering for real */
> dev->list.prev = NULL;
> diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c
> index da2452199273..fc8793dbe038 100644
> --- a/arch/sandbox/board/dtb.c
> +++ b/arch/sandbox/board/dtb.c
> @@ -32,24 +32,16 @@ int barebox_register_dtb(const void *new_dtb)
> return 0;
> }
>
> +extern char __dtb_sandbox_start[];
> +
> static int of_sandbox_init(void)
> {
> struct device_node *root;
> - int ret;
> -
> - if (dtb) {
> - root = of_unflatten_dtb(dtb);
> - } else {
> - root = of_new_node(NULL, NULL);
>
> - ret = of_property_write_u32(root, "#address-cells", 2);
> - if (ret)
> - return ret;
> + if (!dtb)
> + dtb = __dtb_sandbox_start;
>
> - ret = of_property_write_u32(root, "#size-cells", 2);
> - if (ret)
> - return ret;
> - }
> + root = of_unflatten_dtb(dtb);
>
> if (IS_ERR(root))
> return PTR_ERR(root);
This is a nice change as it allows us to use the newly created
barebox_register_fdt() for sandbox as well. I squashed this into this
patch.
Sascha
--
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] 5+ messages in thread
* Re: [PATCH 2/2] sandbox: compile in a fallback device tree
2020-10-07 8:14 ` Sascha Hauer
@ 2020-10-07 17:22 ` Ahmad Fatoum
2020-10-08 6:33 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2020-10-07 17:22 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hello Sascha,
On 10/7/20 10:14 AM, Sascha Hauer wrote:
> On Mon, Oct 05, 2020 at 10:28:35AM +0200, Ahmad Fatoum wrote:
>> + root = of_unflatten_dtb(dtb);
>>
>> if (IS_ERR(root))
>> return PTR_ERR(root);
>
> This is a nice change as it allows us to use the newly created
> barebox_register_fdt() for sandbox as well. I squashed this into this
> patch.
Patch 01/02 didn't wasn't it upstream. This is required for building
sandbox on x86 now. Can you order it before the 2nd patch?
Thanks,
Ahmad
--
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] 5+ messages in thread
* Re: [PATCH 2/2] sandbox: compile in a fallback device tree
2020-10-07 17:22 ` Ahmad Fatoum
@ 2020-10-08 6:33 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-10-08 6:33 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Wed, Oct 07, 2020 at 07:22:58PM +0200, Ahmad Fatoum wrote:
> Hello Sascha,
>
> On 10/7/20 10:14 AM, Sascha Hauer wrote:
> > On Mon, Oct 05, 2020 at 10:28:35AM +0200, Ahmad Fatoum wrote:
> >> + root = of_unflatten_dtb(dtb);
> >>
> >> if (IS_ERR(root))
> >> return PTR_ERR(root);
> >
> > This is a nice change as it allows us to use the newly created
> > barebox_register_fdt() for sandbox as well. I squashed this into this
> > patch.
>
> Patch 01/02 didn't wasn't it upstream. This is required for building
> sandbox on x86 now. Can you order it before the 2nd patch?
Just did that.
Sascha
--
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] 5+ messages in thread
end of thread, other threads:[~2020-10-08 6:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 8:28 [PATCH 1/2] gen-dtb-s: support x86 and other platforms with 16-bit .word Ahmad Fatoum
2020-10-05 8:28 ` [PATCH 2/2] sandbox: compile in a fallback device tree Ahmad Fatoum
2020-10-07 8:14 ` Sascha Hauer
2020-10-07 17:22 ` Ahmad Fatoum
2020-10-08 6:33 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox