Skip to contentSkip to conversation

Add defconfig for MIPS Creator ci40

PATCH Superseded Abhimanyu Vishwakarma 3 participants 5 messages Apr 5, 2017 – Apr 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 Add defconfig for MIPS Creator ci40

From: Abhimanyu Vishwakarma <[email protected]>

Add post-image script to generate sdcard.img for
preparing sdcard/usb device.

---
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
Changes v3->v4 (Suggested by Arnout)
- Use github helper for getting kernel/u-boot
- rename fitImage.its -> fitImage.its.in to reflect as template file, remove hardcoded dtb filename
- Find dtb file in output/images directory and use first dtb in fitImage
- Remove image size from genimage.cfg
- Tidy readme.txt and add section to explain how to stop u-boot autoboot, how to make it persistent, and other grammar
Changes v4->v5 (Suggested by Thomas)
- Use fixed kernel entry addr
- Generate vmlinux.bin.gz from generate vmlinux.bin
- Remove generating uImage (not required for anything now)
Changes v5->v6
- Use kernel generate fitimage
- bump up u-boot version
- Change emailid from imgtec.com -> personal id
Changes v6->v7 (Suggested by Thomas)
- Use genimage.sh script
- Improve and fix grammer in readme.txt

 board/ci40/genimage.cfg  | 12 +++++++++
 board/ci40/post-build.sh |  4 +++
 board/ci40/post-image.sh |  5 ++++
 board/ci40/readme.txt    | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
 configs/ci40_defconfig   | 49 ++++++++++++++++++++++++++++++++++++
 5 files changed, 134 insertions(+)
 create mode 100644 board/ci40/genimage.cfg
 create mode 100755 board/ci40/post-build.sh
 create mode 100755 board/ci40/post-image.sh
 create mode 100644 board/ci40/readme.txt
 create mode 100644 configs/ci40_defconfig
board/ci40/genimage.cfg new file +12 -0
new file mode 100644
index 0000000..0ffc91c
@@ -0,0 +1,12 @@
+# Minimal SD card image
+#
+
+image sdcard.img {
+  hdimage {
+  }
+
+  partition rootfs {
+    partition-type = 0x83
+    image = "rootfs.ext4"
+  }
+}
board/ci40/post-build.sh new file +4 -0
new file mode 100755
index 0000000..978ced5
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+# Copy to target
+cp ${BINARIES_DIR}/vmlinux.gz.itb ${TARGET_DIR}/fitImage
board/ci40/post-image.sh new file +5 -0
new file mode 100755
index 0000000..4b7d492
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+BOARD_DIR="$(dirname $0)"
+
+support/scripts/genimage.sh -c "${BOARD_DIR}/genimage.cfg"
board/ci40/readme.txt new file +64 -0

64 lines not on this page · raw message

configs/ci40_defconfig new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v7 1/1 Add defconfig for MIPS Creator ci40

Quoted 4 lines · Abhimanyu Vishwakarma

From: Abhimanyu Vishwakarma <[email protected]>

Add post-image script to generate sdcard.img for
preparing sdcard/usb device.

This won't be true anymore... See below.
[snip]

board/ci40/post-image.sh line 5

Quoted 11 lines
board/ci40/post-image.sh new file +5 -0
new file mode 100755
index 0000000..4b7d492
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+BOARD_DIR="$(dirname $0)"
+
+support/scripts/genimage.sh -c "${BOARD_DIR}/genimage.cfg"

The idea is to remove this script entirely and instead set
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/ci40/genimage.cfg"

board/ci40/readme.txt

Quoted 1 line
board/ci40/readme.txt +0 -0

Excellent readme!

[snip]

Quoted 7 lines
configs/ci40_defconfig new file +1 -0
new file mode 100644
index 0000000..7d21f87
@@ -0,0 +1,49 @@
+# architecture

configs/ci40_defconfig line 11

Quoted 10 lines
configs/ci40_defconfig new file +10 -0
+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_TARBALL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,CreatorDev,linux,openwrt-4.4.14/linux-openwrt-4.4.14.tar.gz)"

Minor nit: this should be

BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,CreatorDev,linux,openwrt-4.4.14)/linux-openwrt-4.4.14.tar.gz"

It expands to exactly the same thing, of course, but that way it looks more familiar to people who are used to the github helper.

configs/ci40_defconfig line 15

Quoted 4 lines
configs/ci40_defconfig new file +4 -0
+BR2_LINUX_KERNEL_DEFCONFIG="pistachio"
+BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
+BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="vmlinux.gz.itb"
+BR2_LINUX_KERNEL_IMAGE_NAME="vmlinux.gz.itb"

This can actually be left empty - if empty, it defaults to
BR2_LINUX_KERNEL_IMAGE_TARGET_NAME (cfr. help text).

configs/ci40_defconfig line 17

Quoted 2 lines
configs/ci40_defconfig new file +2 -0
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="img/pistachio_marduk"

