Skip to contentSkip to conversation

Has been added configs for OrangePI-2G-IOT

PATCH New Aleksey Kislitsa 2 participants 2 messages Apr 21, 2018 – Feb 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Has been added configs for OrangePI-2G-IOT

---
 .gitignore                                         |   2 +
 board/orangepi/orangepi-2g-iot/boot.cmd            |  18 +++
 board/orangepi/orangepi-2g-iot/genimage.cfg        |  36 +++++
 .../linux/0002-linux-add-support-for-gcc6.patch    |  82 +++++++++++
 .../linux/0003-linux-use-static-inline.patch       |  38 +++++
 ...ux-removed-defined-but-not-used-functions.patch | 153 +++++++++++++++++++++
 .../u-boot/0001-orangepi2giot-fatload.patch        |  22 +++
 board/orangepi/orangepi-2g-iot/post-build.sh       |  15 ++
 board/orangepi/orangepi-2g-iot/post-image.sh       |  14 ++
 board/orangepi/orangepi-2g-iot/readme.txt          |  29 ++++
 configs/orangepi_2g-iot_defconfig                  |  44 ++++++
 11 files changed, 453 insertions(+)
 create mode 100644 board/orangepi/orangepi-2g-iot/boot.cmd
 create mode 100644 board/orangepi/orangepi-2g-iot/genimage.cfg
 create mode 100644 board/orangepi/orangepi-2g-iot/patches/linux/0002-linux-add-support-for-gcc6.patch
 create mode 100644 board/orangepi/orangepi-2g-iot/patches/linux/0003-linux-use-static-inline.patch
 create mode 100644 board/orangepi/orangepi-2g-iot/patches/linux/0004-linux-removed-defined-but-not-used-functions.patch
 create mode 100644 board/orangepi/orangepi-2g-iot/patches/u-boot/0001-orangepi2giot-fatload.patch
 create mode 100755 board/orangepi/orangepi-2g-iot/post-build.sh
 create mode 100755 board/orangepi/orangepi-2g-iot/post-image.sh
 create mode 100644 board/orangepi/orangepi-2g-iot/readme.txt
 create mode 100644 configs/orangepi_2g-iot_defconfig
.gitignore +2 -0
index bb02d9f572..5484c84449 100644
@@ -13,3 +13,5 @@
 *.rej
 *~
 *.pyc
