Skip to contentSkip to conversation

cubieboard: update build support for cubieboard 1/2/3.

PATCH New Scott Fan 2 participants 4 messages Jul 21, 2015 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore

Scott Fan

author
#0 lore raw

PATCH 3/4 cubieboard: update build support for cubieboard 1/2/3.

This patch update the cb1/cb2's defconfig to mainline u-boot version, and bump their linux-sunxi kernel to latest stage/sunxi-3.4 branch.

Additionally, add defconfig for cubieboard3 (a.k.a. cubietruck).

Finally, support set up the SD card only to boot from network.

---
 board/cubietech/cubieboard/boot.cmd                |   7 +-
 board/cubietech/cubieboard/boot.env                |  20 +
 .../cubietech/cubieboard/linux-cubieboard2.config  | 749 ---------------------
 board/cubietech/cubieboard/mkcubiecard.sh          | 125 ++--
 board/cubietech/cubieboard/post-build.sh           |  14 -
 board/cubietech/cubieboard/post-image.sh           |  26 +
 board/cubietech/cubieboard/readme.txt              |  31 +-
 board/cubietech/cubieboard/sun4i-cubieboard.config |   4 +
 .../cubietech/cubieboard/sun7i-cubieboard2.config  |   4 +
 board/cubietech/cubieboard/sun7i-cubietruck.config |   4 +
 configs/cubieboard2_defconfig                      |  39 +-
 configs/cubieboard_defconfig                       |  38 +-
 configs/cubietruck_defconfig                       |  21 +
 13 files changed, 205 insertions(+), 877 deletions(-)
 create mode 100644 board/cubietech/cubieboard/boot.env
 delete mode 100644 board/cubietech/cubieboard/linux-cubieboard2.config
 delete mode 100755 board/cubietech/cubieboard/post-build.sh
 create mode 100755 board/cubietech/cubieboard/post-image.sh
 create mode 100644 board/cubietech/cubieboard/sun4i-cubieboard.config
 create mode 100644 board/cubietech/cubieboard/sun7i-cubieboard2.config
 create mode 100644 board/cubietech/cubieboard/sun7i-cubietruck.config
 create mode 100644 configs/cubietruck_defconfig
board/cubietech/cubieboard/boot.cmd +4 -3
index 849ed00..519b0e7 100644
@@ -1,4 +1,5 @@
+setenv bootm_boot_mode sec
 setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
-fatload mmc 0 0x43000000 script.bin
-fatload mmc 0 0x48000000 uImage
-bootm 0x48000000
+load mmc 0:1 0x43000000 script.bin || load mmc 0:1 0x43000000 boot/script.bin
+load mmc 0:1 0x42000000 uImage || load mmc 0:1 0x42000000 boot/uImage
+bootm 0x42000000
board/cubietech/cubieboard/boot.env new file +20 -0
new file mode 100644
index 0000000..8d8fbd4
@@ -0,0 +1,20 @@
+autoload=no
+nfsroot=/tftpboot/rootfs
+
+stderr=serial,vga
+stdin=serial,usbkbd
+stdout=serial,vga
+
+scriptfile=script.bin
+scriptaddr=0x43000000
+
+kernelfile=uImage
+kernel_addr_r=0x42000000
+
+bootm_boot_mode=sec
+console=ttyS0,115200
+
+netargs=setenv bootargs console=${console} root=/dev/nfs nfsroot=${serverip}:${nfsroot} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off:${dnsip} ${extra}
+netboot=if test -s ${ipaddr}; then if test -s ${serverip}; then run netargs; tftp ${scriptaddr} ${serverip}:${scriptfile}; tftp ${kernel_addr_r} ${serverip}:${kernelfile}; bootm ${kernel_addr_r}; else echo WARN: Cannot find the environment variable serverip, please setenv, then saveenv and boot; fi; else run bootcmd; fi;
+
+bootcmd=dhcp; run netboot;
board/cubietech/cubieboard/linux-cubieboard2.config deleted +0 -749

749 lines not on this page · raw message

board/cubietech/cubieboard/mkcubiecard.sh +78 -47

177 lines not on this page · raw message

