All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/3] uccp420wlan: new package
@ 2017-02-27 13:37 Abhimanyu V
  2017-02-27 13:38 ` [Buildroot] [PATCH v3 2/3] Export LINUX_DIR for post-build scripts Abhimanyu V
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Abhimanyu V @ 2017-02-27 13:37 UTC (permalink / raw)
  To: buildroot

From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>

Wifi kernel module and firmware for Imagination explorer RPU

Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
---
 Changes v1->v2
  - add hash file
 Changes v2->v3 (Suggested by Arnout)
  - remove patch and bump version
  - add proprietary license file to LICENSE_FILES
  - Fix help text indentation to below 72 columns

 package/Config.in                    |  1 +
 package/uccp420wlan/Config.in        | 14 ++++++++++++++
 package/uccp420wlan/uccp420wlan.hash |  2 ++
 package/uccp420wlan/uccp420wlan.mk   | 20 ++++++++++++++++++++
 4 files changed, 37 insertions(+)
 create mode 100644 package/uccp420wlan/Config.in
 create mode 100644 package/uccp420wlan/uccp420wlan.hash
 create mode 100644 package/uccp420wlan/uccp420wlan.mk

diff --git a/package/Config.in b/package/Config.in
index deff0fe..955f310 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -476,6 +476,7 @@ endmenu
 	source "package/triggerhappy/Config.in"
 	source "package/uboot-tools/Config.in"
 	source "package/ubus/Config.in"
+	source "package/uccp420wlan/Config.in"
 	source "package/udev/Config.in"
 	source "package/udisks/Config.in"
 	source "package/upower/Config.in"
diff --git a/package/uccp420wlan/Config.in b/package/uccp420wlan/Config.in
new file mode 100644
index 0000000..40abc8e
--- /dev/null
+++ b/package/uccp420wlan/Config.in
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_UCCP420WLAN
+	bool "uccp420wlan"
+	depends on BR2_LINUX_KERNEL
+	help
+	  SoftMAC (mac80211) based WiFi driver for Imagination's
+	  Explorer RPU uccp420. This supports Dual Band WiFi with
+	  2.4GHz - 2x2 b/g/n 40MHz, 5GHz - 2x2 a/n/11ac 80MHz modes
+
+	  Used in creator ci40 board.
+
+	  https://github.com/CreatorDev/uccp420wlan
+
+comment "uccp420wlan needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
diff --git a/package/uccp420wlan/uccp420wlan.hash b/package/uccp420wlan/uccp420wlan.hash
new file mode 100644
index 0000000..41f60a4
--- /dev/null
+++ b/package/uccp420wlan/uccp420wlan.hash
@@ -0,0 +1,2 @@
+# locally computed hash
+sha256 1d4de62fc842dbab739708cf0d9ebce270fcdf63c1c13ac676cbc253acdaa3bb uccp420wlan-v6.9.1.tar.gz
diff --git a/package/uccp420wlan/uccp420wlan.mk b/package/uccp420wlan/uccp420wlan.mk
new file mode 100644
index 0000000..4676ef3
--- /dev/null
+++ b/package/uccp420wlan/uccp420wlan.mk
@@ -0,0 +1,20 @@
+################################################################################
+#
+# uccp420wlan
+#
+################################################################################
+
+UCCP420WLAN_VERSION = v6.9.1
+UCCP420WLAN_SITE = $(call github,CreatorDev,uccp420wlan,$(UCCP420WLAN_VERSION))
+UCCP420WLAN_LICENSE = GPLv2 (kernel module), proprietary (firmware blob)
+UCCP420WLAN_LICENSE_FILES = COPYING firmware/LICENSE.imagination
+
+define UCCP420WLAN_INSTALL_FIRMWARE
+	mkdir -p $(TARGET_DIR)/lib/firmware/img/uccp420wlan
+	cp $(@D)/firmware/*.ldr $(TARGET_DIR)/lib/firmware/img/uccp420wlan
+endef
+
+UCCP420WLAN_POST_INSTALL_TARGET_HOOKS += UCCP420WLAN_INSTALL_FIRMWARE
+
+$(eval $(kernel-module))
+$(eval $(generic-package))
-- 
2.7.4

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

* [Buildroot] [PATCH v3 2/3] Export LINUX_DIR for post-build scripts
  2017-02-27 13:37 [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Abhimanyu V
@ 2017-02-27 13:38 ` Abhimanyu V
  2017-03-13 23:04   ` Arnout Vandecappelle
  2017-02-27 13:38 ` [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40 Abhimanyu V
  2017-03-14  9:04 ` [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Arnout Vandecappelle
  2 siblings, 1 reply; 10+ messages in thread
From: Abhimanyu V @ 2017-02-27 13:38 UTC (permalink / raw)
  To: buildroot

From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>

To build fitImage in post-build scripts, we need compressed
kernel binary which is intermediate target, hence doesnt get
copied to output/images folder.

Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 9663d15..5c8a934 100644
--- a/Makefile
+++ b/Makefile
@@ -464,6 +464,7 @@ export STAGING_DIR
 export HOST_DIR
 export BINARIES_DIR
 export BASE_DIR
+export LINUX_DIR
 
 ################################################################################
 #
-- 
2.7.4

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

* [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40
  2017-02-27 13:37 [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Abhimanyu V
  2017-02-27 13:38 ` [Buildroot] [PATCH v3 2/3] Export LINUX_DIR for post-build scripts Abhimanyu V
@ 2017-02-27 13:38 ` Abhimanyu V
  2017-03-14  8:57   ` Arnout Vandecappelle
  2017-03-14  9:04 ` [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Arnout Vandecappelle
  2 siblings, 1 reply; 10+ messages in thread
From: Abhimanyu V @ 2017-02-27 13:38 UTC (permalink / raw)
  To: buildroot

From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>

Also add post-build script to create fitImage which is used
by u-boot to boot the device. It also add post-image script
to generate sdcard.img for preparing sdcard/usb device

Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
---
 Changes v1->v2
  - No change
 Changes v2->v3 (Suggested by Arnout)
  - Remove uImage and add fitImage generation
  - Tidy readme.txt
  - Tidy ci40_defconfig, remove custom toolchain and add wifi helper packages
  Some changes are not done:
  - Using git-helper:
    - Custom kernel doesnt provide tar file, so it didnt work for me

 board/ci40/create_fitImage.sh | 29 ++++++++++++++++++++++
 board/ci40/fitImage.its       | 52 +++++++++++++++++++++++++++++++++++++++
 board/ci40/genimage.cfg       | 13 ++++++++++
 board/ci40/post-image.sh      | 15 ++++++++++++
 board/ci40/readme.txt         | 57 +++++++++++++++++++++++++++++++++++++++++++
 configs/ci40_defconfig        | 47 +++++++++++++++++++++++++++++++++++
 6 files changed, 213 insertions(+)
 create mode 100755 board/ci40/create_fitImage.sh
 create mode 100644 board/ci40/fitImage.its
 create mode 100644 board/ci40/genimage.cfg
 create mode 100755 board/ci40/post-image.sh
 create mode 100644 board/ci40/readme.txt
 create mode 100644 configs/ci40_defconfig

diff --git a/board/ci40/create_fitImage.sh b/board/ci40/create_fitImage.sh
new file mode 100755
index 0000000..6ad9b3a
--- /dev/null
+++ b/board/ci40/create_fitImage.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# inputs
+BOARD_DIR="$(dirname $0)"
+FIT_ITS_FILE=$BOARD_DIR/fitImage.its
+MKIMAGE=$HOST_DIR/usr/bin/mkimage
+UIMAGE=$BINARIES_DIR/uImage
+
+#output
+MODIFIED_FIT_ITS=$BINARIES_DIR/fitImage.its
+FITIMAGE=$BINARIES_DIR/fitImage
+
+# Extract kernel load address and entry address from uImage
+load=0x$($MKIMAGE -l $UIMAGE | grep "Load Address: " | sed 's/Load Address: //g')
+entry=0x$($MKIMAGE -l $UIMAGE | grep "Entry Point:  " | sed 's/Entry Point:  //g')
+
+# Create a copy of fitImage.its file and replace these address in that file
+cp $FIT_ITS_FILE $MODIFIED_FIT_ITS
+sed -i "s/load = <0>;/load = <$load>;/1" $MODIFIED_FIT_ITS
+sed -i "s/entry = <0>;/entry = <$entry>;/1" $MODIFIED_FIT_ITS
+
+# copy vmlinux.bin.gz to output/images, it is used in .its file
+cp -a $LINUX_DIR/arch/mips/boot/vmlinux.bin.gz $BINARIES_DIR
+
+# create fitImage
+$MKIMAGE -f $MODIFIED_FIT_ITS $FITIMAGE
+
+# copy to target
+cp -a $FITIMAGE $TARGET_DIR/fitImage
diff --git a/board/ci40/fitImage.its b/board/ci40/fitImage.its
new file mode 100644
index 0000000..0812eb3
--- /dev/null
+++ b/board/ci40/fitImage.its
@@ -0,0 +1,52 @@
+/*
+ * Description file for fitImage
+ */
+
+/dts-v1/;
+
+/ {
+	description = "Buildroot CI40 FTD Image";
+	#address-cells = <1>;
+
+	images {
+		kernel at 1 {
+			description = "Linux kernel";
+			data = /incbin/("./vmlinux.bin.gz");
+			type = "kernel";
+			arch = "mips";
+			os = "linux";
+			compression = "gzip";
+			load = <0>;
+			entry = <0>;
+			hash at 1 {
+				algo = "crc32";
+			};
+			hash at 2 {
+				algo = "sha1";
+			};
+		};
+		marduk-fdt at 1 {
+			description = "CI40 Flattened Device Tree blob";
+			data = /incbin/("./pistachio_marduk.dtb");
+			type = "flat_dt";
+			arch = "mips";
+			compression = "none";
+			hash at 1 {
+				algo = "crc32";
+			};
+			hash at 2 {
+				algo = "sha1";
+			};
+		};
+	};
+
+	configurations {
+		default = "config at 1";
+		config at 1 {
+			description = "CI40 dtb";
+			kernel = "kernel at 1";
+			fdt = "marduk-fdt at 1";
+		};
+	};
+};
+
diff --git a/board/ci40/genimage.cfg b/board/ci40/genimage.cfg
new file mode 100644
index 0000000..8b4303a
--- /dev/null
+++ b/board/ci40/genimage.cfg
@@ -0,0 +1,13 @@
+# Minimal SD card image
+#
+
+image sdcard.img {
+  hdimage {
+  }
+
+  partition rootfs {
+    partition-type = 0x83
+    image = "rootfs.ext4"
+    size = 256M # Maximum firmware size in partition is 268M
+  }
+}
diff --git a/board/ci40/post-image.sh b/board/ci40/post-image.sh
new file mode 100755
index 0000000..18e76aa
--- /dev/null
+++ b/board/ci40/post-image.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+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}"
+
diff --git a/board/ci40/readme.txt b/board/ci40/readme.txt
new file mode 100644
index 0000000..252c19d
--- /dev/null
+++ b/board/ci40/readme.txt
@@ -0,0 +1,57 @@
+*********************
+* MIPS Creator CI40 *
+*********************
+
+The 'ci40_defconfig' will create a root filesystem and a fitImage
+under the 'output/images/' directory. This document will try to explain how
+to use them in order to run Buildroot in the MIPS Creator CI40 board.
+
+Prepare USB/MMC for boot
+------------------------
+It can be done 2 ways:
+
+1. Using "sdcard.img" file created in output/images folder
+
+Use following command to write image to bootable device
+
+# dd if=./output/images/sdcard.img of=/dev/<your-microsd-or-usb-device>
+
+2. Manually preparing USB/MMC device
+
+Extract the generated root filesystem "rootfs.tar" into a ext4 formatted
+USB drive or SD-Card.
+
+Booting from USB/MMC
+--------------------
+Here you have the instructions to boot from the two of them. You have to
+choose the one you prefer:
+
+From USB
+  pistachio # run usbboot
+
+From SD-Card
+  pistachio # run mmcboot
+
+Booting from network (nfsboot)
+------------------------------
+Prepare nfs root and extract rootfs.tar file into it.
+
+  pistachio # setenv serverip <server-ip-address>
+  pistachio # setenv rootpath <nfs root path>
+  pistachio # run netboot
+
+Flash new bootloader
+--------------------
+After booting with above method. Copy file u-boot-pistachio_marduk-2015.10-v1.0.4.img
+to /tmp. Use following command to flash new bootloader:
+
+# flashcp -v /tmp/u-boot-pistachio_marduk-2015.10-v1.0.4.img /dev/mtd0
+
+Online docs
+-----------
+mostly for openwrt but it also applicable on buildroot
+https://docs.creatordev.io/ci40/guides/openwrt-platform/#overview
+
+Prebuilt uboot
+--------------
+http://downloads.creatordev.io/?q=u-boot/
diff --git a/configs/ci40_defconfig b/configs/ci40_defconfig
new file mode 100644
index 0000000..cf5972e
--- /dev/null
+++ b/configs/ci40_defconfig
@@ -0,0 +1,47 @@
+# architecture
+BR2_mipsel=y
+BR2_mips_32r2=y
+
+# linux header same as custom kernel ie 4.4.x
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y
+
+# kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/CreatorDev/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="openwrt-4.4.14"
+BR2_LINUX_KERNEL_DEFCONFIG="pistachio"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="img/pistachio_marduk"
+
+# bootloader flash support
+BR2_PACKAGE_MTD=y
+
+# wireless firmware
+BR2_PACKAGE_UCCP420WLAN=y
+
+# wireless package
+BR2_PACKAGE_WIRELESS_TOOLS=y
+BR2_PACKAGE_WPA_SUPPLICANT=y
+BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
+
+# bootloader
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="pistachio_marduk"
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="https://github.com/CreatorDev/u-boot/archive/v1.0.4.tar.gz"
+BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-pistachio_marduk-2015.10-v1.0.4.img"
+
+# fitimage / image generation
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/ci40/create_fitImage.sh"
+
+# image generation
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/ci40/post-image.sh"
+
-- 
2.7.4

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

* [Buildroot] [PATCH v3 2/3] Export LINUX_DIR for post-build scripts
  2017-02-27 13:38 ` [Buildroot] [PATCH v3 2/3] Export LINUX_DIR for post-build scripts Abhimanyu V
@ 2017-03-13 23:04   ` Arnout Vandecappelle
  0 siblings, 0 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2017-03-13 23:04 UTC (permalink / raw)
  To: buildroot



On 27-02-17 14:38, Abhimanyu V wrote:
> From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
> 
> To build fitImage in post-build scripts, we need compressed
> kernel binary which is intermediate target, hence doesnt get
> copied to output/images folder.
> 
> Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
> Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Makefile b/Makefile
> index 9663d15..5c8a934 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -464,6 +464,7 @@ export STAGING_DIR
>  export HOST_DIR
>  export BINARIES_DIR
>  export BASE_DIR
> +export LINUX_DIR

 I don't really like how we are exporting random variables. You never know if
some package is using it internally and gives it some different meaning.
Therefore, I'd prefer to add it to EXTRA_ENV, which also makes it available to
post-build scripts.

 Regards,
 Arnout

>  
>  ################################################################################
>  #
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40
  2017-02-27 13:38 ` [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40 Abhimanyu V
@ 2017-03-14  8:57   ` Arnout Vandecappelle
  2017-03-15  7:06     ` Abhimanyu V
  0 siblings, 1 reply; 10+ messages in thread
From: Arnout Vandecappelle @ 2017-03-14  8:57 UTC (permalink / raw)
  To: buildroot



On 27-02-17 14:38, Abhimanyu V wrote:
> From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
> 
> Also add post-build script to create fitImage which is used
> by u-boot to boot the device. It also add post-image script
> to generate sdcard.img for preparing sdcard/usb device
> 
> Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
> Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
> ---
>  Changes v1->v2
>   - No change
>  Changes v2->v3 (Suggested by Arnout)
>   - Remove uImage and add fitImage generation
>   - Tidy readme.txt
>   - Tidy ci40_defconfig, remove custom toolchain and add wifi helper packages
>   Some changes are not done:
>   - Using git-helper:
>     - Custom kernel doesnt provide tar file, so it didnt work for me

 Works for me:
https://github.com/CreatorDev/linux/archive/openwrt-4.4.14/linux-openwrt-4.4.14.tar.gz


> 
>  board/ci40/create_fitImage.sh | 29 ++++++++++++++++++++++
>  board/ci40/fitImage.its       | 52 +++++++++++++++++++++++++++++++++++++++
>  board/ci40/genimage.cfg       | 13 ++++++++++
>  board/ci40/post-image.sh      | 15 ++++++++++++
>  board/ci40/readme.txt         | 57 +++++++++++++++++++++++++++++++++++++++++++
>  configs/ci40_defconfig        | 47 +++++++++++++++++++++++++++++++++++
>  6 files changed, 213 insertions(+)
>  create mode 100755 board/ci40/create_fitImage.sh
>  create mode 100644 board/ci40/fitImage.its
>  create mode 100644 board/ci40/genimage.cfg
>  create mode 100755 board/ci40/post-image.sh
>  create mode 100644 board/ci40/readme.txt
>  create mode 100644 configs/ci40_defconfig
> 
> diff --git a/board/ci40/create_fitImage.sh b/board/ci40/create_fitImage.sh
> new file mode 100755
> index 0000000..6ad9b3a
> --- /dev/null
> +++ b/board/ci40/create_fitImage.sh
> @@ -0,0 +1,29 @@
> +#!/bin/sh
> +
> +# inputs
> +BOARD_DIR="$(dirname $0)"
> +FIT_ITS_FILE=$BOARD_DIR/fitImage.its

 Since this is a template file, call it fitImage.its.in

> +MKIMAGE=$HOST_DIR/usr/bin/mkimage
> +UIMAGE=$BINARIES_DIR/uImage
> +
> +#output
> +MODIFIED_FIT_ITS=$BINARIES_DIR/fitImage.its
> +FITIMAGE=$BINARIES_DIR/fitImage
> +
> +# Extract kernel load address and entry address from uImage
> +load=0x$($MKIMAGE -l $UIMAGE | grep "Load Address: " | sed 's/Load Address: //g')
> +entry=0x$($MKIMAGE -l $UIMAGE | grep "Entry Point:  " | sed 's/Entry Point:  //g')
> +
> +# Create a copy of fitImage.its file and replace these address in that file
> +cp $FIT_ITS_FILE $MODIFIED_FIT_ITS
> +sed -i "s/load = <0>;/load = <$load>;/1" $MODIFIED_FIT_ITS

 The /1 is a little useless, there is only one such statement in a line.
Instead, I would anchor the expression at the end of the line.

 Also, it's nicer to use something clearly invalid in the template, e.g.
	load = <@load@>;
This would also allow to make the substitution more generic, just replacing all
occurences of @load@ instead of matching the specific line.

> +sed -i "s/entry = <0>;/entry = <$entry>;/1" $MODIFIED_FIT_ITS

 Small nit: we generally prefer to do the manipulations while copying, i.e.

sed -e "s/@load@/$load/g" \
	-e "s/@entry@/$entry/g \
	$FIT_ITS_FILE > $MODIFIED_FIT_ITS

> +
> +# copy vmlinux.bin.gz to output/images, it is used in .its file
> +cp -a $LINUX_DIR/arch/mips/boot/vmlinux.bin.gz $BINARIES_DIR

 I could be mistaken, but isn't it possible to select
BR2_LINUX_KERNEL_VMLINUX_BIN, then gzip the image which is already in
$BINARIES_DIR? Of course it's not a perfect solution either because you can't
extract $load and $entry from it... So forget about that idea.

 Another option is to ask your kernel developers to use a FIT image as the
uImage in linux arch/mips/boot/Makefile. For now, however, your current solution
is OK for Buildroot.


> +
> +# create fitImage
> +$MKIMAGE -f $MODIFIED_FIT_ITS $FITIMAGE
> +
> +# copy to target
> +cp -a $FITIMAGE $TARGET_DIR/fitImage

 Just to be sure I understand this correctly: U-Boot will look for a file called
fitImage in the root directory of an ext2 filesystem on MMC/USB? I'm asking
because usually it is either a FAT partition, or it looks in the /boot directory.

> diff --git a/board/ci40/fitImage.its b/board/ci40/fitImage.its
> new file mode 100644
> index 0000000..0812eb3
> --- /dev/null
> +++ b/board/ci40/fitImage.its
> @@ -0,0 +1,52 @@
> +/*
> + * Description file for fitImage
> + */
> +
> +/dts-v1/;
> +
> +/ {
> +	description = "Buildroot CI40 FTD Image";
> +	#address-cells = <1>;
> +
> +	images {
> +		kernel at 1 {
> +			description = "Linux kernel";
> +			data = /incbin/("./vmlinux.bin.gz");
> +			type = "kernel";
> +			arch = "mips";
> +			os = "linux";
> +			compression = "gzip";
> +			load = <0>;
> +			entry = <0>;
> +			hash at 1 {
> +				algo = "crc32";
> +			};
> +			hash at 2 {
> +				algo = "sha1";
> +			};
> +		};
> +		marduk-fdt at 1 {
> +			description = "CI40 Flattened Device Tree blob";
> +			data = /incbin/("./pistachio_marduk.dtb");

 Just an idea: perhaps the create_fitImage script could take the DTB as an
argument as well, or use the first DTB found in $BINARIES_DIR.

> +			type = "flat_dt";
> +			arch = "mips";
> +			compression = "none";
> +			hash at 1 {
> +				algo = "crc32";
> +			};
> +			hash at 2 {
> +				algo = "sha1";
> +			};
> +		};
> +	};
> +
> +	configurations {
> +		default = "config at 1";
> +		config at 1 {
> +			description = "CI40 dtb";
> +			kernel = "kernel at 1";
> +			fdt = "marduk-fdt at 1";
> +		};
> +	};
> +};
> +
> diff --git a/board/ci40/genimage.cfg b/board/ci40/genimage.cfg
> new file mode 100644
> index 0000000..8b4303a
> --- /dev/null
> +++ b/board/ci40/genimage.cfg
> @@ -0,0 +1,13 @@
> +# Minimal SD card image
> +#
> +
> +image sdcard.img {
> +  hdimage {
> +  }
> +
> +  partition rootfs {
> +    partition-type = 0x83
> +    image = "rootfs.ext4"
> +    size = 256M # Maximum firmware size in partition is 268M

 There is no need to specify the size. The filesystem size will anyway be
whatever it was created as. The size you specify here is the partition size. But
the difference between filesystem size and partition size will anyway not be
useable until you do a resize2fs. So I think it's easier to leave the size open.

> +  }
> +}
> diff --git a/board/ci40/post-image.sh b/board/ci40/post-image.sh
> new file mode 100755
> index 0000000..18e76aa
> --- /dev/null
> +++ b/board/ci40/post-image.sh
> @@ -0,0 +1,15 @@
> +#!/usr/bin/env bash
> +
> +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}"
> +
> diff --git a/board/ci40/readme.txt b/board/ci40/readme.txt
> new file mode 100644
> index 0000000..252c19d
> --- /dev/null
> +++ b/board/ci40/readme.txt
> @@ -0,0 +1,57 @@
> +*********************
> +* MIPS Creator CI40 *
> +*********************
> +
> +The 'ci40_defconfig' will create a root filesystem and a fitImage
> +under the 'output/images/' directory. This document will try to explain how
                                                       ^^^^^^^^^^^^^^^^^^^
                                                       just "explains"

> +to use them in order to run Buildroot in the MIPS Creator CI40 board.
> +
> +Prepare USB/MMC for boot
> +------------------------
> +It can be done 2 ways:
> +
> +1. Using "sdcard.img" file created in output/images folder
> +
> +Use following command to write image to bootable device
> +
> +# dd if=./output/images/sdcard.img of=/dev/<your-microsd-or-usb-device>
> +
> +2. Manually preparing USB/MMC device
> +
> +Extract the generated root filesystem "rootfs.tar" into a ext4 formatted
> +USB drive or SD-Card.
> +
> +Booting from USB/MMC
> +--------------------
> +Here you have the instructions to boot from the two of them. You have to
> +choose the one you prefer:
> +
> +From USB
> +  pistachio # run usbboot

 I guess these are U-Boot commands? Perhaps that should be clarified as well.

 I would also start with something like

The boot loader is already present in NOR flash. To boot your newly generated
Linux and root filesystem, you need to interrupt U-Boot. <Explain how to
interrupt U-Boot>.

 Perhaps also explain how to make it persistent:

# setenv bootcmd run usbboot
# saveenv


> +
> +From SD-Card
> +  pistachio # run mmcboot
> +
> +Booting from network (nfsboot)
> +------------------------------
> +Prepare nfs root and extract rootfs.tar file into it.
                   ^(See Buildroot manual)

> +
> +  pistachio # setenv serverip <server-ip-address>
> +  pistachio # setenv rootpath <nfs root path>
> +  pistachio # run netboot
> +
> +Flash new bootloader
> +--------------------
> +After booting with above method. Copy file u-boot-pistachio_marduk-2015.10-v1.0.4.img
> +to /tmp. Use following command to flash new bootloader:
> +
> +# flashcp -v /tmp/u-boot-pistachio_marduk-2015.10-v1.0.4.img /dev/mtd0

 I never used flashcp. It doesn't need a preceding flash_erase like nandwrite?

> +
> +Online docs
> +-----------
> +mostly for openwrt but it also applicable on buildroot
   Mostly for OpenWRT       ^is              to

> +https://docs.creatordev.io/ci40/guides/openwrt-platform/#overview
> +
> +Prebuilt uboot
> +--------------
> +http://downloads.creatordev.io/?q=u-boot/

 In general a very clear explanation!


> diff --git a/configs/ci40_defconfig b/configs/ci40_defconfig
> new file mode 100644
> index 0000000..cf5972e
> --- /dev/null
> +++ b/configs/ci40_defconfig
> @@ -0,0 +1,47 @@
> +# architecture
> +BR2_mipsel=y
> +BR2_mips_32r2=y
> +
> +# linux header same as custom kernel ie 4.4.x
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y
> +
> +# kernel
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_GIT=y
> +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/CreatorDev/linux.git"
> +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="openwrt-4.4.14"
> +BR2_LINUX_KERNEL_DEFCONFIG="pistachio"
> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="img/pistachio_marduk"
> +
> +# bootloader flash support
> +BR2_PACKAGE_MTD=y
> +
> +# wireless firmware
> +BR2_PACKAGE_UCCP420WLAN=y
> +
> +# wireless package
> +BR2_PACKAGE_WIRELESS_TOOLS=y
> +BR2_PACKAGE_WPA_SUPPLICANT=y
> +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
> +
> +# bootloader
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BOARDNAME="pistachio_marduk"
> +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
> +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="https://github.com/CreatorDev/u-boot/archive/v1.0.4.tar.gz"

 You can use archive/v1.0.4/u-boot-CreatorDev-v1.0.4.tar.gz to have a reasonable
name for the tarball.

 Regards,
 Arnout

> +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
> +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-pistachio_marduk-2015.10-v1.0.4.img"
> +
> +# fitimage / image generation
> +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
> +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
> +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/ci40/create_fitImage.sh"
> +
> +# image generation
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_4=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/ci40/post-image.sh"
> +
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v3 1/3] uccp420wlan: new package
  2017-02-27 13:37 [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Abhimanyu V
  2017-02-27 13:38 ` [Buildroot] [PATCH v3 2/3] Export LINUX_DIR for post-build scripts Abhimanyu V
  2017-02-27 13:38 ` [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40 Abhimanyu V
@ 2017-03-14  9:04 ` Arnout Vandecappelle
  2017-03-15  6:50   ` Abhimanyu V
  2 siblings, 1 reply; 10+ messages in thread
From: Arnout Vandecappelle @ 2017-03-14  9:04 UTC (permalink / raw)
  To: buildroot



On 27-02-17 14:37, Abhimanyu V wrote:
> From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
> 
> Wifi kernel module and firmware for Imagination explorer RPU
> 
> Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
> Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
> ---
>  Changes v1->v2
>   - add hash file
>  Changes v2->v3 (Suggested by Arnout)
>   - remove patch and bump version
>   - add proprietary license file to LICENSE_FILES
>   - Fix help text indentation to below 72 columns
[snip]
> diff --git a/package/uccp420wlan/uccp420wlan.hash b/package/uccp420wlan/uccp420wlan.hash
> new file mode 100644
> index 0000000..41f60a4
> --- /dev/null
> +++ b/package/uccp420wlan/uccp420wlan.hash
> @@ -0,0 +1,2 @@
> +# locally computed hash
> +sha256 1d4de62fc842dbab739708cf0d9ebce270fcdf63c1c13ac676cbc253acdaa3bb uccp420wlan-v6.9.1.tar.gz
> diff --git a/package/uccp420wlan/uccp420wlan.mk b/package/uccp420wlan/uccp420wlan.mk
> new file mode 100644
> index 0000000..4676ef3
> --- /dev/null
> +++ b/package/uccp420wlan/uccp420wlan.mk
> @@ -0,0 +1,20 @@
> +################################################################################
> +#
> +# uccp420wlan
> +#
> +################################################################################
> +
> +UCCP420WLAN_VERSION = v6.9.1
> +UCCP420WLAN_SITE = $(call github,CreatorDev,uccp420wlan,$(UCCP420WLAN_VERSION))
> +UCCP420WLAN_LICENSE = GPLv2 (kernel module), proprietary (firmware blob)
> +UCCP420WLAN_LICENSE_FILES = COPYING firmware/LICENSE.imagination
> +
> +define UCCP420WLAN_INSTALL_FIRMWARE
> +	mkdir -p $(TARGET_DIR)/lib/firmware/img/uccp420wlan
> +	cp $(@D)/firmware/*.ldr $(TARGET_DIR)/lib/firmware/img/uccp420wlan
> +endef
> +
> +UCCP420WLAN_POST_INSTALL_TARGET_HOOKS += UCCP420WLAN_INSTALL_FIRMWARE

 Sorry I didn't notice this before: there is no need for a POST_INSTALL_HOOK
here, you can just

define UCCP420WLAN_INSTALL_TARGET_CMDS


 Regards,
 Arnout

> +
> +$(eval $(kernel-module))
> +$(eval $(generic-package))
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v3 1/3] uccp420wlan: new package
  2017-03-14  9:04 ` [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Arnout Vandecappelle
@ 2017-03-15  6:50   ` Abhimanyu V
  0 siblings, 0 replies; 10+ messages in thread
From: Abhimanyu V @ 2017-03-15  6:50 UTC (permalink / raw)
  To: buildroot

Thankyou Arnout for review!


On Tuesday 14 March 2017 02:34 PM, Arnout Vandecappelle wrote:
>
> On 27-02-17 14:37, Abhimanyu V wrote:
>> From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
>>
>> Wifi kernel module and firmware for Imagination explorer RPU
>>
>> Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
>> Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
>> ---
>>   Changes v1->v2
>>    - add hash file
>>   Changes v2->v3 (Suggested by Arnout)
>>    - remove patch and bump version
>>    - add proprietary license file to LICENSE_FILES
>>    - Fix help text indentation to below 72 columns
> [snip]
>> diff --git a/package/uccp420wlan/uccp420wlan.hash b/package/uccp420wlan/uccp420wlan.hash
>> new file mode 100644
>> index 0000000..41f60a4
>> --- /dev/null
>> +++ b/package/uccp420wlan/uccp420wlan.hash
>> @@ -0,0 +1,2 @@
>> +# locally computed hash
>> +sha256 1d4de62fc842dbab739708cf0d9ebce270fcdf63c1c13ac676cbc253acdaa3bb uccp420wlan-v6.9.1.tar.gz
>> diff --git a/package/uccp420wlan/uccp420wlan.mk b/package/uccp420wlan/uccp420wlan.mk
>> new file mode 100644
>> index 0000000..4676ef3
>> --- /dev/null
>> +++ b/package/uccp420wlan/uccp420wlan.mk
>> @@ -0,0 +1,20 @@
>> +################################################################################
>> +#
>> +# uccp420wlan
>> +#
>> +################################################################################
>> +
>> +UCCP420WLAN_VERSION = v6.9.1
>> +UCCP420WLAN_SITE = $(call github,CreatorDev,uccp420wlan,$(UCCP420WLAN_VERSION))
>> +UCCP420WLAN_LICENSE = GPLv2 (kernel module), proprietary (firmware blob)
>> +UCCP420WLAN_LICENSE_FILES = COPYING firmware/LICENSE.imagination
>> +
>> +define UCCP420WLAN_INSTALL_FIRMWARE
>> +	mkdir -p $(TARGET_DIR)/lib/firmware/img/uccp420wlan
>> +	cp $(@D)/firmware/*.ldr $(TARGET_DIR)/lib/firmware/img/uccp420wlan
>> +endef
>> +
>> +UCCP420WLAN_POST_INSTALL_TARGET_HOOKS += UCCP420WLAN_INSTALL_FIRMWARE
>   Sorry I didn't notice this before: there is no need for a POST_INSTALL_HOOK
> here, you can just
>
> define UCCP420WLAN_INSTALL_TARGET_CMDS
Thanks, I will update in next patch.
>
>   Regards,
>   Arnout
>
>> +
>> +$(eval $(kernel-module))
>> +$(eval $(generic-package))
>>

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

* [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40
  2017-03-14  8:57   ` Arnout Vandecappelle
@ 2017-03-15  7:06     ` Abhimanyu V
  2017-03-15  8:00       ` Marcin Nowakowski
  0 siblings, 1 reply; 10+ messages in thread
From: Abhimanyu V @ 2017-03-15  7:06 UTC (permalink / raw)
  To: buildroot

Thankyou again for review Arnout!


On Tuesday 14 March 2017 02:27 PM, Arnout Vandecappelle wrote:
>
> On 27-02-17 14:38, Abhimanyu V wrote:
>> From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
>>
>> Also add post-build script to create fitImage which is used
>> by u-boot to boot the device. It also add post-image script
>> to generate sdcard.img for preparing sdcard/usb device
>>
>> Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
>> Reviewed-by: Rahul Bedarkar <Rahul.Bedarkar@imgtec.com>
>> ---
>>   Changes v1->v2
>>    - No change
>>   Changes v2->v3 (Suggested by Arnout)
>>    - Remove uImage and add fitImage generation
>>    - Tidy readme.txt
>>    - Tidy ci40_defconfig, remove custom toolchain and add wifi helper packages
>>    Some changes are not done:
>>    - Using git-helper:
>>      - Custom kernel doesnt provide tar file, so it didnt work for me
>   Works for me:
> https://github.com/CreatorDev/linux/archive/openwrt-4.4.14/linux-openwrt-4.4.14.tar.gz
Oh, i must be doing something wrong, thankyou for suggestion.
>
>
>>   board/ci40/create_fitImage.sh | 29 ++++++++++++++++++++++
>>   board/ci40/fitImage.its       | 52 +++++++++++++++++++++++++++++++++++++++
>>   board/ci40/genimage.cfg       | 13 ++++++++++
>>   board/ci40/post-image.sh      | 15 ++++++++++++
>>   board/ci40/readme.txt         | 57 +++++++++++++++++++++++++++++++++++++++++++
>>   configs/ci40_defconfig        | 47 +++++++++++++++++++++++++++++++++++
>>   6 files changed, 213 insertions(+)
>>   create mode 100755 board/ci40/create_fitImage.sh
>>   create mode 100644 board/ci40/fitImage.its
>>   create mode 100644 board/ci40/genimage.cfg
>>   create mode 100755 board/ci40/post-image.sh
>>   create mode 100644 board/ci40/readme.txt
>>   create mode 100644 configs/ci40_defconfig
>>
>> diff --git a/board/ci40/create_fitImage.sh b/board/ci40/create_fitImage.sh
>> new file mode 100755
>> index 0000000..6ad9b3a
>> --- /dev/null
>> +++ b/board/ci40/create_fitImage.sh
>> @@ -0,0 +1,29 @@
>> +#!/bin/sh
>> +
>> +# inputs
>> +BOARD_DIR="$(dirname $0)"
>> +FIT_ITS_FILE=$BOARD_DIR/fitImage.its
>   Since this is a template file, call it fitImage.its.in
Thanks
>
>> +MKIMAGE=$HOST_DIR/usr/bin/mkimage
>> +UIMAGE=$BINARIES_DIR/uImage
>> +
>> +#output
>> +MODIFIED_FIT_ITS=$BINARIES_DIR/fitImage.its
>> +FITIMAGE=$BINARIES_DIR/fitImage
>> +
>> +# Extract kernel load address and entry address from uImage
>> +load=0x$($MKIMAGE -l $UIMAGE | grep "Load Address: " | sed 's/Load Address: //g')
>> +entry=0x$($MKIMAGE -l $UIMAGE | grep "Entry Point:  " | sed 's/Entry Point:  //g')
>> +
>> +# Create a copy of fitImage.its file and replace these address in that file
>> +cp $FIT_ITS_FILE $MODIFIED_FIT_ITS
>> +sed -i "s/load = <0>;/load = <$load>;/1" $MODIFIED_FIT_ITS
>   The /1 is a little useless, there is only one such statement in a line.
> Instead, I would anchor the expression at the end of the line.
>
>   Also, it's nicer to use something clearly invalid in the template, e.g.
> 	load = <@load@>;
> This would also allow to make the substitution more generic, just replacing all
> occurences of @load@ instead of matching the specific line.
>
>> +sed -i "s/entry = <0>;/entry = <$entry>;/1" $MODIFIED_FIT_ITS
>   Small nit: we generally prefer to do the manipulations while copying, i.e.
>
> sed -e "s/@load@/$load/g" \
> 	-e "s/@entry@/$entry/g \
> 	$FIT_ITS_FILE > $MODIFIED_FIT_ITS
Thanks!
>> +
>> +# copy vmlinux.bin.gz to output/images, it is used in .its file
>> +cp -a $LINUX_DIR/arch/mips/boot/vmlinux.bin.gz $BINARIES_DIR
>   I could be mistaken, but isn't it possible to select
> BR2_LINUX_KERNEL_VMLINUX_BIN, then gzip the image which is already in
> $BINARIES_DIR? Of course it's not a perfect solution either because you can't
> extract $load and $entry from it... So forget about that idea.
>
>   Another option is to ask your kernel developers to use a FIT image as the
> uImage in linux arch/mips/boot/Makefile. For now, however, your current solution
> is OK for Buildroot.
Yes this is something i also had in my mind, i will start the discussion 
with the team which manage this
repo. Once we have this solution in place i will update it in follow up 
patch.
>
>> +
>> +# create fitImage
>> +$MKIMAGE -f $MODIFIED_FIT_ITS $FITIMAGE
>> +
>> +# copy to target
>> +cp -a $FITIMAGE $TARGET_DIR/fitImage
>   Just to be sure I understand this correctly: U-Boot will look for a file called
> fitImage in the root directory of an ext2 filesystem on MMC/USB? I'm asking
> because usually it is either a FAT partition, or it looks in the /boot directory.
Ci40 bootloader is coded to boot from either ubi volume "kernel" or from 
the rootfs.
Since i have not added ubi volume support yet, i copied the fitImage to 
rootfs root. to support
booting from /boot, u-boot change will require.

>
>> diff --git a/board/ci40/fitImage.its b/board/ci40/fitImage.its
>> new file mode 100644
>> index 0000000..0812eb3
>> --- /dev/null
>> +++ b/board/ci40/fitImage.its
>> @@ -0,0 +1,52 @@
>> +/*
>> + * Description file for fitImage
>> + */
>> +
>> +/dts-v1/;
>> +
>> +/ {
>> +	description = "Buildroot CI40 FTD Image";
>> +	#address-cells = <1>;
>> +
>> +	images {
>> +		kernel at 1 {
>> +			description = "Linux kernel";
>> +			data = /incbin/("./vmlinux.bin.gz");
>> +			type = "kernel";
>> +			arch = "mips";
>> +			os = "linux";
>> +			compression = "gzip";
>> +			load = <0>;
>> +			entry = <0>;
>> +			hash at 1 {
>> +				algo = "crc32";
>> +			};
>> +			hash at 2 {
>> +				algo = "sha1";
>> +			};
>> +		};
>> +		marduk-fdt at 1 {
>> +			description = "CI40 Flattened Device Tree blob";
>> +			data = /incbin/("./pistachio_marduk.dtb");
>   Just an idea: perhaps the create_fitImage script could take the DTB as an
> argument as well, or use the first DTB found in $BINARIES_DIR.
Passing dtb as argument is nice idea i will update this.
>
>> +			type = "flat_dt";
>> +			arch = "mips";
>> +			compression = "none";
>> +			hash at 1 {
>> +				algo = "crc32";
>> +			};
>> +			hash at 2 {
>> +				algo = "sha1";
>> +			};
>> +		};
>> +	};
>> +
>> +	configurations {
>> +		default = "config at 1";
>> +		config at 1 {
>> +			description = "CI40 dtb";
>> +			kernel = "kernel at 1";
>> +			fdt = "marduk-fdt at 1";
>> +		};
>> +	};
>> +};
>> +
>> diff --git a/board/ci40/genimage.cfg b/board/ci40/genimage.cfg
>> new file mode 100644
>> index 0000000..8b4303a
>> --- /dev/null
>> +++ b/board/ci40/genimage.cfg
>> @@ -0,0 +1,13 @@
>> +# Minimal SD card image
>> +#
>> +
>> +image sdcard.img {
>> +  hdimage {
>> +  }
>> +
>> +  partition rootfs {
>> +    partition-type = 0x83
>> +    image = "rootfs.ext4"
>> +    size = 256M # Maximum firmware size in partition is 268M
>   There is no need to specify the size. The filesystem size will anyway be
> whatever it was created as. The size you specify here is the partition size. But
> the difference between filesystem size and partition size will anyway not be
> useable until you do a resize2fs. So I think it's easier to leave the size open.
Ok
>> +  }
>> +}
>> diff --git a/board/ci40/post-image.sh b/board/ci40/post-image.sh
>> new file mode 100755
>> index 0000000..18e76aa
>> --- /dev/null
>> +++ b/board/ci40/post-image.sh
>> @@ -0,0 +1,15 @@
>> +#!/usr/bin/env bash
>> +
>> +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}"
>> +
>> diff --git a/board/ci40/readme.txt b/board/ci40/readme.txt
>> new file mode 100644
>> index 0000000..252c19d
>> --- /dev/null
>> +++ b/board/ci40/readme.txt
>> @@ -0,0 +1,57 @@
>> +*********************
>> +* MIPS Creator CI40 *
>> +*********************
>> +
>> +The 'ci40_defconfig' will create a root filesystem and a fitImage
>> +under the 'output/images/' directory. This document will try to explain how
>                                                         ^^^^^^^^^^^^^^^^^^^
>                                                         just "explains"
Thanks
>
>> +to use them in order to run Buildroot in the MIPS Creator CI40 board.
>> +
>> +Prepare USB/MMC for boot
>> +------------------------
>> +It can be done 2 ways:
>> +
>> +1. Using "sdcard.img" file created in output/images folder
>> +
>> +Use following command to write image to bootable device
>> +
>> +# dd if=./output/images/sdcard.img of=/dev/<your-microsd-or-usb-device>
>> +
>> +2. Manually preparing USB/MMC device
>> +
>> +Extract the generated root filesystem "rootfs.tar" into a ext4 formatted
>> +USB drive or SD-Card.
>> +
>> +Booting from USB/MMC
>> +--------------------
>> +Here you have the instructions to boot from the two of them. You have to
>> +choose the one you prefer:
>> +
>> +From USB
>> +  pistachio # run usbboot
>   I guess these are U-Boot commands? Perhaps that should be clarified as well.
>
>   I would also start with something like
>
> The boot loader is already present in NOR flash. To boot your newly generated
> Linux and root filesystem, you need to interrupt U-Boot. <Explain how to
> interrupt U-Boot>.
>
>   Perhaps also explain how to make it persistent:
>
> # setenv bootcmd run usbboot
> # saveenv
>
Shall update this in next patch.
>> +
>> +From SD-Card
>> +  pistachio # run mmcboot
>> +
>> +Booting from network (nfsboot)
>> +------------------------------
>> +Prepare nfs root and extract rootfs.tar file into it.
>                     ^(See Buildroot manual)
>
>> +
>> +  pistachio # setenv serverip <server-ip-address>
>> +  pistachio # setenv rootpath <nfs root path>
>> +  pistachio # run netboot
>> +
>> +Flash new bootloader
>> +--------------------
>> +After booting with above method. Copy file u-boot-pistachio_marduk-2015.10-v1.0.4.img
>> +to /tmp. Use following command to flash new bootloader:
>> +
>> +# flashcp -v /tmp/u-boot-pistachio_marduk-2015.10-v1.0.4.img /dev/mtd0
>   I never used flashcp. It doesn't need a preceding flash_erase like nandwrite?
>
Yes, flashcp run erase first, example output is:
# flashcp -v u-boot-pistachio_marduk-2015.10-v1.0.4.img /dev/mtd0
Erasing blocks: 384/384 (100%)
Writing data: 1536k/0k (100%))
Verifying data: 1536k/0k (100%))