+/build-*
+/outgoing
board/orangepi/orangepi-2g-iot/boot.cmd new file +18 -0
new file mode 100644
index 0000000000..2951de6f00
@@ -0,0 +1,18 @@
+if test "${boot_device}" = "mmc"; then
+
+	setenv rootdev "/dev/mmcblk0p2"
+	setenv rootfstype "ext4"
+
+	setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} console=ttyS0,921600 kgdboc=ttyS0,921600 panic=10 consoleblank=0 earlyprintk"
+
+	fatload mmc 0:1 ${kernel_addr} zImage
+	fatload mmc 0:1 ${modem_addr} modem.bin
+else
+	echo "NAND boot is not implemented yet"
+fi
+
+# modem init is mandatory according to u-boot sources
+mdcom_loadm ${modem_addr}
+mdcom_check 1
+
+bootz ${kernel_addr}
board/orangepi/orangepi-2g-iot/genimage.cfg new file +36 -0
new file mode 100644
index 0000000000..aca758633a
@@ -0,0 +1,36 @@
+# Minimal SD card image for the OrangePi Zero
+#
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"modem.bin",
+			"boot.scr"
+		}
+	}
+	size = 64M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition u-boot {
+		in-partition-table = "no"
+		image = "u-boot.rda"
+		offset = 131072
+		size = 1966080 # 2MB - 131072
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
board/orangepi/orangepi-2g-iot/patches/linux/0002-linux-add-support-for-gcc6.patch new file +82 -0

82 lines not on this page · raw message

board/orangepi/orangepi-2g-iot/patches/linux/0003-linux-use-static-inline.patch new file +38 -0
new file mode 100644
index 0000000000..5ce20dd208
@@ -0,0 +1,38 @@
+From f1b378aa83ee4f8198b45b6ce9de28a378164f2b Mon Sep 17 00:00:00 2001
+From: Leo Soares <[email protected]>
+Date: Tue, 13 Jun 2017 17:33:49 +0100
+Subject: [PATCH] use static inline
+
+---
+ arch/arm/include/asm/ftrace.h    | 2 +-
+ arch/arm/kernel/return_address.c | 4 ----
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
+index f89515adac60..2bb8cac28b9e 100644
+--- a/arch/arm/include/asm/ftrace.h
++++ b/arch/arm/include/asm/ftrace.h
+@@ -45,7 +45,7 @@ void *return_address(unsigned int);
+ 
+ #else
+ 
+-extern inline void *return_address(unsigned int level)
++static inline void *return_address(unsigned int level)
+ {
+ 	return NULL;
+ }
+diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
+index fafedd86885d..f703548758d9 100644
+--- a/arch/arm/kernel/return_address.c
++++ b/arch/arm/kernel/return_address.c
+@@ -63,10 +63,6 @@ void *return_address(unsigned int level)
+ #warning "TODO: return_address should use unwind tables"
+ #endif
+ 
+-void *return_address(unsigned int level)
+-{
+-	return NULL;
+-}
+ 
+ #endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
+ 
board/orangepi/orangepi-2g-iot/patches/linux/0004-linux-removed-defined-but-not-used-functions.patch new file +153 -0

153 lines not on this page · raw message

board/orangepi/orangepi-2g-iot/patches/u-boot/0001-orangepi2giot-fatload.patch new file +22 -0
new file mode 100644
index 0000000000..97ff1a0cc2
@@ -0,0 +1,22 @@
+From 9a30659ed1c5056fa53843fbb4ef2e55694dd238 Mon Sep 17 00:00:00 2001
+From: Leo Soares <[email protected]>
+Date: Mon, 12 Jun 2017 21:57:22 +0100
+Subject: [PATCH] load from the first fat partition instead of ext2
+
+---
+ include/configs/rda_config_defaults.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/configs/rda_config_defaults.h b/include/configs/rda_config_defaults.h
+index 84501bd..f670207 100644
+--- a/include/configs/rda_config_defaults.h
++++ b/include/configs/rda_config_defaults.h
+@@ -280,7 +280,7 @@
+ #define CONFIG_BOOTCOMMAND		\
+ 	"mux_config; "		\
+ 	"mmc dev 0; "		\
+-	"ext2load mmc 0:1 ${script_addr} boot.scr && source ${script_addr};" \
++	"fatload mmc 0:1 ${script_addr} boot.scr && source ${script_addr};" \
+ 	"echo Running boot script failed;"
+
+ #endif /* !CONFIG_SPL_BUILD */
board/orangepi/orangepi-2g-iot/post-build.sh new file +15 -0
new file mode 100755
index 0000000000..cde8ad85a6
@@ -0,0 +1,15 @@
+#!/bin/sh
+# post-build.sh for OrangePi taken from CubieBoard's post-build.sh
+# 2013, Carlo Caione <[email protected]>
+
+BOARD_DIR="$(dirname $0)"
+MKIMAGE=$HOST_DIR/usr/bin/mkimage
+BOOT_CMD=$BOARD_DIR/boot.cmd
+BOOT_CMD_H=$BINARIES_DIR/boot.scr
+
+git clone https://github.com/orangepi-xunlong/OrangePiRDA_external.git /tmp/OrangePiRDA_external
+cp /tmp/OrangePiRDA_external/bootarg/modem.bin $BINARIES_DIR
+rm -fR /tmp/OrangePiRDA_external
+
+# U-Boot script
+$MKIMAGE -C none -A arm -T script -d $BOOT_CMD $BOOT_CMD_H
board/orangepi/orangepi-2g-iot/post-image.sh new file +14 -0
new file mode 100755
index 0000000000..359b4c9e7c
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
board/orangepi/orangepi-2g-iot/readme.txt new file +29 -0
new file mode 100644
index 0000000000..bd1cec44e2
@@ -0,0 +1,29 @@
+Orange Pi 2G IOT
+
+Intro
+=====
+
+This default configuration will allow you to start experimenting with the
+buildroot environment for the Orange Pi 2G IOT. With the current configuration
+it will bring-up the board, and allow access through the serial console.
+
+How to build it
+===============
+
+Configure Buildroot:
+
+    $ make orangepi_2g-iot_defconfig
+
+Compile everything and build the SD card image:
+
+    $ make
+
+How to write the SD card
+========================
+
+Once the build process is finished you will have an image called "sdcard.img"
+in the output/images/ directory.
+
+Copy the bootable "sdcard.img" onto an SD card with "dd":
+
+  $ sudo dd if=output/images/sdcard.img of=/dev/sdX
configs/orangepi_2g-iot_defconfig new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 Has been added configs for OrangePI-2G-IOT

Hello,

Thanks for your contribution, and sorry for the huge delay in getting back to you. See below for a number of comments about your patch.

First, the commit title should be:

configs/orangepi_2g-iot: new defconfig

Quoted 1 line · On Sat, 21 Apr 2018 15:19:00 +0300 Aleksey Kislitsa…
 .gitignore                                         |   2 +

This file should not be changed.

Quoted 11 lines
 board/orangepi/orangepi-2g-iot/boot.cmd            |  18 +++
 board/orangepi/orangepi-2g-iot/genimage.cfg        |  36 +++++
 .../linux/0002-linux-add-support-for-gcc6.patch    |  82 +++++++++++
 .../linux/0003-linux-use-static-inline.patch       |  38 +++++
 ...ux-removed-defined-but-not-used-functions.patch | 153 +++++++++++++++++++++
 .../u-boot/0001-orangepi2giot-fatload.patch        |  22 +++
 board/orangepi/orangepi-2g-iot/post-build.sh       |  15 ++
 board/orangepi/orangepi-2g-iot/post-image.sh       |  14 ++
 board/orangepi/orangepi-2g-iot/readme.txt          |  29 ++++
 configs/orangepi_2g-iot_defconfig                  |  44 ++++++
 11 files changed, 453 insertions(+)

Please add an entry in the DEVELOPERS file for this board.

board/orangepi/orangepi-2g-iot/boot.cmd line 4

Quoted 10 lines
board/orangepi/orangepi-2g-iot/boot.cmd new file +4 -0
new file mode 100644
index 0000000000..2951de6f00
@@ -0,0 +1,18 @@
+if test "${boot_device}" = "mmc"; then
+
+	setenv rootdev "/dev/mmcblk0p2"
+	setenv rootfstype "ext4"

Is it really useful to have separate variables for this, instead of just putting the right values in bootargs ?

board/orangepi/orangepi-2g-iot/boot.cmd line 6

Quoted 2 lines
board/orangepi/orangepi-2g-iot/boot.cmd new file +2 -0
+
+	setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} console=ttyS0,921600 kgdboc=ttyS0,921600 panic=10 consoleblank=0 earlyprintk"