board/cubietech/cubieboard/post-build.sh deleted +0 -14
deleted file mode 100755
index 1b0258c..0000000
@@ -1,14 +0,0 @@
-#!/bin/sh
-# post-build.sh for CubieBoard
-# 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
-
-# U-Boot script
-if [ -e $MKIMAGE -a -e $BOOT_CMD ];
-then
-	$MKIMAGE -C none -A arm -T script -d $BOOT_CMD $BOOT_CMD_H
-fi
board/cubietech/cubieboard/post-image.sh new file +26 -0
new file mode 100755
index 0000000..4d792a4
@@ -0,0 +1,26 @@
+#!/bin/sh
+# post-image.sh for CubieBoard
+# 2015, Scott Fan <[email protected]>
+# 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
+
+MKENVIMAGE=$HOST_DIR/usr/bin/mkenvimage
+BOOT_ENV_SIZE=0x20000
+BOOT_ENV_SRC=$BOARD_DIR/boot.env
+BOOT_ENV_BIN=$BINARIES_DIR/u-boot-env.bin
+
+# U-Boot script
+if [ -e $MKIMAGE -a -e $BOOT_CMD ];
+then
+	$MKIMAGE -C none -A arm -T script -d $BOOT_CMD $BOOT_CMD_H
+fi
+
+# U-Boot environment
+if [ -e $MKENVIMAGE -a -e $BOOT_ENV_SRC ];
+then
+	$MKENVIMAGE -s $BOOT_ENV_SIZE -o $BOOT_ENV_BIN $BOOT_ENV_SRC
+fi
board/cubietech/cubieboard/readme.txt +24 -7
index 81cc5e4..af3e997 100644
@@ -1,4 +1,4 @@
-cubieboard and cubieboard2
+cubieboard, cubieboard2 and cubietruck
 
 -----
 Intro
@@ -13,11 +13,16 @@ For more information, please see http://linux-sunxi.org/FirstSteps
 How to build it
 ---------------
 
-You need to use the cubieboard_defconfig or cubieboard2_defconfig, to do so:
+You need to use the cubie*_defconfig, to do so:
+cubieboard1 (a.k.a. cubieboard):
  * make cubieboard_defconfig
-or
+
+cubieboard2:
  * make cubieboard2_defconfig
 
+cubieboard3 (a.k.a. cubietruck):
+ * make cubietruck_defconfig
+
 And to compile:
  * make
 
@@ -31,10 +36,10 @@ After building, you should obtain this tree:
     +-- rootfs.tar
     +-- boot.scr
     +-- script.bin
-    +-- sunxi-spl.bin
     +-- u-boot.bin