>> +
>> +Online docs
>> +-----------
>> +mostly for openwrt but it also applicable on buildroot
>     Mostly for OpenWRT       ^is              to
>
>> +https://docs.creatordev.io/ci40/guides/openwrt-platform/#overview
>> +
>> +Prebuilt uboot
>> +--------------
>> +http://downloads.creatordev.io/?q=u-boot/
>   In general a very clear explanation!
>
>
>> diff --git a/configs/ci40_defconfig b/configs/ci40_defconfig
>> new file mode 100644
>> index 0000000..cf5972e
>> --- /dev/null
>> +++ b/configs/ci40_defconfig
>> @@ -0,0 +1,47 @@
>> +# architecture
>> +BR2_mipsel=y
>> +BR2_mips_32r2=y
>> +
>> +# linux header same as custom kernel ie 4.4.x
>> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y
>> +
>> +# kernel
>> +BR2_LINUX_KERNEL=y
>> +BR2_LINUX_KERNEL_CUSTOM_GIT=y
>> +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/CreatorDev/linux.git"
>> +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="openwrt-4.4.14"
>> +BR2_LINUX_KERNEL_DEFCONFIG="pistachio"
>> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
>> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="img/pistachio_marduk"
>> +
>> +# bootloader flash support
>> +BR2_PACKAGE_MTD=y
>> +
>> +# wireless firmware
>> +BR2_PACKAGE_UCCP420WLAN=y
>> +
>> +# wireless package
>> +BR2_PACKAGE_WIRELESS_TOOLS=y
>> +BR2_PACKAGE_WPA_SUPPLICANT=y
>> +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
>> +
>> +# bootloader
>> +BR2_TARGET_UBOOT=y
>> +BR2_TARGET_UBOOT_BOARDNAME="pistachio_marduk"
>> +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
>> +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="https://github.com/CreatorDev/u-boot/archive/v1.0.4.tar.gz"
>   You can use archive/v1.0.4/u-boot-CreatorDev-v1.0.4.tar.gz to have a reasonable
> name for the tarball.
Thanks, i didnt know these tricks with github :)
>
>   Regards,
>   Arnout
>
>> +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
>> +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-pistachio_marduk-2015.10-v1.0.4.img"
>> +
>> +# fitimage / image generation
>> +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
>> +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
>> +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
>> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/ci40/create_fitImage.sh"
>> +
>> +# image generation
>> +BR2_TARGET_ROOTFS_EXT2=y
>> +BR2_TARGET_ROOTFS_EXT2_4=y
>> +BR2_PACKAGE_HOST_GENIMAGE=y
>> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/ci40/post-image.sh"
>> +
>>
Thanks again!
Regards,
Abhimanyu V

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

