Skip to contentSkip to conversation

sandbox: Introduce Kconfig option for 32/64 bit host

PATCH New Bin Meng 3 participants 12 messages Aug 1, 2017 – Sep 12, 2017

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/2 sandbox: Introduce Kconfig option for 32/64 bit host

It seems most of the time we are building and running sandbox on 64-bit host. But we do support 32-bit host as well. Introduce Kconfig option for this.

---

 arch/sandbox/Kconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/sandbox/Kconfig +17 -0
index f7a6e1a..7b07bff 100644
@@ -18,4 +18,21 @@ config SYS_CONFIG_NAME
 	default "sandbox_spl" if SANDBOX_SPL
 	default "sandbox" if !SANDBOX_SPL
 
+choice
+	prompt "Run sandbox on 32/64-bit host"
+	default SANDBOX_64BIT
+	help
+	  Sandbox can be built on 32-bit and 64-bit hosts.
+	  The default is to build on a 64-bit host and run
+	  on a 64-bit host. If you want to run sandbox on
+	  a 32-bit host, change it here.
+
+config SANDBOX_32BIT
+	bool "32-bit host"
+
+config SANDBOX_64BIT
+	bool "64-bit host"
+
+endchoice
+
 endmenu
Signature · 1 line
2.9.2
author
#1 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)
arch/sandbox/Kconfig +5 -0
index 7b07bff..87418e3 100644
@@ -35,4 +35,9 @@ config SANDBOX_64BIT
 
 endchoice
 
+config SANDBOX_BITS_PER_LONG
+	int
+	default 32 if SANDBOX_32BIT
+	default 64 if SANDBOX_64BIT
+
 endmenu
board/sandbox/README.sandbox +3 -4
index 9dc2eb0..2e2c819 100644
@@ -24,6 +24,9 @@ single board in board/sandbox.
 CONFIG_SANDBOX_BIG_ENDIAN should be defined when running on big-endian
 machines.
 
+By default sandbox builds and runs on 64-bit hosts. If you are going to build
+and run sandbox on a 32-bit host, select CONFIG_SANDBOX_32BIT.
+
 Note that standalone/API support is not available at present.
 
 
@@ -44,10 +47,6 @@ Note:
       make sandbox_defconfig all NO_SDL=1
       ./u-boot
 
-   If you are building on a 32-bit machine you may get errors from __ffs.h
-   about shifting more than the machine word size. Edit the config file
-   include/configs/sandbox.h and change CONFIG_SANDBOX_BITS_PER_LONG to 32.
-
 U-Boot will start on your computer, showing a sandbox emulation of the serial
 console:
 
scripts/config_whitelist.txt +0 -1
index e630314..70f22e1 100644
@@ -2005,7 +2005,6 @@ CONFIG_SAMSUNG
 CONFIG_SAMSUNG_ONENAND
 CONFIG_SANDBOX_ARCH
 CONFIG_SANDBOX_BIG_ENDIAN
-CONFIG_SANDBOX_BITS_PER_LONG
 CONFIG_SANDBOX_SDL
 CONFIG_SANDBOX_SPI_MAX_BUS
 CONFIG_SANDBOX_SPI_MAX_CS
Signature · 1 line
2.9.2
#2 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

- Simon

author
#3 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Simon,

Quoted 16 lines · Simon Glass

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)
Quoted 7 lines

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

That means cross-compiling sandbox. So far this is not working. I will take a look.

Regards,
Bin

#4 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Bin,

Quoted 21 lines · Bin Meng

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

Quoted 8 lines
Quoted 5 lines

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

That means cross-compiling sandbox. So far this is not working. I will take a look.

Or perhaps we just require it to use the bit size of the host? Does compiling 64-bit U-Boot on a 32-bit machine actually work?

Regards,
Simon

author
#5 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Simon,

Quoted 30 lines · Simon Glass

Hi Bin,

Quoted 27 lines · Bin Meng

Hi Simon,

Quoted 23 lines · Simon Glass

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

Quoted 6 lines
Quoted 2 lines

That means cross-compiling sandbox. So far this is not working. I will take a look.

Or perhaps we just require it to use the bit size of the host? Does compiling 64-bit U-Boot on a 32-bit machine actually work?

