All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support
@ 2016-06-09 18:55 Patrick Keroulas
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package Patrick Keroulas
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Patrick Keroulas @ 2016-06-09 18:55 UTC (permalink / raw)
  To: buildroot

This patchset adds support for the TS-4800 SoM manufactured by
Technologic Systems based on the Freescale i.MX515 SoC.

Patrick Keroulas (2):
  ts4800-mbrboot: new package
  configs: add defconfig for TS-4800

 board/technologic/ts4800/genimage.cfg    | 37 ++++++++++++++++
 board/technologic/ts4800/linux.fragment  |  3 ++
 board/technologic/ts4800/post-image.sh   | 23 ++++++++++
 configs/ts4800_defconfig                 | 30 +++++++++++++
 package/Config.in                        |  1 +
 package/ts4800-mbrboot/Config.in         |  5 +++
 package/ts4800-mbrboot/src/LICENSE       | 25 +++++++++++
 package/ts4800-mbrboot/src/Makefile      | 21 ++++++++++
 package/ts4800-mbrboot/src/mbrboot.c     | 72 ++++++++++++++++++++++++++++++++
 package/ts4800-mbrboot/src/mbrboot.ld    | 56 +++++++++++++++++++++++++
 package/ts4800-mbrboot/ts4800-mbrboot.mk | 22 ++++++++++
 11 files changed, 295 insertions(+)
 create mode 100644 board/technologic/ts4800/genimage.cfg
 create mode 100644 board/technologic/ts4800/linux.fragment
 create mode 100755 board/technologic/ts4800/post-image.sh
 create mode 100644 configs/ts4800_defconfig
 create mode 100644 package/ts4800-mbrboot/Config.in
 create mode 100644 package/ts4800-mbrboot/src/LICENSE
 create mode 100644 package/ts4800-mbrboot/src/Makefile
 create mode 100644 package/ts4800-mbrboot/src/mbrboot.c
 create mode 100644 package/ts4800-mbrboot/src/mbrboot.ld
 create mode 100644 package/ts4800-mbrboot/ts4800-mbrboot.mk