-    +-- u-boot-sunxi-with-spl.bin (optional)
-    `-- uImage
+    +-- u-boot-env.bin
+    +-- u-boot-sunxi-with-spl.bin
+    +-- uImage
 
 --------------------------
 How setting up the SD card
@@ -54,9 +59,21 @@ Use dmesg to find out where the SD card is attached in the /dev tree
 where:
  - <images_dir> is the directory containing the generated files (usually
    output/images)
- - <device> is the device file of the SD card (usually /dev/sdX)
+ - <device> is the device file of the SD card (usually /dev/mmcblk0 or /dev/sdX)
+
 
+Alternately, you may set up the SD card only to boot from the network:
+
+# sudo ./mkcubiecard.sh <images_dir> <device> [netboot]
+
+where:
+ - <images_dir> and <device> as above
+ - [netboot] specify whether to boot from network (should yes, if you want)
 
+ATTENTION: This operation will keep the partition table of your SD card, will not
+           write any data to the existing partitions. However, if the first
+           partition ahead of the 1MB offset, it will be damaged.
 
 --
+Scott Fan <[email protected]>
 Carlo Caione <[email protected]>
board/cubietech/cubieboard/sun4i-cubieboard.config new file +4 -0
new file mode 100644
index 0000000..43eee73
@@ -0,0 +1,4 @@
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_ROOT_NFS=y
+CONFIG_SUNXI_EMAC=y
board/cubietech/cubieboard/sun7i-cubieboard2.config new file +4 -0
new file mode 100644
index 0000000..43eee73
@@ -0,0 +1,4 @@
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_ROOT_NFS=y
+CONFIG_SUNXI_EMAC=y
board/cubietech/cubieboard/sun7i-cubietruck.config new file +4 -0
new file mode 100644
index 0000000..ff7813f
@@ -0,0 +1,4 @@
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_ROOT_NFS=y
+CONFIG_SUNXI_GMAC=y
configs/cubieboard2_defconfig +10 -29
index f85760d..41d5266 100644
@@ -1,40 +1,21 @@
-# Architecture
 BR2_arm=y
 BR2_cortex_a7=y
-
-# System configuration
+BR2_KERNEL_HEADERS_3_4=y
 BR2_TARGET_GENERIC_HOSTNAME="Cubieboard2"
 BR2_TARGET_GENERIC_ISSUE="Welcome to use Cubieboard!"
-BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
-BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-build.sh"
-
-# Additional tools
-BR2_PACKAGE_HOST_SUNXI_TOOLS=y
-BR2_PACKAGE_HOST_UBOOT_TOOLS=y
-BR2_PACKAGE_SUNXI_TOOLS=y
-BR2_PACKAGE_SUNXI_BOARDS=y
-BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a20/cubieboard2.fex"
-
-# Kernel headers
-BR2_KERNEL_HEADERS_3_4=y
-
-# Kernel
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="5dda5145c877335e17bd9ca48954841acc0f785a"
-BR2_LINUX_KERNEL_VERSION="sunxi-3.4"
-BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
-BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/cubietech/cubieboard/linux-cubieboard2.config"
-
-# Bootloaders
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
+BR2_LINUX_KERNEL_DEFCONFIG="sun7i"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun7i-cubieboard2.config"
+BR2_PACKAGE_SUNXI_TOOLS=y
+BR2_PACKAGE_SUNXI_BOARDS=y
+BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a20/cubieboard2.fex"
 BR2_TARGET_UBOOT=y
-BR2_TARGET_UBOOT_BOARDNAME="cubieboard2"
-BR2_TARGET_UBOOT_CUSTOM_GIT=y
-BR2_TARGET_UBOOT_VERSION="sunxi"
-BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/linux-sunxi/u-boot-sunxi.git"
-BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="b4bca5e0651b460a4511582f07a935cb48f74948"
-BR2_TARGET_UBOOT_FORMAT_BIN=y
+BR2_TARGET_UBOOT_BOARDNAME="Cubieboard2"
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
configs/cubieboard_defconfig +10 -28
index 1da019f..85dc794 100644
@@ -1,39 +1,21 @@
-# Architecture
 BR2_arm=y
 BR2_cortex_a8=y
-
-# System configuration
+BR2_KERNEL_HEADERS_3_4=y
 BR2_TARGET_GENERIC_HOSTNAME="Cubieboard"
 BR2_TARGET_GENERIC_ISSUE="Welcome to use Cubieboard!"
-BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
-BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-build.sh"
-
-# Additional tools
-BR2_PACKAGE_HOST_SUNXI_TOOLS=y
-BR2_PACKAGE_HOST_UBOOT_TOOLS=y
-BR2_PACKAGE_SUNXI_TOOLS=y
-BR2_PACKAGE_SUNXI_BOARDS=y
-BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/cubieboard.fex"
-
-# Kernel headers
-BR2_KERNEL_HEADERS_3_4=y
-
-# Kernel
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="274a66a7bfcbaabb88d63e4eba161965383cc416"
-BR2_LINUX_KERNEL_VERSION="sunxi-3.4"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
 BR2_LINUX_KERNEL_DEFCONFIG="sun4i"
-
-# Bootloaders
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun4i-cubieboard.config"
+BR2_PACKAGE_SUNXI_TOOLS=y
+BR2_PACKAGE_SUNXI_BOARDS=y
+BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/cubieboard.fex"
 BR2_TARGET_UBOOT=y
-BR2_TARGET_UBOOT_BOARDNAME="cubieboard"
-BR2_TARGET_UBOOT_CUSTOM_GIT=y
-BR2_TARGET_UBOOT_VERSION="sunxi"
-BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/linux-sunxi/u-boot-sunxi.git"
-BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="1a8ac55429f7f8cc9f100c1cf2dc0195cf81e76f"
-BR2_TARGET_UBOOT_FORMAT_BIN=y
+BR2_TARGET_UBOOT_BOARDNAME="Cubieboard"
 BR2_TARGET_UBOOT_SPL=y
-BR2_TARGET_UBOOT_SPL_NAME="spl/sunxi-spl.bin"
+BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
configs/cubietruck_defconfig new file +21 -0
new file mode 100644
index 0000000..01a5fc2
@@ -0,0 +1,21 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_KERNEL_HEADERS_3_4=y
+BR2_TARGET_GENERIC_HOSTNAME="Cubietruck"
+BR2_TARGET_GENERIC_ISSUE="Welcome to use Cubieboard!"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
+BR2_LINUX_KERNEL_DEFCONFIG="sun7i"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun7i-cubietruck.config"
+BR2_PACKAGE_SUNXI_TOOLS=y
+BR2_PACKAGE_SUNXI_BOARDS=y
+BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a20/cubietruck.fex"
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="Cubietruck"
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
Signature · 1 line
2.4.6
author
#1 lore raw

PATCH 4/4 cubieboard: [PATCH] ipconfig: add nameserver IPs to kernel-parameter ip=

---
 .../5e953778a2aab04929a5e7b69f53dc26e39b079e.patch | 133 +++++++++++++++++++++
 configs/cubieboard2_defconfig                      |   1 +
 configs/cubieboard_defconfig                       |   1 +
 configs/cubietruck_defconfig                       |   1 +
 4 files changed, 136 insertions(+)
 create mode 100644 board/cubietech/cubieboard/5e953778a2aab04929a5e7b69f53dc26e39b079e.patch
board/cubietech/cubieboard/5e953778a2aab04929a5e7b69f53dc26e39b079e.patch new file +133 -0
new file mode 100644
index 0000000..e473040
@@ -0,0 +1,133 @@
+From 5e953778a2aab04929a5e7b69f53dc26e39b079e Mon Sep 17 00:00:00 2001
+From: Christoph Fritz <[email protected]>
+Date: Fri, 21 Sep 2012 08:31:19 +0000
+Subject: [PATCH] ipconfig: add nameserver IPs to kernel-parameter ip=
+
+On small systems (e.g. embedded ones) IP addresses are often configured
+by bootloaders and get assigned to kernel via parameter "ip=".  If set to
+"ip=dhcp", even nameserver entries from DHCP daemons are handled. These
+entries exported in /proc/net/pnp are commonly linked by /etc/resolv.conf.
+
+To configure nameservers for networks without DHCP, this patch adds option
+<dns0-ip> and <dns1-ip> to kernel-parameter 'ip='.
+
+Signed-off-by: Christoph Fritz <[email protected]>
+Tested-by: Jan Weitzel <[email protected]>
+Signed-off-by: David S. Miller <[email protected]>
+---
+ Documentation/filesystems/nfs/nfsroot.txt | 10 +++++++-
+ net/ipv4/ipconfig.c                       | 39 ++++++++++++++++++++++++++++---
+ 2 files changed, 45 insertions(+), 4 deletions(-)
+
+diff --git a/Documentation/filesystems/nfs/nfsroot.txt b/Documentation/filesystems/nfs/nfsroot.txt
+index ffdd9d8..2d66ed6 100644
+--- a/Documentation/filesystems/nfs/nfsroot.txt
++++ b/Documentation/filesystems/nfs/nfsroot.txt
+@@ -78,7 +78,8 @@ nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
+ 			flags		= hard, nointr, noposix, cto, ac
+ 
+ 
+-ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
++ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:
++   <dns0-ip>:<dns1-ip>
+ 
+   This parameter tells the kernel how to configure IP addresses of devices
+   and also how to set up the IP routing table. It was originally called
+@@ -158,6 +159,13 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
+ 
+                 Default: any
+ 
++  <dns0-ip>	IP address of first nameserver.
++		Value gets exported by /proc/net/pnp which is often linked
++		on embedded systems by /etc/resolv.conf.
++
++  <dns1-ip>	IP address of secound nameserver.
++		Same as above.
++
+ 
+ nfsrootdebug
+ 
+diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
+index 67e8a6b..1c0e7e0 100644
+--- a/net/ipv4/ipconfig.c
++++ b/net/ipv4/ipconfig.c
+@@ -743,14 +743,22 @@ static void __init ic_bootp_init_ext(u8 *e)
+ 
+ 
+ /*
+- *  Initialize the DHCP/BOOTP mechanism.
++ *  Predefine Nameservers
+  */
+-static inline void __init ic_bootp_init(void)
++static inline void __init ic_nameservers_predef(void)
+ {
+ 	int i;
+ 
+ 	for (i = 0; i < CONF_NAMESERVERS_MAX; i++)
+ 		ic_nameservers[i] = NONE;
++}
++
++/*
++ *  Initialize the DHCP/BOOTP mechanism.
++ */
++static inline void __init ic_bootp_init(void)
++{
++	ic_nameservers_predef();
+ 
+ 	dev_add_pack(&bootp_packet_type);
+ }
+@@ -1379,6 +1387,7 @@ static int __init ip_auto_config(void)
+ 	int retries = CONF_OPEN_RETRIES;
+ #endif
+ 	int err;
++	unsigned int i;
+ 
+ #ifdef CONFIG_PROC_FS
+ 	proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
+@@ -1499,7 +1508,15 @@ static int __init ip_auto_config(void)
+ 		&ic_servaddr, &root_server_addr, root_server_path);
+ 	if (ic_dev_mtu)
+ 		pr_cont(", mtu=%d", ic_dev_mtu);
+-	pr_cont("\n");
++	for (i = 0; i < CONF_NAMESERVERS_MAX; i++)
++		if (ic_nameservers[i] != NONE) {
++			pr_info("     nameserver%u=%pI4",
++				i, &ic_nameservers[i]);
++			break;
++		}
++	for (i++; i < CONF_NAMESERVERS_MAX; i++)
++		if (ic_nameservers[i] != NONE)
++			pr_cont(", nameserver%u=%pI4\n", i, &ic_nameservers[i]);
+ #endif /* !SILENT */
+ 
+ 	return 0;
+@@ -1570,6 +1587,8 @@ static int __init ip_auto_config_setup(char *addrs)
+ 		return 1;
+ 	}
+ 
++	ic_nameservers_predef();
++
+ 	/* Parse string for static IP assignment.  */
+ 	ip = addrs;
+ 	while (ip && *ip) {
+@@ -1613,6 +1632,20 @@ static int __init ip_auto_config_setup(char *addrs)
+ 					ic_enable = 0;
+ 				}
+ 				break;
++			case 7:
++				if (CONF_NAMESERVERS_MAX >= 1) {
++					ic_nameservers[0] = in_aton(ip);
++					if (ic_nameservers[0] == ANY)
++						ic_nameservers[0] = NONE;
++				}
++				break;
++			case 8:
++				if (CONF_NAMESERVERS_MAX >= 2) {
++					ic_nameservers[1] = in_aton(ip);
++					if (ic_nameservers[1] == ANY)
++						ic_nameservers[1] = NONE;
++				}
++				break;
+ 			}
+ 		}
+ 		ip = cp;
configs/cubieboard2_defconfig +1 -0
index 41d5266..a2b2aef 100644
@@ -9,6 +9,7 @@ BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
+BR2_LINUX_KERNEL_PATCH="board/cubietech/cubieboard/5e953778a2aab04929a5e7b69f53dc26e39b079e.patch"
 BR2_LINUX_KERNEL_DEFCONFIG="sun7i"
 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun7i-cubieboard2.config"
 BR2_PACKAGE_SUNXI_TOOLS=y
configs/cubieboard_defconfig +1 -0
index 85dc794..566f633 100644
@@ -9,6 +9,7 @@ BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
+BR2_LINUX_KERNEL_PATCH="board/cubietech/cubieboard/5e953778a2aab04929a5e7b69f53dc26e39b079e.patch"
 BR2_LINUX_KERNEL_DEFCONFIG="sun4i"
 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun4i-cubieboard.config"
 BR2_PACKAGE_SUNXI_TOOLS=y
configs/cubietruck_defconfig +1 -0
index 01a5fc2..419b64f 100644
@@ -9,6 +9,7 @@ BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
+BR2_LINUX_KERNEL_PATCH="board/cubietech/cubieboard/5e953778a2aab04929a5e7b69f53dc26e39b079e.patch"
 BR2_LINUX_KERNEL_DEFCONFIG="sun7i"
 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun7i-cubietruck.config"
 BR2_PACKAGE_SUNXI_TOOLS=y
Signature · 1 line
2.4.6
#2 lore raw

PATCH 4/4 cubieboard: [PATCH] ipconfig: add nameserver IPs to kernel-parameter ip=

Dear Scott Fan,

Quoted 8 lines · Scott Fan
---
 .../5e953778a2aab04929a5e7b69f53dc26e39b079e.patch | 133 +++++++++++++++++++++
 configs/cubieboard2_defconfig                      |   1 +
 configs/cubieboard_defconfig                       |   1 +
 configs/cubietruck_defconfig                       |   1 +
 4 files changed, 136 insertions(+)
 create mode 100644 board/cubietech/cubieboard/5e953778a2aab04929a5e7b69f53dc26e39b079e.patch

Thanks for the patch, but unfortunately, it's not acceptable. It's clearly a feature patch for the kernel, and we generally don't accept feature patches in Buildroot. If you want to be able to set the nameserver from the ip= parameter, then please submit a patch to the Linux kernel network maintainers and get it accepted. We don't want to carry such patches forever in the Buildroot tree.

Best regards,

Thomas

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

PATCH 3/4 cubieboard: update build support for cubieboard 1/2/3.

In reply to Scott Fan

Dear Scott Fan,

Quoted 6 lines · Scott Fan

This patch update the cb1/cb2's defconfig to mainline u-boot version, and bump their linux-sunxi kernel to latest stage/sunxi-3.4 branch.

Additionally, add defconfig for cubieboard3 (a.k.a. cubietruck).

Finally, support set up the SD card only to boot from network.

Why? This is clearly not what we want as the default. What we want as the default is that the system is entirely contained on the SD card.

board/cubietech/cubieboard/mkcubiecard.sh line 6

Quoted 12 lines
board/cubietech/cubieboard/mkcubiecard.sh +6 -1
index f1d5a9f..a5bd8ec 100755
@@ -1,4 +1,9 @@
-#! /bin/sh
+#!/bin/sh
+### BEGIN INTRO
+# mkcubiecard.sh v0.2:
+# 2015, Scott Fan <[email protected]>
+# rewrite this script more clear;
+# add the 'netboot' argument, to make a network-bootable card.

Ah, so netboot is in fact optional? Please don't make the script more complicated. Our defconfigs are meant to be minimal and not offer myriads of options. So can you please remove this "netboot" feature from the script as well as the corresponding boot.env file?

board/cubietech/cubieboard/mkcubiecard.sh if [ ! -f $SPL_IMG -a ! -f $SPL_UBOOT ] || · line 64

Quoted 4 lines
board/cubietech/cubieboard/mkcubiecard.sh +4 -0
+####################
+# Preparing
+####################
+echo `fdisk -l $DRIVE | grep Disk | grep bytes`

left-over debug print?

Quoted 22 lines
board/cubietech/cubieboard/post-image.sh new file +16 -0
new file mode 100755
index 0000000..4d792a4
@@ -0,0 +1,26 @@
+#!/bin/sh
+# post-image.sh for CubieBoard
+# 2015, Scott Fan <[email protected]>
+# 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
+
+MKENVIMAGE=$HOST_DIR/usr/bin/mkenvimage
+BOOT_ENV_SIZE=0x20000
+BOOT_ENV_SRC=$BOARD_DIR/boot.env
+BOOT_ENV_BIN=$BINARIES_DIR/u-boot-env.bin
+
+# U-Boot script

board/cubietech/cubieboard/post-image.sh line 26

Quoted 10 lines
board/cubietech/cubieboard/post-image.sh new file +10 -0
+if [ -e $MKIMAGE -a -e $BOOT_CMD ];
+then
+	$MKIMAGE -C none -A arm -T script -d $BOOT_CMD $BOOT_CMD_H
+fi
+
+# U-Boot environment
+if [ -e $MKENVIMAGE -a -e $BOOT_ENV_SRC ];
+then
+	$MKENVIMAGE -s $BOOT_ENV_SIZE -o $BOOT_ENV_BIN $BOOT_ENV_SRC
+fi

Creating the binary environment can be done by Buildroot itself, use the BR2_TARGET_UBOOT_ENVIMAGE option.

board/cubietech/cubieboard/post-image.sh After building, you should obtain this tree: · line 42

Quoted 11 lines
board/cubietech/cubieboard/post-image.sh new file +3 -3
@@ -31,10 +36,10 @@ After building, you should obtain this tree:
     +-- rootfs.tar
     +-- boot.scr
     +-- script.bin
-    +-- sunxi-spl.bin
     +-- u-boot.bin
-    +-- u-boot-sunxi-with-spl.bin (optional)
-    `-- uImage
+    +-- u-boot-env.bin
+    +-- u-boot-sunxi-with-spl.bin
+    +-- uImage