I have not looked into that further but I suspect there is more work than the bit size of the host, for example, linking 64-bit vs. 32-bit libraries?

Regards,
Bin

#6 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Bin,

Quoted 36 lines · Bin Meng

Hi Simon,

Quoted 33 lines · Simon Glass

Hi Bin,

Quoted 29 lines · Bin Meng

Hi Simon,

Quoted 16 lines · Simon Glass

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)
Quoted 7 lines

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

That means cross-compiling sandbox. So far this is not working. I will take a look.

Quoted 7 lines
Quoted 3 lines

Or perhaps we just require it to use the bit size of the host? Does compiling 64-bit U-Boot on a 32-bit machine actually work?

I have not looked into that further but I suspect there is more work than the bit size of the host, for example, linking 64-bit vs. 32-bit libraries?

But does it compile 64-bit sandbox OK on a 32-bit machine? I would have thought it would complain.

I'm not really asking for this feature, it's just that I don't understand how your patch works, and don't necessarily want to lose the ability to build a 32-bit sandbox. It is to some extent a helpful build/unit test for 32-bit boards which we still have many of.

Regards,
Simon

author
#7 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Simon,

Quoted 43 lines · Simon Glass

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Simon,

Quoted 36 lines · Simon Glass

Hi Bin,

Quoted 21 lines · Bin Meng

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

Quoted 8 lines
Quoted 5 lines

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

That means cross-compiling sandbox. So far this is not working. I will take a look.

Or perhaps we just require it to use the bit size of the host? Does compiling 64-bit U-Boot on a 32-bit machine actually work?

Quoted 7 lines
Quoted 3 lines

I have not looked into that further but I suspect there is more work than the bit size of the host, for example, linking 64-bit vs. 32-bit libraries?

But does it compile 64-bit sandbox OK on a 32-bit machine? I would have thought it would complain.

No. Compiling 64-bit sandbox never worked on a 32-bit machine. So far sandbox build only supports:

1). build from a 32-bit host and run from a 32-bit host 2). build from a 64-bit host and run from a 64-bit host (current default setting)

Quoted 5 lines

I'm not really asking for this feature, it's just that I don't understand how your patch works, and don't necessarily want to lose the ability to build a 32-bit sandbox. It is to some extent a helpful build/unit test for 32-bit boards which we still have many of.

This patch does not introduce any functional changes. It just converts SANDBOX_BITS_PER_LONG to Kconfig so that this can be changed from defconfigs or 'make menuconfig' to make it more user friendly if we are building (a 32-bit) sandbox on a 32-bit host. Ideally we should add such cross-build functionality to sandbox build.

Regards,
Bin

#8 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Bin,

Quoted 67 lines · Bin Meng

Hi Simon,

Quoted 43 lines · Simon Glass

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Simon,

Quoted 36 lines · Simon Glass

Hi Bin,

Quoted 21 lines · Bin Meng

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

Quoted 8 lines
Quoted 5 lines

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

That means cross-compiling sandbox. So far this is not working. I will take a look.

Or perhaps we just require it to use the bit size of the host? Does compiling 64-bit U-Boot on a 32-bit machine actually work?

Quoted 7 lines
Quoted 3 lines

I have not looked into that further but I suspect there is more work than the bit size of the host, for example, linking 64-bit vs. 32-bit libraries?

But does it compile 64-bit sandbox OK on a 32-bit machine? I would have thought it would complain.

No. Compiling 64-bit sandbox never worked on a 32-bit machine. So far sandbox build only supports:

1). build from a 32-bit host and run from a 32-bit host 2). build from a 64-bit host and run from a 64-bit host (current default setting)

Quoted 5 lines

I'm not really asking for this feature, it's just that I don't understand how your patch works, and don't necessarily want to lose the ability to build a 32-bit sandbox. It is to some extent a helpful build/unit test for 32-bit boards which we still have many of.

Quoted 5 lines

This patch does not introduce any functional changes. It just converts SANDBOX_BITS_PER_LONG to Kconfig so that this can be changed from defconfigs or 'make menuconfig' to make it more user friendly if we are building (a 32-bit) sandbox on a 32-bit host. Ideally we should add such cross-build functionality to sandbox build.

