Skip to contentSkip to conversation

toolchain: Fix the toolchain-wrapper to support more recent GCC versions

PATCH New Johannes Schmitz 2 participants 4 messages Jan 9, 2018 – Jan 12, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 toolchain: Fix the toolchain-wrapper to support more recent GCC versions

This fix is necessary for to build for MIPS, for example for the MIPS XBurst architecture used on ci20 boards.

---
 toolchain/toolchain-wrapper.c  | 10 ++++++++--
 toolchain/toolchain-wrapper.mk |  6 +++++-
 2 files changed, 13 insertions(+), 3 deletions(-)
toolchain/toolchain-wrapper.c +8 -2
index 2928ea4..dd3a25e 100644
@@ -79,8 +79,14 @@ static char *predef_args[] = {
 #ifdef BR_OMIT_LOCK_PREFIX
 	"-Wa,-momit-lock-prefix=yes",
 #endif
-#ifdef BR_NO_FUSED_MADD
-	"-mno-fused-madd",
+#ifdef BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
+	#ifdef BR_FP_CONTRACT_OFF
+		"-ffp-contract=off",
+	#endif
+#else
+	#ifdef BR_NO_FUSED_MADD
+		"-mno-fused-madd",
+	#endif
 #endif
 #ifdef BR_BINFMT_FLAT
 	"-Wl,-elf2flt",
toolchain/toolchain-wrapper.mk +5 -1
index 7f72a0c..b7a4b9b 100644
@@ -28,7 +28,11 @@ endif
 
 # Avoid FPU bug on XBurst CPUs
 ifeq ($(BR2_mips_xburst),y)
-TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
+	ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y)
+		TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF
+	else
+		TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
+	endif
 endif
 
 ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 board/ci20: Implement creation of a basic sdcard image for ci20

Add a genimage.cfg to create a working sdcard.img for the ci20 hardware. We also need a uboot-env.txt to create the partition for the uboot environment.

Update the board/ci20/readme.txt with the related information. Remove the tftp netboot description from the readme as it is already to complicated for a basic bootable example.

---
 board/ci20/genimage.cfg  | 29 ++++++++++++++++++++++++++
 board/ci20/readme.txt    | 54 ++++++++++++++++++++++++++----------------------
 board/ci20/uboot-env.txt | 10 +++++++++
 configs/ci20_defconfig   | 11 ++++++++++
 4 files changed, 79 insertions(+), 25 deletions(-)
 create mode 100644 board/ci20/genimage.cfg
 create mode 100644 board/ci20/uboot-env.txt
board/ci20/genimage.cfg new file +29 -0
new file mode 100644
index 0000000..fa3e736
@@ -0,0 +1,29 @@
+image sdcard.img {
+    hdimage {
+    }
+
+    partition uboot-spl {
+        in-partition-table = "no"
+        image = "u-boot-spl.bin"
+        offset = 512
+    }
+
+    partition uboot {
+        in-partition-table = "no"
+        image = "u-boot.img"
+        offset = 14k
+    }
+
+    partition uboot-env {
+        in-partition-table = "no"
+        image = "uboot-env.bin"
+        offset = 526k
+    }
+
+    partition rootfs {
+        partition-type = 0x83
+        image = "rootfs.ext4"
+        offset = 2M
+        size = 60M
+    }
+}
board/ci20/readme.txt +29 -25

70 lines not on this page · raw message

board/ci20/uboot-env.txt new file +10 -0
new file mode 100644
index 0000000..3093496
@@ -0,0 +1,10 @@
+baudrate=115200
+board_mfr=NP
+bootargs=console=ttyS4,115200 console=tty0 mem=256M at 0x0 mem=768M at 0x30000000 rootwait root=/dev/mmcblk0p1 devtmpfs.mount=1 ip=dhcp
+bootcmd=run ethargs; ext4load mmc 0:1 0x88000000 /boot/uImage; bootm 0x88000000
+bootdelay=1
+ethargs=env set bootargs ${bootargs}
+loads_echo=1
+stderr=eserial0,eserial4
+stdin=eserial0,eserial4
+stdout=eserial0,eserial4
configs/ci20_defconfig +11 -0
index 6de6394..f28dd4d 100644
@@ -8,6 +8,10 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_18=y
 
 # system
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS4"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/ci20/genimage.cfg"
 
 # kernel
 BR2_LINUX_KERNEL=y