So now you always have u-boot-sunxi-with-spl.bin and never sunxi-spl.bin ? If that's the case, why do you keep the logic testing if SPL_IMG exists, and if yes use it, if not fall back to SPL_UBOOT ?

board/cubietech/cubieboard/post-image.sh Use dmesg to find out where the SD card is attached in the /dev tree · line 62

Quoted 8 lines
board/cubietech/cubieboard/post-image.sh new file +1 -1
 --------------------------
 How setting up the SD card
@@ -54,9 +59,21 @@ Use dmesg to find out where the SD card is attached in the /dev tree
 where:
  - <images_dir> is the directory containing the generated files (usually
    output/images)
- - <device> is the device file of the SD card (usually /dev/sdX)
+ - <device> is the device file of the SD card (usually /dev/mmcblk0 or /dev/sdX)

mmcblkX

Quoted 26 lines
board/cubietech/cubieboard/sun4i-cubieboard.config new file +4 -0
new file mode 100644
index 0000000..43eee73
@@ -0,0 +1,4 @@
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_ROOT_NFS=y
+CONFIG_SUNXI_EMAC=y
board/cubietech/cubieboard/sun7i-cubieboard2.config new file +4 -0
new file mode 100644
index 0000000..43eee73
@@ -0,0 +1,4 @@
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_ROOT_NFS=y
+CONFIG_SUNXI_EMAC=y
board/cubietech/cubieboard/sun7i-cubietruck.config new file +0 -0
new file mode 100644
index 0000000..ff7813f