This seems like a complicated kernel command line for a default configuration. Could you drop kgdboc=ttyS0,921600 panic=10 consoleblank=0 earlyprintk from it ?

board/orangepi/orangepi-2g-iot/boot.cmd line 11

Quoted 4 lines
board/orangepi/orangepi-2g-iot/boot.cmd new file +4 -0
+	fatload mmc 0:1 ${kernel_addr} zImage
+	fatload mmc 0:1 ${modem_addr} modem.bin
+else
+	echo "NAND boot is not implemented yet"

If it's not implemented, then is this condition really necessary ?

Quoted 6 lines
board/orangepi/orangepi-2g-iot/patches/linux/0002-linux-add-support-for-gcc6.patch new file +0 -0
new file mode 100644
index 0000000000..f674211c62

board/orangepi/orangepi-2g-iot/patches/linux/0002-linux-add-support-for-gcc6.patch line 9

Quoted 9 lines
board/orangepi/orangepi-2g-iot/patches/linux/0002-linux-add-support-for-gcc6.patch new file +9 -0
@@ -0,0 +1,82 @@
+From 8ae7d1e028c8adb1db187d1940d31fc7aebae15e Mon Sep 17 00:00:00 2001
+From: Leo Soares <[email protected]>
+Date: Tue, 13 Jun 2017 17:20:24 +0100
+Subject: [PATCH] add support for GCC 6
+
+---
+ include/linux/compiler-gcc6.h | 66 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 66 insertions(+)
+ create mode 100644 include/linux/compiler-gcc6.h

There's no newer kernel version for this platform that would build out of the box with gcc 6.x?

In any case, the patch needs to have your Signed-off-by (comment applicable to all patches).

Generally speaking, the support for this board seems to require quite a few patches. Can some of these be avoided by using more recent upstream U-Boot/Linux code ?

Quoted 6 lines
board/orangepi/orangepi-2g-iot/post-build.sh new file +0 -0
new file mode 100755
index 0000000000..cde8ad85a6

board/orangepi/orangepi-2g-iot/post-build.sh line 10

Quoted 10 lines
board/orangepi/orangepi-2g-iot/post-build.sh new file +10 -0
@@ -0,0 +1,15 @@
+#!/bin/sh
+# post-build.sh for OrangePi taken from CubieBoard's post-build.sh
+# 2013, Carlo Caione <[email protected]>
+
+BOARD_DIR="$(dirname $0)"
+MKIMAGE=$HOST_DIR/usr/bin/mkimage
+BOOT_CMD=$BOARD_DIR/boot.cmd
+BOOT_CMD_H=$BINARIES_DIR/boot.scr
+
+git clone https://github.com/orangepi-xunlong/OrangePiRDA_external.git /tmp/OrangePiRDA_external

Doing a git clone in a post-build script is definitely not good, as it circumvents the download and legal-info mechanisms of Buildroot. If you need to download something, create a package.

Could you fix the above comments and submit an updated version ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com