* [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40
  2017-03-15  7:06     ` Abhimanyu V
@ 2017-03-15  8:00       ` Marcin Nowakowski
  2017-03-15  8:13         ` Abhimanyu V
  0 siblings, 1 reply; 10+ messages in thread
From: Marcin Nowakowski @ 2017-03-15  8:00 UTC (permalink / raw)
  To: buildroot

Hi Abhi,

On 15.03.2017 08:06, Abhimanyu V wrote:
> On Tuesday 14 March 2017 02:27 PM, Arnout Vandecappelle wrote:
>>

>>
>>   Another option is to ask your kernel developers to use a FIT image
>> as the
>> uImage in linux arch/mips/boot/Makefile. For now, however, your
>> current solution
>> is OK for Buildroot.
> Yes this is something i also had in my mind, i will start the discussion
> with the team which manage this
> repo. Once we have this solution in place i will update it in follow up
> patch.


We've got fit image support available upstream now:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/mips/boot?id=cf2a5e0bb4c66e8c43caf9f1be93a1bd7fd07b17

This patch should be easy to backport, and the patch below will be 
useful as a reference on how to update your platform code:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/mips/?id=eed0eabd12ef061821cbfa20d903476e07645320

Marcin

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

* [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40
  2017-03-15  8:00       ` Marcin Nowakowski
@ 2017-03-15  8:13         ` Abhimanyu V
  0 siblings, 0 replies; 10+ messages in thread
From: Abhimanyu V @ 2017-03-15  8:13 UTC (permalink / raw)
  To: buildroot


On Wednesday 15 March 2017 01:30 PM, Marcin Nowakowski wrote:
> Hi Abhi,
>
> On 15.03.2017 08:06, Abhimanyu V wrote:
>> On Tuesday 14 March 2017 02:27 PM, Arnout Vandecappelle wrote:
>>>
>
> We've got fit image support available upstream now:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/mips/boot?id=cf2a5e0bb4c66e8c43caf9f1be93a1bd7fd07b17 
>
>
> This patch should be easy to backport, and the patch below will be 
> useful as a reference on how to update your platform code:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/mips/?id=eed0eabd12ef061821cbfa20d903476e07645320 
>
Thankyou marcin for pointer. This is indeed a good start point.
>
> Marcin

Regards
Abhimanyu

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

end of thread, other threads:[~2017-03-15  8:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-27 13:37 [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Abhimanyu V
2017-02-27 13:38 ` [Buildroot] [PATCH v3 2/3] Export LINUX_DIR for post-build scripts Abhimanyu V
2017-03-13 23:04   ` Arnout Vandecappelle
2017-02-27 13:38 ` [Buildroot] [PATCH v3 3/3] Add defconfig for MIPS Creator ci40 Abhimanyu V
2017-03-14  8:57   ` Arnout Vandecappelle
2017-03-15  7:06     ` Abhimanyu V
2017-03-15  8:00       ` Marcin Nowakowski
2017-03-15  8:13         ` Abhimanyu V
2017-03-14  9:04 ` [Buildroot] [PATCH v3 1/3] uccp420wlan: new package Arnout Vandecappelle
2017-03-15  6:50   ` Abhimanyu V

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.