board/cubietech/cubieboard/sun7i-cubietruck.config line 4

Quoted 4 lines
board/cubietech/cubieboard/sun7i-cubietruck.config new file +4 -0
@@ -0,0 +1,4 @@
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_ROOT_NFS=y
+CONFIG_SUNXI_GMAC=y

This is great: I like the usage of config fragments!

configs/cubieboard2_defconfig line 1

Quoted 6 lines
configs/cubieboard2_defconfig +0 -1
index f85760d..41d5266 100644
@@ -1,40 +1,21 @@
-# Architecture

It would have been good to keep the comments and the general organization/ordering of the defconfig.

Quoted 120 lines
configs/cubieboard2_defconfig +10 -28
 BR2_arm=y
 BR2_cortex_a7=y
-
-# System configuration
+BR2_KERNEL_HEADERS_3_4=y
 BR2_TARGET_GENERIC_HOSTNAME="Cubieboard2"
 BR2_TARGET_GENERIC_ISSUE="Welcome to use Cubieboard!"
-BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
-BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-build.sh"
-
-# Additional tools
-BR2_PACKAGE_HOST_SUNXI_TOOLS=y
-BR2_PACKAGE_HOST_UBOOT_TOOLS=y
-BR2_PACKAGE_SUNXI_TOOLS=y
-BR2_PACKAGE_SUNXI_BOARDS=y
-BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a20/cubieboard2.fex"
-
-# Kernel headers
-BR2_KERNEL_HEADERS_3_4=y
-
-# Kernel
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="5dda5145c877335e17bd9ca48954841acc0f785a"
-BR2_LINUX_KERNEL_VERSION="sunxi-3.4"
-BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
-BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/cubietech/cubieboard/linux-cubieboard2.config"
-
-# Bootloaders
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
+BR2_LINUX_KERNEL_DEFCONFIG="sun7i"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun7i-cubieboard2.config"
+BR2_PACKAGE_SUNXI_TOOLS=y
+BR2_PACKAGE_SUNXI_BOARDS=y
+BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a20/cubieboard2.fex"
 BR2_TARGET_UBOOT=y