-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package
  2016-06-09 18:55 [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support Patrick Keroulas
@ 2016-06-09 18:55 ` Patrick Keroulas
  2016-07-03 15:03   ` Peter Korsgaard
  2016-07-03 15:44   ` Peter Korsgaard
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 2/2] configs: add defconfig for TS-4800 Patrick Keroulas
  2016-06-09 19:12 ` [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support Patrick Keroulas
  2 siblings, 2 replies; 8+ messages in thread
From: Patrick Keroulas @ 2016-06-09 18:55 UTC (permalink / raw)
  To: buildroot

This MBR routine is based on TS' original bootloader.  It is loaded by
the bootrom stored in the companion FPGA, and chainloads an executable
located at the beginning of the first non-fs (0xda) partition.

Signed-off-by: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
---
 package/Config.in                        |  1 +
 package/ts4800-mbrboot/Config.in         |  5 +++
 package/ts4800-mbrboot/src/LICENSE       | 25 +++++++++++
 package/ts4800-mbrboot/src/Makefile      | 21 ++++++++++
 package/ts4800-mbrboot/src/mbrboot.c     | 72 ++++++++++++++++++++++++++++++++
 package/ts4800-mbrboot/src/mbrboot.ld    | 56 +++++++++++++++++++++++++
 package/ts4800-mbrboot/ts4800-mbrboot.mk | 22 ++++++++++
 7 files changed, 202 insertions(+)
 create mode 100644 package/ts4800-mbrboot/Config.in
 create mode 100644 package/ts4800-mbrboot/src/LICENSE
 create mode 100644 package/ts4800-mbrboot/src/Makefile
 create mode 100644 package/ts4800-mbrboot/src/mbrboot.c
 create mode 100644 package/ts4800-mbrboot/src/mbrboot.ld
 create mode 100644 package/ts4800-mbrboot/ts4800-mbrboot.mk

diff --git a/package/Config.in b/package/Config.in
index 9d668bf..41b509e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -336,6 +336,7 @@ menu "Firmware"
 	source "package/linux-firmware/Config.in"
 	source "package/rpi-firmware/Config.in"
 	source "package/sunxi-boards/Config.in"
+	source "package/ts4800-mbrboot/Config.in"
 	source "package/ux500-firmware/Config.in"
 	source "package/wilc1000-firmware/Config.in"
 	source "package/zd1211-firmware/Config.in"
diff --git a/package/ts4800-mbrboot/Config.in b/package/ts4800-mbrboot/Config.in
new file mode 100644
index 0000000..556b0ec
--- /dev/null
+++ b/package/ts4800-mbrboot/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_TS4800_MBRBOOT
+	bool "ts4800-mbrboot"
+	depends on BR2_ARM_CPU_ARMV7A
+	help
+	  This package generate the ts4800 bootloader.
diff --git a/package/ts4800-mbrboot/src/LICENSE b/package/ts4800-mbrboot/src/LICENSE
new file mode 100644
index 0000000..8fa1a84
--- /dev/null
+++ b/package/ts4800-mbrboot/src/LICENSE
@@ -0,0 +1,25 @@
+    Copyright (C) 2009, Technologic Systems Inc.
+    Copyright (C) 2016, Savoir-faire Linux Inc.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/package/ts4800-mbrboot/src/Makefile b/package/ts4800-mbrboot/src/Makefile
new file mode 100644
index 0000000..b583f9f
--- /dev/null
+++ b/package/ts4800-mbrboot/src/Makefile
@@ -0,0 +1,21 @@
+COPTS=-march=armv7-a -marm -mno-thumb-interwork -Os -mno-apcs-frame -fomit-frame-pointer -ffunction-sections -fdata-sections
+
+.PHONY: all clean
+
+all: mbrboot.bin
+
+mbrboot.bin : mbrboot.elf
+	$(OBJCOPY) -S -O binary mbrboot.elf mbrboot.bin
+
+mbrboot.s : mbrboot.c
+	$(CC) -Wall $(COPTS) -S -c mbrboot.c
+
+mbrboot.o : mbrboot.c
+	$(CC) -Wall $(COPTS) -c mbrboot.c
+
+mbrboot.elf : mbrboot.o mbrboot.ld
+	$(CC) -Wl,--gc-sections -Wl,-static -o mbrboot.elf -nostdlib -Tmbrboot.ld -fno-pic mbrboot.o
+	size mbrboot.elf
+
+clean:
+	rm -f *.elf *.bin *.o
diff --git a/package/ts4800-mbrboot/src/mbrboot.c b/package/ts4800-mbrboot/src/mbrboot.c
new file mode 100644
index 0000000..b86869e
--- /dev/null
+++ b/package/ts4800-mbrboot/src/mbrboot.c
@@ -0,0 +1,72 @@
+/*
+ *     Copyright (C) 2009, Technologic Systems Inc.
+ *     Copyright (C) 2016, Savoir-faire Linux Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define MBR_LOAD_ADDR 0x96000000
+#define OS_LOAD_ADDR 0x90008000
+
+#define PARTITION_TABLE_OFFSET (MBR_LOAD_ADDR + 446)
+#define PARTITION_TABLE_ENTRY_N 4
+#define PARTITION_TABLE_ENTRY_LEN 16
+#define PARTITION_TYPE_NONFS_DATA 0xda
+
+void mbrboot(void *(unsigned int, char*, int),
+		void *(char *),
+		void __attribute__((unused)) *(void))
+		__attribute__((noreturn));
+
+void mbrboot(void *read(unsigned int, char*, int),
+		void *ser_puts(char *),
+		void __attribute__((unused)) *clock_max_func(void))
+{
+	void (*os)(void) = (void *) OS_LOAD_ADDR;
+	unsigned char *part = (unsigned char *) PARTITION_TABLE_OFFSET;
+	int i;
+
+	ser_puts("ts4800-mbrboot: searching for boot partition... ");
+
+	for (i = 0; i < PARTITION_TABLE_ENTRY_N; i++) {
+		if (part[4] == PARTITION_TYPE_NONFS_DATA) {
+			/* get partition offset and size from entry and load */
+			unsigned short *p = (unsigned short *) &part[8];
+			unsigned int start = p[0] + (p[1] << 16);
+			unsigned int size = p[2] + (p[3] << 16);
+			read(start, (char *) OS_LOAD_ADDR, size);
+			break;
+		}
+		part += PARTITION_TABLE_ENTRY_LEN;
+	}
+
+	if (i < PARTITION_TABLE_ENTRY_N)
+		ser_puts("found\r\n");
+	else
+		ser_puts("\r\nts4800-mbrboot: fatal: partition type 0xda not found\r\n");
+
+	os();
+
+	__builtin_unreachable();
+}
diff --git a/package/ts4800-mbrboot/src/mbrboot.ld b/package/ts4800-mbrboot/src/mbrboot.ld
new file mode 100644
index 0000000..8fc33b9
--- /dev/null
+++ b/package/ts4800-mbrboot/src/mbrboot.ld
@@ -0,0 +1,56 @@
+/*
+ *     Copyright (C) 2009, Technologic Systems Inc.
+ *     Copyright (C) 2016, Savoir-faire Linux Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ENTRY(mbrboot)
+
+MEMORY
+{
+	ram (rwx) : ORIGIN = 0x96000000, LENGTH = 446
+	bss (rwx) : ORIGIN = 0x96000200, LENGTH = 0x80
+}
+SECTIONS {
+	.text : AT(0x0) {
+		mbrboot.o(.text.mbrboot);
+		*(.text);
+		*(.text.*);
+		*(.glue_7 .glue_7t);
+		*(.got .got.*);
+		*(.rodata);
+		*(.rodata.*);
+		*(.data);
+		*(.data.*);
+	} > ram
+
+	.bss : {
+		bss_start = .;
+		*(.bss);
+		*(.bss.*);
+		*(COMMON);
+		bss_end = .;
+	} > bss
+}
diff --git a/package/ts4800-mbrboot/ts4800-mbrboot.mk b/package/ts4800-mbrboot/ts4800-mbrboot.mk
new file mode 100644
index 0000000..706d191
--- /dev/null
+++ b/package/ts4800-mbrboot/ts4800-mbrboot.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# ts4800-mbrboot
+#
+################################################################################
+
+TS4800_MBRBOOT_VERSION = 1.0
+TS4800_MBRBOOT_SITE = $(TOPDIR)/package/ts4800-mbrboot/src
+TS4800_MBRBOOT_SITE_METHOD = local
+TS4800_MBRBOOT_LICENSE = BSD-2c
+TS4800_MBRBOOT_LICENSE_FILES = LICENSE
+
+define TS4800_MBRBOOT_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" \
+		OBJCOPY="$(TARGET_OBJCOPY)" -C $(@D)
+endef
+
+define TS4800_MBRBOOT_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0644 $(@D)/mbrboot.bin $(BINARIES_DIR)/
+endef
+
+$(eval $(generic-package))
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v4 2/2] configs: add defconfig for TS-4800
  2016-06-09 18:55 [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support Patrick Keroulas
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package Patrick Keroulas
@ 2016-06-09 18:55 ` Patrick Keroulas
  2016-07-03 15:56   ` Peter Korsgaard
  2016-06-09 19:12 ` [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support Patrick Keroulas
  2 siblings, 1 reply; 8+ messages in thread
From: Patrick Keroulas @ 2016-06-09 18:55 UTC (permalink / raw)
  To: buildroot

The TS-4800 is supported by mainline Linux as of 4.5.

u-boot-imx had to be patched and selected as a custom U-Boot until this
fork is merged into mainline U-Boot.

A post-image script is provided to generate an image that can be "dd"
directly to an SD card.

More details on the board here:
  http://wiki.embeddedarm.com/wiki/TS-4800

Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Signed-off-by: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
---
 board/technologic/ts4800/genimage.cfg   | 37 +++++++++++++++++++++++++++++++++
 board/technologic/ts4800/linux.fragment |  3 +++
 board/technologic/ts4800/post-image.sh  | 23 ++++++++++++++++++++
 configs/ts4800_defconfig                | 30 ++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)
 create mode 100644 board/technologic/ts4800/genimage.cfg
 create mode 100644 board/technologic/ts4800/linux.fragment
 create mode 100755 board/technologic/ts4800/post-image.sh
 create mode 100644 configs/ts4800_defconfig

diff --git a/board/technologic/ts4800/genimage.cfg b/board/technologic/ts4800/genimage.cfg
new file mode 100644
index 0000000..4e47095
--- /dev/null
+++ b/board/technologic/ts4800/genimage.cfg
@@ -0,0 +1,37 @@
+image boot.vfat {
+        vfat {
+                files = {
+                        "zImage",
+                        "imx51-ts4800.dtb"
+                }
+        }
+        size = 8M
+}
+
+image sdcard.img {
+        hdimage {
+        }
+
+        partition mbrboot {
+                in-partition-table = "no"
+                image = "mbrboot.bin"
+                offset = 0
+        }
+
+        partition uboot {
+                partition-type = 0xda
+                image = "u-boot.bin"
+                size = 8M
+        }
+
+        partition kernel {
+                partition-type = 0xC
+                image = "boot.vfat"
+        }
+
+        partition rootfs {
+                partition-type = 0x83
+                image = "rootfs.ext4"
+                size = 256M
+        }
+}
diff --git a/board/technologic/ts4800/linux.fragment b/board/technologic/ts4800/linux.fragment
new file mode 100644
index 0000000..0451c86
--- /dev/null
+++ b/board/technologic/ts4800/linux.fragment
@@ -0,0 +1,3 @@
+CONFIG_TOUCHSCREEN_TS4800=y
+CONFIG_TS4800_WATCHDOG=y
+CONFIG_TS4800_IRQ=y
diff --git a/board/technologic/ts4800/post-image.sh b/board/technologic/ts4800/post-image.sh
new file mode 100755
index 0000000..03b909f
--- /dev/null
+++ b/board/technologic/ts4800/post-image.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Copyright (C) 2015 Savoir-faire Linux
+# Post image generation script.
+
+IDIR="$1"
+
+BOARD_DIR="board/technologic/ts4800"
+GENIMAGE_CFG_DEFAULT="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_CFG=${GENIMAGE_CFG_DEFAULT}
+GENIMAGE_TMP=${BUILD_DIR}/.genimage_tmp
+
+${HOST_DIR}/usr/bin/genimage \
+        --config ${GENIMAGE_CFG} \
+        --rootpath ${TARGET_DIR} \
+        --tmppath ${GENIMAGE_TMP} \
+        --inputpath $IDIR \
+        --outputpath $IDIR
+
+ret=${?}
+rm -rf ${GENIMAGE_TMP}
+exit ${ret}
+
diff --git a/configs/ts4800_defconfig b/configs/ts4800_defconfig
new file mode 100644
index 0000000..ec1778a
--- /dev/null
+++ b/configs/ts4800_defconfig
@@ -0,0 +1,30 @@
+BR2_arm=y
+BR2_cortex_a8=y
+BR2_ARM_FPU_NEON=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_5=y
+BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
+BR2_BINUTILS_VERSION_2_24_X=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
+BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
+# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/technologic/ts4800/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_DEFCONFIG="imx_v6_v7"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(TOPDIR)/board/technologic/ts4800/linux.fragment"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx51-ts4800"
+BR2_PACKAGE_BUSYBOX_WATCHDOG=y
+BR2_PACKAGE_FBTERM=y
+BR2_PACKAGE_TS4800_MBRBOOT=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="git://git.denx.de/u-boot-imx.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="d2ba7a6adcef6e6f8c4418c7b0caf9d7ab98a6d4"
+BR2_TARGET_UBOOT_BOARDNAME="ts4800"
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_SQUASHFS=y
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support
  2016-06-09 18:55 [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support Patrick Keroulas
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package Patrick Keroulas
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 2/2] configs: add defconfig for TS-4800 Patrick Keroulas
@ 2016-06-09 19:12 ` Patrick Keroulas
  2 siblings, 0 replies; 8+ messages in thread
From: Patrick Keroulas @ 2016-06-09 19:12 UTC (permalink / raw)
  To: buildroot

Hi all,

v3 included 2 patches that were integrated in u-boot-imx recently.
In v4, this fork is selected as a custom U-boot until it's merge
into mainline U-boot and the patches were removed from 
board/technologic/ts4800/.

Thanks,

Patrick

----- On Jun 9, 2016, at 2:55 PM, Patrick Keroulas patrick.keroulas at savoirfairelinux.com wrote:

> This patchset adds support for the TS-4800 SoM manufactured by
> Technologic Systems based on the Freescale i.MX515 SoC.
> 
> Patrick Keroulas (2):
> ts4800-mbrboot: new package
> configs: add defconfig for TS-4800
> 
> board/technologic/ts4800/genimage.cfg | 37 ++++++++++++++++
> board/technologic/ts4800/linux.fragment | 3 ++
> board/technologic/ts4800/post-image.sh | 23 ++++++++++
> configs/ts4800_defconfig | 30 +++++++++++++
> package/Config.in | 1 +
> package/ts4800-mbrboot/Config.in | 5 +++
> package/ts4800-mbrboot/src/LICENSE | 25 +++++++++++
> package/ts4800-mbrboot/src/Makefile | 21 ++++++++++
> package/ts4800-mbrboot/src/mbrboot.c | 72 ++++++++++++++++++++++++++++++++
> package/ts4800-mbrboot/src/mbrboot.ld | 56 +++++++++++++++++++++++++
> package/ts4800-mbrboot/ts4800-mbrboot.mk | 22 ++++++++++
> 11 files changed, 295 insertions(+)
> create mode 100644 board/technologic/ts4800/genimage.cfg
> create mode 100644 board/technologic/ts4800/linux.fragment
> create mode 100755 board/technologic/ts4800/post-image.sh
> create mode 100644 configs/ts4800_defconfig
> create mode 100644 package/ts4800-mbrboot/Config.in
> create mode 100644 package/ts4800-mbrboot/src/LICENSE
> create mode 100644 package/ts4800-mbrboot/src/Makefile
> create mode 100644 package/ts4800-mbrboot/src/mbrboot.c
> create mode 100644 package/ts4800-mbrboot/src/mbrboot.ld
> create mode 100644 package/ts4800-mbrboot/ts4800-mbrboot.mk
> 
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package Patrick Keroulas
@ 2016-07-03 15:03   ` Peter Korsgaard
  2016-07-03 15:44   ` Peter Korsgaard
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2016-07-03 15:03 UTC (permalink / raw)
  To: buildroot

>>>>> "Patrick" == Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> writes:

 > This MBR routine is based on TS' original bootloader.  It is loaded by
 > the bootrom stored in the companion FPGA, and chainloads an executable
 > located at the beginning of the first non-fs (0xda) partition.

 > Signed-off-by: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>

Is there no official upstream location for this so we don't need to
carry it inside Buildroot? I know it is small, but still.

 > diff --git a/package/ts4800-mbrboot/ts4800-mbrboot.mk b/package/ts4800-mbrboot/ts4800-mbrboot.mk
 > new file mode 100644
 > index 0000000..706d191
 > --- /dev/null
 > +++ b/package/ts4800-mbrboot/ts4800-mbrboot.mk
 > @@ -0,0 +1,22 @@
 > +################################################################################
 > +#
 > +# ts4800-mbrboot
 > +#
 > +################################################################################
 > +
 > +TS4800_MBRBOOT_VERSION = 1.0
 > +TS4800_MBRBOOT_SITE = $(TOPDIR)/package/ts4800-mbrboot/src
 > +TS4800_MBRBOOT_SITE_METHOD = local

That's not really nice. If we have to include it inside buildroot then I
would prefer to handle it like we do for E.G. makedevs.


> +TS4800_MBRBOOT_LICENSE = BSD-2c
 > +TS4800_MBRBOOT_LICENSE_FILES = LICENSE
 > +
 > +define TS4800_MBRBOOT_BUILD_CMDS
 > +	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" \
 > +		OBJCOPY="$(TARGET_OBJCOPY)" -C $(@D)

please use $(TARGET_CONFIGURE_OPTS) instead.

> +endef
 > +
 > +define TS4800_MBRBOOT_INSTALL_TARGET_CMDS
 > +	$(INSTALL) -m 0644 $(@D)/mbrboot.bin $(BINARIES_DIR)/

We normally use install -D, so I would prefer to use that here as well.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package Patrick Keroulas
  2016-07-03 15:03   ` Peter Korsgaard
@ 2016-07-03 15:44   ` Peter Korsgaard
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2016-07-03 15:44 UTC (permalink / raw)
  To: buildroot

>>>>> "Patrick" == Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> writes:

One more issue:

 > +mbrboot.elf : mbrboot.o mbrboot.ld
 > +	$(CC) -Wl,--gc-sections -Wl,-static -o mbrboot.elf -nostdlib -Tmbrboot.ld -fno-pic mbrboot.o
 > +	size mbrboot.elf

With at least our current Linaro external toolchain, this ends up with a
2.4G big file.

It reminds me of a similar problem in the Linux kernel from some years
ago:

commit 1e621a8e3752367d4aae78a8ab00a18fb2793f34
Author: Lennert Buytenhek <buytenh@wantstofly.org>
Date:   Fri Oct 12 14:38:54 2007 +0100

    [ARM] 4600/1: fix kernel build failure with build-id-supporting binutils

    Newer versions of binutils support --build-id, which adds an ELF
    note section called ".note.gnu.build-id" to the output.  On the ARM
    kernel build, because there is no explicit mention of this section
    in the shipped ld script, this section is placed at vaddr 0x00000000
    (whereas the normal kernel text/data typically starts at vaddr
    0xc0008000), causing the output of objcopy (Image) to produce a 3G+
    file.

    This patch makes objcopy strip the .note.gnu.build-id section from
    the Image file along with all other note sections, which fixes the
    build.

    Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=1e621a8e3752367d4aae78a8ab00a18fb2793f34

And indeed, passing -R .note.gnu.build-id to objcopy fixes it - So that
might be worth including.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v4 2/2] configs: add defconfig for TS-4800
  2016-06-09 18:55 ` [Buildroot] [PATCH v4 2/2] configs: add defconfig for TS-4800 Patrick Keroulas
@ 2016-07-03 15:56   ` Peter Korsgaard
  2016-07-08 16:06     ` Patrick Keroulas
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2016-07-03 15:56 UTC (permalink / raw)
  To: buildroot

>>>>> "Patrick" == Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> writes:

 > The TS-4800 is supported by mainline Linux as of 4.5.
 > u-boot-imx had to be patched and selected as a custom U-Boot until this
 > fork is merged into mainline U-Boot.

 > A post-image script is provided to generate an image that can be "dd"
 > directly to an SD card.

 > More details on the board here:
 >   http://wiki.embeddedarm.com/wiki/TS-4800

 > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
 > Signed-off-by: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com>
 > ---
 >  board/technologic/ts4800/genimage.cfg   | 37 +++++++++++++++++++++++++++++++++
 >  board/technologic/ts4800/linux.fragment |  3 +++
 >  board/technologic/ts4800/post-image.sh  | 23 ++++++++++++++++++++
 >  configs/ts4800_defconfig                | 30 ++++++++++++++++++++++++++
 >  4 files changed, 93 insertions(+)
 >  create mode 100644 board/technologic/ts4800/genimage.cfg
 >  create mode 100644 board/technologic/ts4800/linux.fragment
 >  create mode 100755 board/technologic/ts4800/post-image.sh
 >  create mode 100644 configs/ts4800_defconfig

 > diff --git a/board/technologic/ts4800/genimage.cfg b/board/technologic/ts4800/genimage.cfg
 > new file mode 100644
 > index 0000000..4e47095
 > --- /dev/null
 > +++ b/board/technologic/ts4800/genimage.cfg
 > @@ -0,0 +1,37 @@
 > +image boot.vfat {
 > +        vfat {
 > +                files = {
 > +                        "zImage",
 > +                        "imx51-ts4800.dtb"
 > +                }
 > +        }
 > +        size = 8M
 > +}
 > +
 > +image sdcard.img {
 > +        hdimage {
 > +        }
 > +
 > +        partition mbrboot {
 > +                in-partition-table = "no"
 > +                image = "mbrboot.bin"
 > +                offset = 0
 > +        }

Does genimage really handle this correctly (E.G. doesn't overwrite the
bootloader when it writes the MBR)? I know that we at least postprocess
the genimage output for odroid2 where a similar boot logic is used
(board/hardkernel/odroidc2/post-image.sh)

> +
 > +        partition uboot {
 > +                partition-type = 0xda
 > +                image = "u-boot.bin"
 > +                size = 8M

Any particular reason why this is so big?

 > +${HOST_DIR}/usr/bin/genimage \
 > +        --config ${GENIMAGE_CFG} \
 > +        --rootpath ${TARGET_DIR} \
 > +        --tmppath ${GENIMAGE_TMP} \
 > +        --inputpath $IDIR \
 > +        --outputpath $IDIR
 > +
 > +ret=${?}
 > +rm -rf ${GENIMAGE_TMP}
 > +exit ${ret}
 > +

Empty trailing line. Other post-image scripts don't explicitly cleanup
the tmppath afterwards (instead do it before calling genimage). Any
specific reason to do it differently here?

> diff --git a/configs/ts4800_defconfig b/configs/ts4800_defconfig
 > new file mode 100644
 > index 0000000..ec1778a
 > --- /dev/null
 > +++ b/configs/ts4800_defconfig
 > @@ -0,0 +1,30 @@
 > +BR2_arm=y
 > +BR2_cortex_a8=y
 > +BR2_ARM_FPU_NEON=y

Why? That is normally not a good choice for compatibility reasons.

 > +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_5=y

Why not 4.6?


> +BR2_TOOLCHAIN_BUILDROOT_LOCALE=y

Our basic defconfigs should be minimal. Why do you want to enable locale
support?

 > +BR2_BINUTILS_VERSION_2_24_X=y

Why? Is this because of the objcopy issue? If so, that would be fixed by
the -R .note.gnu.build-id option.

 > +BR2_TOOLCHAIN_BUILDROOT_CXX=y

Same as for locale.

 > +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y

Any specific reason (E.G. firmware loading or what not) for wanting mdev?

 > +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
 > +BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y

Are the kernel defaults not ok?

> +# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
 > +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/technologic/ts4800/post-image.sh"
 > +BR2_LINUX_KERNEL=y
 > +BR2_LINUX_KERNEL_DEFCONFIG="imx_v6_v7"
 > +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(TOPDIR)/board/technologic/ts4800/linux.fragment"
 > +BR2_LINUX_KERNEL_DTS_SUPPORT=y
 > +BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx51-ts4800"

You forgot to lock it to 4.5

 > +BR2_PACKAGE_BUSYBOX_WATCHDOG=y
 > +BR2_PACKAGE_FBTERM=y

Are these _REALLY_ needed for anything?

> +BR2_PACKAGE_TS4800_MBRBOOT=y
 > +BR2_TARGET_ROOTFS_EXT2=y
 > +BR2_TARGET_ROOTFS_EXT2_4=y
 > +# BR2_TARGET_ROOTFS_TAR is not set
 > +BR2_TARGET_UBOOT=y
 > +BR2_TARGET_UBOOT_CUSTOM_GIT=y
 > +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="git://git.denx.de/u-boot-imx.git"
 > +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="d2ba7a6adcef6e6f8c4418c7b0caf9d7ab98a6d4"
 > +BR2_TARGET_UBOOT_BOARDNAME="ts4800"
 > +BR2_PACKAGE_HOST_GENIMAGE=y

You create a fat filesystem with genimage, so you also need:

BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_MTOOLS=y

> +BR2_PACKAGE_HOST_SQUASHFS=y

Why? You don't seem to use it anywhere?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v4 2/2] configs: add defconfig for TS-4800
  2016-07-03 15:56   ` Peter Korsgaard
@ 2016-07-08 16:06     ` Patrick Keroulas
  0 siblings, 0 replies; 8+ messages in thread
From: Patrick Keroulas @ 2016-07-08 16:06 UTC (permalink / raw)
  To: buildroot

Hello Peter,

Thank you for the review. I've followed every suggestion except two:

----- On Jul 3, 2016, at 11:56 AM, Peter Korsgaard peter at korsgaard.com wrote:
>>>>>> "Patrick" == Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> writes:
>> +++ b/board/technologic/ts4800/genimage.cfg
>> @@ -0,0 +1,37 @@
>> +image boot.vfat {
>> + vfat {
>> + files = {
>> + "zImage",
>> + "imx51-ts4800.dtb"
>> + }
>> + }
>> + size = 8M
>> +}
>> +
>> +image sdcard.img {
>> + hdimage {
>> + }
>> +
>> + partition mbrboot {
>> + in-partition-table = "no"
>> + image = "mbrboot.bin"
>> + offset = 0
>> + }
> 
> Does genimage really handle this correctly (E.G. doesn't overwrite the
> bootloader when it writes the MBR)? I know that we at least postprocess
> the genimage output for odroid2 where a similar boot logic is used
> (board/hardkernel/odroidc2/post-image.sh)

mbrboot.bin size is 238B and genimage writes the partition table @ offset=446 
and the bootloader partition @offset=512. So, nothing should be overwritten.
The output image was fully tested on target.

>> +BR2_PACKAGE_BUSYBOX_WATCHDOG=y
>> +BR2_PACKAGE_FBTERM=y
> 
> Are these _REALLY_ needed for anything?

The tested base board has a touchscreen, but FBTERM is not absolutely
necessary for ts-4800 module and will be removed. 
However, the watchdog is needed because it is enabled by u-boot and
the associated driver is part of the kernel config.

Thank you,

Patrick 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-07-08 16:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09 18:55 [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support Patrick Keroulas
2016-06-09 18:55 ` [Buildroot] [PATCH v4 1/2] ts4800-mbrboot: new package Patrick Keroulas
2016-07-03 15:03   ` Peter Korsgaard
2016-07-03 15:44   ` Peter Korsgaard
2016-06-09 18:55 ` [Buildroot] [PATCH v4 2/2] configs: add defconfig for TS-4800 Patrick Keroulas
2016-07-03 15:56   ` Peter Korsgaard
2016-07-08 16:06     ` Patrick Keroulas
2016-06-09 19:12 ` [Buildroot] [PATCH v4 0/2] ARM: ts4800: add basic board support Patrick Keroulas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.