@@ -15,6 +19,7 @@ BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/MIPS/CI20_linux.git"
 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dff33297116643485ca37141d804eddd793e834"
 BR2_LINUX_KERNEL_DEFCONFIG="ci20"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
 
 # u-boot
 BR2_TARGET_UBOOT=y
@@ -26,3 +31,9 @@ BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="dd3c1b95dac7d10b2ca5806f65e5c1050d7dd0fa"
 BR2_TARGET_UBOOT_FORMAT_IMG=y
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin"
+BR2_TARGET_UBOOT_ENVIMAGE=y
+BR2_TARGET_UBOOT_ENVIMAGE_SOURCE="board/ci20/uboot-env.txt"
+BR2_TARGET_UBOOT_ENVIMAGE_SIZE="32768"
+
+# host
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 board/ci20: Implement creation of a basic sdcard image for ci20

Hello,

Quoted 9 lines · Johannes Schmitz

Add a genimage.cfg to create a working sdcard.img for the ci20 hardware. We also need a uboot-env.txt to create the partition for the uboot environment.

Update the board/ci20/readme.txt with the related information. Remove the tftp netboot description from the readme as it is already to complicated for a basic bootable example.

Quoted 8 lines
---
 board/ci20/genimage.cfg  | 29 ++++++++++++++++++++++++++
 board/ci20/readme.txt    | 54 ++++++++++++++++++++++++++----------------------
 board/ci20/uboot-env.txt | 10 +++++++++
 configs/ci20_defconfig   | 11 ++++++++++
 4 files changed, 79 insertions(+), 25 deletions(-)
 create mode 100644 board/ci20/genimage.cfg
 create mode 100644 board/ci20/uboot-env.txt

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/2 toolchain: Fix the toolchain-wrapper to support more recent GCC versions

In reply to Johannes Schmitz

Hello,

Quoted 4 lines · Johannes Schmitz

This fix is necessary for to build for MIPS, for example for the MIPS XBurst architecture used on ci20 boards.

This is a bit short on explanation. Can you explain what it is fixing? Why is -mno-fused-madd no longer sufficient in recent gcc versions?

The commit title is also not quite good, it doesn't mention that it's MIPS-related. Perhaps:

toolchain: use -ffp-contract=off on MIPS XBust in the wrapper when needed

toolchain/toolchain-wrapper.c static char *predef_args[] = { · line 82

Quoted 11 lines
toolchain/toolchain-wrapper.c +1 -2
index 2928ea4..dd3a25e 100644
@@ -79,8 +79,14 @@ static char *predef_args[] = {
 #ifdef BR_OMIT_LOCK_PREFIX
 	"-Wa,-momit-lock-prefix=yes",
 #endif
-#ifdef BR_NO_FUSED_MADD
-	"-mno-fused-madd",
+#ifdef BR2_TOOLCHAIN_GCC_AT_LEAST_4_6

This condition is not needed, because toolchain-wrapper.mk is already taking care of passing BR_NO_FUSED_MADD or BR2_FP_CONTRACT_OFF.

Quoted 15 lines
toolchain/toolchain-wrapper.c +7 -0
+	#ifdef BR_FP_CONTRACT_OFF
+		"-ffp-contract=off",
+	#endif
+#else
+	#ifdef BR_NO_FUSED_MADD
+		"-mno-fused-madd",
+	#endif
 #endif
 #ifdef BR_BINFMT_FLAT
 	"-Wl,-elf2flt",
toolchain/toolchain-wrapper.mk +0 -0
index 7f72a0c..b7a4b9b 100644

toolchain/toolchain-wrapper.mk endif · line 35

Quoted 9 lines
toolchain/toolchain-wrapper.mk +5 -1
@@ -28,7 +28,11 @@ endif
 
 # Avoid FPU bug on XBurst CPUs
 ifeq ($(BR2_mips_xburst),y)
-TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
+	ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y)
+		TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF
+	else
+		TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
+	endif

Please don't indent lines. That's the Buildroot convention.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com