-BR2_TARGET_UBOOT_BOARDNAME="cubieboard2"
-BR2_TARGET_UBOOT_CUSTOM_GIT=y
-BR2_TARGET_UBOOT_VERSION="sunxi"
-BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/linux-sunxi/u-boot-sunxi.git"
-BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="b4bca5e0651b460a4511582f07a935cb48f74948"
-BR2_TARGET_UBOOT_FORMAT_BIN=y
+BR2_TARGET_UBOOT_BOARDNAME="Cubieboard2"
 BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
configs/cubieboard_defconfig +10 -28
index 1da019f..85dc794 100644
@@ -1,39 +1,21 @@
-# Architecture
 BR2_arm=y
 BR2_cortex_a8=y
-
-# System configuration
+BR2_KERNEL_HEADERS_3_4=y
 BR2_TARGET_GENERIC_HOSTNAME="Cubieboard"
 BR2_TARGET_GENERIC_ISSUE="Welcome to use Cubieboard!"
-BR2_TARGET_GENERIC_GETTY=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
-BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-build.sh"
-
-# Additional tools
-BR2_PACKAGE_HOST_SUNXI_TOOLS=y
-BR2_PACKAGE_HOST_UBOOT_TOOLS=y
-BR2_PACKAGE_SUNXI_TOOLS=y
-BR2_PACKAGE_SUNXI_BOARDS=y
-BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/cubieboard.fex"
-
-# Kernel headers
-BR2_KERNEL_HEADERS_3_4=y
-
-# Kernel
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
-BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="274a66a7bfcbaabb88d63e4eba161965383cc416"
-BR2_LINUX_KERNEL_VERSION="sunxi-3.4"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"
 BR2_LINUX_KERNEL_DEFCONFIG="sun4i"