Then I think this patch is fine.

Regards,
Simon

#9 lore raw

PATCH 2/2 sandbox: Convert SANDBOX_BITS_PER_LONG to Kconfig

Hi Bin,

Quoted 67 lines · Bin Meng

Hi Simon,

Quoted 43 lines · Simon Glass

Hi Bin,

Quoted 40 lines · Bin Meng

Hi Simon,

Quoted 36 lines · Simon Glass

Hi Bin,

Quoted 21 lines · Bin Meng

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Bin,

Quoted 10 lines · Bin Meng

Convert SANDBOX_BITS_PER_LONG to Kconfig and assign it a correct number depending on which host we are going to build and run.

---

 arch/sandbox/Kconfig         | 5 +++++
 board/sandbox/README.sandbox | 7 +++----
 scripts/config_whitelist.txt | 1 -
 3 files changed, 8 insertions(+), 5 deletions(-)

Is it OK to build 64-bit sandbox on a 32-bit machine? Does that actually work?

Quoted 8 lines
Quoted 5 lines

If then I think we need a 3-way setting like:

- 32-bit
- 64-bit
- native (i.e. whatever the host is)

That means cross-compiling sandbox. So far this is not working. I will take a look.

Or perhaps we just require it to use the bit size of the host? Does compiling 64-bit U-Boot on a 32-bit machine actually work?

Quoted 7 lines
Quoted 3 lines

I have not looked into that further but I suspect there is more work than the bit size of the host, for example, linking 64-bit vs. 32-bit libraries?

But does it compile 64-bit sandbox OK on a 32-bit machine? I would have thought it would complain.

No. Compiling 64-bit sandbox never worked on a 32-bit machine. So far sandbox build only supports:

1). build from a 32-bit host and run from a 32-bit host 2). build from a 64-bit host and run from a 64-bit host (current default setting)

Quoted 5 lines

I'm not really asking for this feature, it's just that I don't understand how your patch works, and don't necessarily want to lose the ability to build a 32-bit sandbox. It is to some extent a helpful build/unit test for 32-bit boards which we still have many of.

Quoted 5 lines

This patch does not introduce any functional changes. It just converts SANDBOX_BITS_PER_LONG to Kconfig so that this can be changed from defconfigs or 'make menuconfig' to make it more user friendly if we are building (a 32-bit) sandbox on a 32-bit host. Ideally we should add such cross-build functionality to sandbox build.

Then I think this patch is fine.

Regards,
Simon

Applied to u-boot-dm, thanks!

#10 lore raw

PATCH 1/2 sandbox: Introduce Kconfig option for 32/64 bit host

In reply to Bin Meng
Quoted 8 lines · Bin Meng

It seems most of the time we are building and running sandbox on 64-bit host. But we do support 32-bit host as well. Introduce Kconfig option for this.

---

 arch/sandbox/Kconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Quoted 30 lines
arch/sandbox/Kconfig +17 -1
index f7a6e1a..7b07bff 100644
@@ -18,4 +18,21 @@ config SYS_CONFIG_NAME
        default "sandbox_spl" if SANDBOX_SPL
        default "sandbox" if !SANDBOX_SPL
 
+choice
+       prompt "Run sandbox on 32/64-bit host"
+       default SANDBOX_64BIT
+       help
+         Sandbox can be built on 32-bit and 64-bit hosts.
+         The default is to build on a 64-bit host and run
+         on a 64-bit host. If you want to run sandbox on
+         a 32-bit host, change it here.
+
+config SANDBOX_32BIT
+       bool "32-bit host"
+
+config SANDBOX_64BIT
+       bool "64-bit host"
+
+endchoice
+
 endmenu
--

2.9.2

#11 lore raw

PATCH 1/2 sandbox: Introduce Kconfig option for 32/64 bit host

Quoted 8 lines · Bin Meng

It seems most of the time we are building and running sandbox on 64-bit host. But we do support 32-bit host as well. Introduce Kconfig option for this.

---

 arch/sandbox/Kconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Quoted 1 line

Applied to u-boot-dm, thanks!