There is something funny here... The dtb is not written to the SD card, and it
is not saved together with U-Boot. I suppose that it is linked into the fitImage, but how does that work? Is any dtb that is built automatically linked in, or does the kernel config specify which dtb to link in? In the latter case, do we need to build the DTB from Buildroot?

If the DTB is indeed built implicitly from vmlinux.gz.itb, then the DTS stuff
can be removed from the defconfig, but it's useful to keep a comment like this:

# .itb image includes img/pistachio_marduk device tree
Quoted 5 lines
configs/ci40_defconfig new file +5 -0
+
+# bootloader flash support
+BR2_PACKAGE_MTD=y
+
+# wireless firmware

configs/ci40_defconfig line 32

Quoted 10 lines
configs/ci40_defconfig new file +10 -0
+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"

Shouldn't this be

BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_BOARD_DEFCONFIG="pistachio_marduk"

? The above works because U-Boot has this legacy handling, but we really prefer to use the proper Kconfig-based approach if possible.

configs/ci40_defconfig line 34

Quoted 2 lines
configs/ci40_defconfig new file +2 -0
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,CreatorDev,u-boot,v1.0.5/u-boot-CreatorDev-v1.0.5.tar.gz)"

Same here about github helper.

configs/ci40_defconfig line 39

Quoted 5 lines
configs/ci40_defconfig new file +5 -0
+BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-pistachio_marduk-2015.10-v1.0.5.img"
+
+# fitimage / image generation
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y

Hm, we have a problem here... You need to enable this because it is used by the
linux build, but there is no dependency from linux on host-uboot-tools:

ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y)
LINUX_DEPENDENCIES += host-uboot-tools
endif

but since you use a custom image name, BR2_LINUX_KERNEL_UBOOT_IMAGE) isn't selected.

That piece of code should probably be changed into

# If host-uboot-tools is selected by the user, assume it is needed to

# build a custom kernel image
ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS),y)
LINUX_DEPENDENCIES += host-uboot-tools
endif

and also in linux/Config.in replace all selects of BR2_LINUX_KERNEL_UBOOT_IMAGE with BR2_PACKAGE_HOST_UBOOT_TOOLS.

I'll send an RFC patch for that, can you test it and add your tested-by tag?

Regards,
Arnout

Quoted 11 lines
configs/ci40_defconfig new file +10 -0
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/ci40/post-build.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"
+
Signature · 6 lines
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
#2 lore raw

PATCH v7 1/1 Add defconfig for MIPS Creator ci40

Thankyou Arnout!

Quoted 26 lines · Arnout Vandecappelle
Quoted 4 lines · Abhimanyu Vishwakarma

From: Abhimanyu Vishwakarma <[email protected]>

Add post-image script to generate sdcard.img for
preparing sdcard/usb device.

This won't be true anymore... See below.
[snip]

board/ci40/post-image.sh line 5

Quoted 11 lines
board/ci40/post-image.sh new file +5 -0
new file mode 100755
index 0000000..4b7d492
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+BOARD_DIR="$(dirname $0)"
+
+support/scripts/genimage.sh -c "${BOARD_DIR}/genimage.cfg"

The idea is to remove this script entirely and instead set
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/ci40/genimage.cfg"

Quoted 1 line

I remember i did try this (tried now too) but it doesnt work, i end up

with following error:
BUILD_DIR=/home/abhi/code/buildroot/output/build support/scripts/genimage.sh /home/abhi/code/buildroot/output/images -c board/ci40/genimage.cfg

Quoted 1 line
Quoted 1 line
Quoted 1 line

Executing post-image script support/scripts/genimage.sh

Error: Missing argument

This is due to mix of positional and optional argument. Anything wrong with config or it is issue with genimage.sh script.

Quoted 58 lines
board/ci40/readme.txt +0 -0
 
 Excellent readme!

All credit to you and Thomas ;)

[snip]

Quoted 7 lines
configs/ci40_defconfig new file +1 -0
new file mode 100644
index 0000000..7d21f87
@@ -0,0 +1,49 @@
+# architecture

configs/ci40_defconfig line 11

Quoted 10 lines
configs/ci40_defconfig new file +10 -0
+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_TARBALL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call

github,CreatorDev,linux,openwrt-4.4.14/linux-openwrt-4.4.14.tar.gz)"

Minor nit: this should be

BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,CreatorDev,linux,openwrt-4.4.14)/linux-openwrt-4.4.14.tar.gz"

It expands to exactly the same thing, of course, but that way it looks more familiar to people who are used to the github helper.

Thanks!

configs/ci40_defconfig line 15

Quoted 4 lines
configs/ci40_defconfig new file +4 -0
+BR2_LINUX_KERNEL_DEFCONFIG="pistachio"
+BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y
+BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="vmlinux.gz.itb"
+BR2_LINUX_KERNEL_IMAGE_NAME="vmlinux.gz.itb"

This can actually be left empty - if empty, it defaults to
BR2_LINUX_KERNEL_IMAGE_TARGET_NAME (cfr. help text).

configs/ci40_defconfig line 17

Quoted 2 lines
configs/ci40_defconfig new file +2 -0
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="img/pistachio_marduk"