-
-# Bootloaders
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun4i-cubieboard.config"
+BR2_PACKAGE_SUNXI_TOOLS=y
+BR2_PACKAGE_SUNXI_BOARDS=y
+BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/cubieboard.fex"
 BR2_TARGET_UBOOT=y
-BR2_TARGET_UBOOT_BOARDNAME="cubieboard"
-BR2_TARGET_UBOOT_CUSTOM_GIT=y
-BR2_TARGET_UBOOT_VERSION="sunxi"
-BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/linux-sunxi/u-boot-sunxi.git"
-BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="1a8ac55429f7f8cc9f100c1cf2dc0195cf81e76f"
-BR2_TARGET_UBOOT_FORMAT_BIN=y
+BR2_TARGET_UBOOT_BOARDNAME="Cubieboard"
 BR2_TARGET_UBOOT_SPL=y
-BR2_TARGET_UBOOT_SPL_NAME="spl/sunxi-spl.bin"
+BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
configs/cubietruck_defconfig new file +11 -0
new file mode 100644
index 0000000..01a5fc2
@@ -0,0 +1,21 @@
+BR2_arm=y
+BR2_cortex_a7=y
+BR2_KERNEL_HEADERS_3_4=y
+BR2_TARGET_GENERIC_HOSTNAME="Cubietruck"
+BR2_TARGET_GENERIC_ISSUE="Welcome to use Cubieboard!"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/cubietech/cubieboard/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d47d367036be38c5180632ec8a3ad169a4593a88"

configs/cubietruck_defconfig line 21

Quoted 10 lines
configs/cubietruck_defconfig new file +10 -0
+BR2_LINUX_KERNEL_DEFCONFIG="sun7i"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/cubietech/cubieboard/sun7i-cubietruck.config"
+BR2_PACKAGE_SUNXI_TOOLS=y
+BR2_PACKAGE_SUNXI_BOARDS=y
+BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a20/cubietruck.fex"
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="Cubietruck"
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y

Can you rework the patch according to these comments?

Thanks!

Thomas

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