There is something funny here... The dtb is not written to the SD card,
and it
is not saved together with U-Boot. I suppose that it is linked into the fitImage, but how does that work? Is any dtb that is built automatically linked
in, or does the kernel config specify which dtb to link in? In the latter case,
do we need to build the DTB from Buildroot?

Quoted 1 line

The dtb is linked into fitImage so yes there is no more needed to be build

here.

If the DTB is indeed built implicitly from vmlinux.gz.itb, then the DTS

Quoted 94 lines

stuff
can be removed from the defconfig, but it's useful to keep a comment like this:

# .itb image includes img/pistachio_marduk device tree

Will do.

Quoted 5 lines
configs/ci40_defconfig new file +5 -0
+
+# bootloader flash support
+BR2_PACKAGE_MTD=y
+
+# wireless firmware

configs/ci40_defconfig line 32

Quoted 10 lines
configs/ci40_defconfig new file +10 -0
+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"

Shouldn't this be

BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_BOARD_DEFCONFIG="pistachio_marduk"

? The above works because U-Boot has this legacy handling, but we really prefer
to use the proper Kconfig-based approach if possible.

I was not aware of this, will test and update the patch.

configs/ci40_defconfig line 34

Quoted 2 lines
configs/ci40_defconfig new file +2 -0
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call

github,CreatorDev,u-boot,v1.0.5/u-boot-CreatorDev-v1.0.5.tar.gz)"

Same here about github helper.

configs/ci40_defconfig line 36

Quoted 2 lines
configs/ci40_defconfig new file +2 -0
+BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-pistachio_mardu

k-2015.10-v1.0.5.img"

configs/ci40_defconfig line 39

Quoted 3 lines
configs/ci40_defconfig new file +3 -0
+
+# fitimage / image generation
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y

Hm, we have a problem here... You need to enable this because it is used
by the
linux build, but there is no dependency from linux on host-uboot-tools:

ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y)
LINUX_DEPENDENCIES += host-uboot-tools
endif

but since you use a custom image name, BR2_LINUX_KERNEL_UBOOT_IMAGE) isn't selected.

That piece of code should probably be changed into

# If host-uboot-tools is selected by the user, assume it is needed to

# build a custom kernel image
ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS),y)
LINUX_DEPENDENCIES += host-uboot-tools
endif

and also in linux/Config.in replace all selects of BR2_LINUX_KERNEL_UBOOT_IMAGE
with BR2_PACKAGE_HOST_UBOOT_TOOLS.

I'll send an RFC patch for that, can you test it and add your tested-by
tag?

Yes, will do that tomorrow. Thanks

Regards,
Arnout

configs/ci40_defconfig line 49

Quoted 11 lines
configs/ci40_defconfig new file +10 -0
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/ci40/post-build.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"
+

--

Quoted 7 lines
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

Regards
Abhimanyu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170411/ef10bcb2/attachment.html>

#3 lore raw

PATCH v7 1/1 Add defconfig for MIPS Creator ci40

[Grmbl, I hate it how GMail screws up quoting. Anybody got good contact with
Google?]

Quoted 8 lines · abhimanyu.v at gmail.com

Thankyou Arnout!

On Mon, Apr 10, 2017 at 8:58 PM, Arnout Vandecappelle <[email protected] <mailto:[email protected]>> wrote:

    On 05-04-17 09:52, Abhimanyu Vishwakarma wrote:

[snip]

Quoted 10 lines
Quoted 1 line

+support/scripts/genimage.sh -c "${BOARD_DIR}/genimage.cfg"

The idea is to remove this script entirely and instead set
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/ci40/genimage.cfg"

I remember i did try this (tried now too) but it doesnt work, i end up with following error:
BUILD_DIR=/home/abhi/code/buildroot/output/build support/scripts/genimage.sh /home/abhi/code/buildroot/output/images -c board/ci40/genimage.cfg

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

Executing post-image script support/scripts/genimage.sh

Error: Missing argument

This is due to mix of positional and optional argument. Anything wrong with config or it is issue with genimage.sh script.

It's the genimage.sh script that's not right. It doesn't support BINARIES_DIR
as the first argument, which means it can't be used directly as a post-image script.

Etienne, any chance of fixing that?

Regards,
Arnout

[snip]

Signature · 6 lines
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
#4 lore raw

PATCH v7 1/1 Add defconfig for MIPS Creator ci40

Hello Arnout, all,

[added Gael in CC]

----- Le 10 Avr 17, ? 17:00, Arnout Vandecappelle arnout at mind.be a ?crit :

Quoted 10 lines
Quoted 4 lines

Error: Missing argument

This is due to mix of positional and optional argument. Anything wrong with config or it is issue with genimage.sh script.

It's the genimage.sh script that's not right. It doesn't support BINARIES_DIR as the first argument, which means it can't be used directly as a post-image script.

Etienne, any chance of fixing that?

Sorry for the delay. I do agree with Gael's suggestions in V8.

I can submit a fix, what do you think?

Regards,
Etienne