Skip to contentSkip to conversation

sunxi-tools: new host/taget package

PATCH New Carlo Caione 2 participants 7 messages Mar 14, 2013 – May 3, 2013 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 sunxi-tools: new host/taget package

---
 package/Config.in                  |  1 +
 package/Config.in.host             |  1 +
 package/sunxi-tools/Config.in      |  8 ++++++++
 package/sunxi-tools/Config.in.host |  9 ++++++++
 package/sunxi-tools/sunxi-tools.mk | 42 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 61 insertions(+)
 create mode 100644 package/sunxi-tools/Config.in
 create mode 100644 package/sunxi-tools/Config.in.host
 create mode 100644 package/sunxi-tools/sunxi-tools.mk
package/Config.in +1 -0
index b8b1e60..4bb8c77 100644
@@ -203,6 +203,7 @@ source "package/ntfs-3g/Config.in"
 source "package/squashfs/Config.in"
 source "package/squashfs3/Config.in"
 source "package/sshfs/Config.in"
+source "package/sunxi-tools/Config.in"
 source "package/unionfs/Config.in"
 source "package/xfsprogs/Config.in"
 endmenu
package/Config.in.host +1 -0
index 79050f2..b2b9fbd 100644
@@ -5,6 +5,7 @@ source "package/lpc3250loader/Config.in.host"
 source "package/omap-u-boot-utils/Config.in.host"
 source "package/openocd/Config.in.host"
 source "package/sam-ba/Config.in.host"
+source "package/sunxi-tools/Config.in.host"
 source "package/uboot-tools/Config.in.host"
 
 endmenu
package/sunxi-tools/Config.in new file +8 -0
new file mode 100644
index 0000000..d151a74
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_SUNXI_TOOLS
+	bool "sunxi nand-part"
+	help
+	  nand-part is a tool to repartition the internal NAND on sunxi
+	  devices
+
+	  http://linux-sunxi.org/Sunxi-tools
+
package/sunxi-tools/Config.in.host new file +9 -0
new file mode 100644
index 0000000..0208adb
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_HOST_SUNXI_TOOLS
+	bool "host sunxi-tools"
+	help
+	  Tools for Allwinner A10 (aka sun4i) and A13 (aka sun5i) based devices.
+	  This includes fexc which can be used to compile .fex board definition files to
+	  the binary script.bin format required by the linux-sunxi kernel.
+
+	  http://linux-sunxi.org/Sunxi-tools
+
package/sunxi-tools/sunxi-tools.mk new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 2/3 sunxi-boards: new package

Sunxi-boards requires a compiled .fex files for hardware description, used by kernel during boot for hardware initialization.

---
 package/Config.in                    |   1 +
 package/sunxi-boards/Config.in       | 170 +++++++++++++++++++++++++++++++++++
 package/sunxi-boards/sunxi-boards.mk |  17 ++++
 3 files changed, 188 insertions(+)
 create mode 100644 package/sunxi-boards/Config.in
 create mode 100644 package/sunxi-boards/sunxi-boards.mk
package/Config.in +1 -0
index 4bb8c77..72db358 100644
@@ -214,6 +214,7 @@ source "package/b43-firmware/Config.in"
 source "package/firmware-imx/Config.in"
 source "package/linux-firmware/Config.in"
 source "package/rpi-firmware/Config.in"
+source "package/sunxi-boards/Config.in"
 source "package/ux500-firmware/Config.in"
 source "package/zd1211-firmware/Config.in"
 endmenu
package/sunxi-boards/Config.in new file +170 -0

170 lines not on this page · raw message

package/sunxi-boards/sunxi-boards.mk new file +17 -0
new file mode 100644
index 0000000..dbbc063
@@ -0,0 +1,17 @@
+#############################################################
+#
+# sunxi-boards
+#
+#############################################################
+
+SUNXI_BOARDS_VERSION = 88d663db44f65b73ef65c4148a28c6fa3665d2b6
+SUNXI_BOARDS_SITE = https://github.com/linux-sunxi/sunxi-boards/tarball/master
+SUNXI_BOARDS_DEPENDENCIES = host-sunxi-tools
+
+FEX2BIN = $(HOST_DIR)/usr/bin/fex2bin
+
+define SUNXI_BOARDS_INSTALL_TARGET_CMDS
+	$(FEX2BIN) $(@D)/sys_config/a10/$(BR2_PACKAGE_SUNXI_BOARDS_FILE).fex $(BINARIES_DIR)/script.bin
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 2/3 sunxi-boards: new package

Dear Carlo Caione,

Quoted 2 lines · Carlo Caione

Sunxi-boards requires a compiled .fex files for hardware description, used by kernel during boot for hardware initialization.

Please copy this text into the package help text. And mention that it applies only to the linux-sunxi kernel and not the mainline kernel.

Quoted 174 lines
---
 package/Config.in                    |   1 +
 package/sunxi-boards/Config.in       | 170 +++++++++++++++++++++++++++++++++++
 package/sunxi-boards/sunxi-boards.mk |  17 ++++
 3 files changed, 188 insertions(+)
 create mode 100644 package/sunxi-boards/Config.in
 create mode 100644 package/sunxi-boards/sunxi-boards.mk
package/Config.in +1 -0
index 4bb8c77..72db358 100644
@@ -214,6 +214,7 @@ source "package/b43-firmware/Config.in"
 source "package/firmware-imx/Config.in"
 source "package/linux-firmware/Config.in"
 source "package/rpi-firmware/Config.in"
+source "package/sunxi-boards/Config.in"
 source "package/ux500-firmware/Config.in"
 source "package/zd1211-firmware/Config.in"
 endmenu
package/sunxi-boards/Config.in new file +147 -0
new file mode 100644
index 0000000..7d5db53
@@ -0,0 +1,170 @@
+config BR2_PACKAGE_SUNXI_BOARDS
+	bool "sunxi script.bin board file"
+	select BR2_PACKAGE_HOST_SUNXI_TOOLS
+	help
+	  Compiled '.fex' file used by the sun4i kernel
+
+	  https://github.com/linux-sunxi/sunxi-boards
+
+choice
+	prompt "sunxi board"
+	default BR2_PACKAGE_SUNXI_BOARDS_CUBIEBOARD
+	depends on BR2_PACKAGE_SUNXI_BOARDS
+	help
+	  Select the sunxi board
+
+config BR2_PACKAGE_SUNXI_BOARDS_CUBIEBOARD
+	bool "Cubieboard"
+	help
+	  Cubieboard
+
+config BR2_PACKAGE_SUNXI_BOARDS_A10_MID_1GB
+	bool "A10_mid_1GB"
+	help
+	  A10_mid_1GB
+
+config BR2_PACKAGE_SUNXI_BOARDS_BA10_TV_BOX
+	bool "A10_tv_box"
+	help
+	  A10_tv_box
+
+config BR2_PACKAGE_SUNXI_BOARDS_COBY_MID7042
+	bool "coby_mid7042"
+	help
+	  coby_mid7042
+
+config BR2_PACKAGE_SUNXI_BOARDS_COBY_MID8042
+	bool "coby_mid8042"
+	help
+	  coby_mid8042
+
+config BR2_PACKAGE_SUNXI_BOARDS_COBY_MID9742
+	bool "coby_mid9742"
+	help
+	  coby_mid9742
+
+config BR2_PACKAGE_SUNXI_BOARDS_CUBIEBOARD_512
+	bool "Cubieboard_512"
+	help
+	  Cubieboard_512
+
+config BR2_PACKAGE_SUNXI_BOARDS_GOOSEBERRY_A721
+	bool "Gooseberry_a721"
+	help
+	  Gooseberry_a721
+
+config BR2_PACKAGE_SUNXI_BOARDS_H6
+	bool "h6"
+	help
+	  h6
+
+config BR2_PACKAGE_SUNXI_BOARDS_HACKBERRY
+	bool "Hackberry"
+	help
+	  Hackberry
+
+config BR2_PACKAGE_SUNXI_BOARDS_HYUNDAI_A7HD
+	bool "hyundai_a7hd"
+	help
+	  hyundai_a7hd
+
+config BR2_PACKAGE_SUNXI_BOARDS_INET97F_II
+	bool "inet97f-ii"
+	help
+	  inet97f-ii
+
+config BR2_PACKAGE_SUNXI_BOARDS_MELE_A1000
+	bool "mele_a1000"
+	help
+	  mele_a1000
+
+config BR2_PACKAGE_SUNXI_BOARDS_MELE_A1000G
+	bool "mele_a1000G"
+	help
+	  mele_a1000g
+
+config BR2_PACKAGE_SUNXI_BOARDS_MINI_X_1GB
+	bool "mini-x-1gb"
+	help
+	  mini-x-1gb
+
+config BR2_PACKAGE_SUNXI_BOARDS_MINI_X
+	bool "mini-x"
+	help
+	  mini-x
+
+config BR2_PACKAGE_SUNXI_BOARDS_MK802_1GB
+	bool "mk802-1gb"
+	help
+	  mk802-1gb
+
+config BR2_PACKAGE_SUNXI_BOARDS_MK802
+	bool "mk802"
+	help
+	  mk802
+
+config BR2_PACKAGE_SUNXI_BOARDS_MK802II
+	bool "mk802ii"
+	help
+	  mk802ii
+
+config BR2_PACKAGE_SUNXI_BOARDS_POV_PROTAB2_IPS_3G
+	bool "pov_protab2_ips_3g"
+	help
+	  pov_protab2_ips_3g
+
+config BR2_PACKAGE_SUNXI_BOARDS_POV_PROTAB2_IPS9
+	bool "pov_protab2_ips9"
+	help
+	  pov_protab2_ips9
+
+config BR2_PACKAGE_SUNXI_BOARDS_UHOST_U1A
+	bool "uhost_u1a"
+	help
+	  uhost_u1a
+
+config BR2_PACKAGE_SUNXI_BOARDS_ZATAB
+	bool "zatab"
+	help
+	  zatab
+
+endchoice
+
+config BR2_PACKAGE_SUNXI_BOARDS_FILE
+	string
+	default "cubieboard"		if BR2_PACKAGE_SUNXI_BOARDS_CUBIEBOARD
+	default "a10_mid_1gb"		if BR2_PACKAGE_SUNXI_BOARDS_A10_MID_1GB
+	default "ba10_tv_box"		if BR2_PACKAGE_SUNXI_BOARDS_BA10_TV_BOX
+	default "coby_mid7042"		if BR2_PACKAGE_SUNXI_BOARDS_COBY_MID7042
+	default "coby_mid8042"		if BR2_PACKAGE_SUNXI_BOARDS_COBY_MID8042
+	default "coby_mid9742"		if BR2_PACKAGE_SUNXI_BOARDS_COBY_MID9742
+	default "cubieboard_512"	if BR2_PACKAGE_SUNXI_BOARDS_CUBIEBOARD_512
+	default "gooseberry_a721"	if BR2_PACKAGE_SUNXI_BOARDS_GOOSEBERRY_A721
+	default "h6"			if BR2_PACKAGE_SUNXI_BOARDS_H6
+	default "hackberry"		if BR2_PACKAGE_SUNXI_BOARDS_HACKBERRY
+	default "hyundai_a7hd"		if BR2_PACKAGE_SUNXI_BOARDS_HYUNDAI_A7HD
+	default "inet97f-ii"		if BR2_PACKAGE_SUNXI_BOARDS_INET97F_II
+	default "mele_a1000"		if BR2_PACKAGE_SUNXI_BOARDS_MELE_A1000

package/sunxi-boards/Config.in line 157

Quoted 10 lines
package/sunxi-boards/Config.in new file +10 -0
+	default "mele_a1000g"		if BR2_PACKAGE_SUNXI_BOARDS_MELE_A1000G
+	default "mini-x-1gb"		if BR2_PACKAGE_SUNXI_BOARDS_MINI_X_1GB
+	default "mini-x"		if BR2_PACKAGE_SUNXI_BOARDS_MINI_X
+	default "mk802-1gb"		if BR2_PACKAGE_SUNXI_BOARDS_MK802_1GB
+	default "mk802"			if BR2_PACKAGE_SUNXI_BOARDS_MK802
+	default "mk802ii"		if BR2_PACKAGE_SUNXI_BOARDS_MK802II
+	default "pov_protab2_ips_3g"	if BR2_PACKAGE_SUNXI_BOARDS_POV_PROTAB2_IPS_3g
+	default "pov_protab2_ips9"	if BR2_PACKAGE_SUNXI_BOARDS_POV_PROTAB2_IPS9
+	default "uhost_u1a"		if BR2_PACKAGE_SUNXI_BOARDS_UHOST_U1A
+	default "zatab"			if BR2_PACKAGE_SUNXI_BOARDS_ZATAB

Just like we do for the kernel or U-Boot, I think listing all possible configurations here is not really realistic. What about a single:

config BR2_PACKAGE_SUNXI_BOARDS_BOARD_NAME
string "Board name"
help
This field defines the name of the board for which the .fex files should be generated. See ... to see the list of valid board names.

package/sunxi-boards/Config.in line 65

Quoted 13 lines
package/sunxi-boards/Config.in new file +13 -0
+
+
+
+
+
+
+
+
+
+	
+
+
+

There shouldn't be all those empty new lines here.

Quoted 7 lines
package/sunxi-boards/sunxi-boards.mk new file +1 -0
new file mode 100644
index 0000000..dbbc063
@@ -0,0 +1,17 @@
+#############################################################

package/sunxi-boards/sunxi-boards.mk line 11

Quoted 10 lines
package/sunxi-boards/sunxi-boards.mk new file +10 -0
+#
+# sunxi-boards
+#
+#############################################################
+
+SUNXI_BOARDS_VERSION = 88d663db44f65b73ef65c4148a28c6fa3665d2b6
+SUNXI_BOARDS_SITE = https://github.com/linux-sunxi/sunxi-boards/tarball/master
+SUNXI_BOARDS_DEPENDENCIES = host-sunxi-tools
+
+FEX2BIN = $(HOST_DIR)/usr/bin/fex2bin

This one should be defined by sunxi-tools (i.e patch 1/3).

package/sunxi-boards/sunxi-boards.mk line 15

Quoted 3 lines
package/sunxi-boards/sunxi-boards.mk new file +3 -0
+define SUNXI_BOARDS_INSTALL_TARGET_CMDS
+	$(FEX2BIN) $(@D)/sys_config/a10/$(BR2_PACKAGE_SUNXI_BOARDS_FILE).fex $(BINARIES_DIR)/script.bin
+endef

This should be:

define SUNXI_BOARDS_INSTALL_IMAGES_CMDS

endef

and don't forget to SUNXI_BOARDS_INSTALL_IMAGES = YES and SUNXI_BOARDS_INSTALL_TARGET = NO.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw

PATCH 3/3 cubieboard: add support

In reply to Carlo Caione

patch adding:
- defconfig file
- post-build script
- script to generate bootable sd-card

v1 -> v2:
- Generation of script.bin now moved from post-build script to a new package
- mkcubiecard.sh: small modifications
- new packages in defconfig

---
 board/sunxi/cubieboard/boot.cmd       |   4 ++
 board/sunxi/cubieboard/mkcubiecard.sh | 119 ++++++++++++++++++++++++++++++++++
 board/sunxi/cubieboard/post-build.sh  |  19 ++++++
 configs/cubieboard_defconfig          |  47 ++++++++++++++
 4 files changed, 189 insertions(+)
 create mode 100644 board/sunxi/cubieboard/boot.cmd
 create mode 100755 board/sunxi/cubieboard/mkcubiecard.sh
 create mode 100755 board/sunxi/cubieboard/post-build.sh
 create mode 100644 configs/cubieboard_defconfig
board/sunxi/cubieboard/boot.cmd new file +4 -0
new file mode 100644
index 0000000..849ed00
@@ -0,0 +1,4 @@
+setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
+fatload mmc 0 0x43000000 script.bin
+fatload mmc 0 0x48000000 uImage
+bootm 0x48000000
board/sunxi/cubieboard/mkcubiecard.sh new file +119 -0

119 lines not on this page · raw message

board/sunxi/cubieboard/post-build.sh new file +19 -0
new file mode 100755
index 0000000..1f560e0
@@ -0,0 +1,19 @@
+#!/bin/sh
+# post-build.sh for CubieBoard
+# 2013, Carlo Caione <[email protected]>
+
+TARGET_DIR=$1
+IMAGES_DIR=$1/../images
+BOARD_DIR="$(dirname $0)"
+HOST_DIR=$1/../host/usr/bin
+
+MKIMAGE=$HOST_DIR/mkimage
+BOOT_CMD=$BOARD_DIR/boot.cmd
+BOOT_CMD_H=$IMAGES_DIR/boot.scr
+
+# U-Boot script
+if [ -e $MKIMAGE -a -e $BOOT_CMD ];
+then
+	$MKIMAGE -C none -A arm -T script -d $BOOT_CMD $BOOT_CMD_H
+fi
+
configs/cubieboard_defconfig new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 3/3 cubieboard: add support

Dear Carlo Caione,

Quoted 5 lines · Carlo Caione

patch adding:
- defconfig file
- post-build script
- script to generate bootable sd-card

Quoted 7 lines

v1 -> v2:
- Generation of script.bin now moved from post-build script to a new package
- mkcubiecard.sh: small modifications
- new packages in defconfig

Changelog must go...

Quoted 1 line

---

... here, i.e below the "---". If you put the changelog before the "---", then it gets committed as part of the project's git history.

Quoted 3 lines
 board/sunxi/cubieboard/boot.cmd       |   4 ++
 board/sunxi/cubieboard/mkcubiecard.sh | 119 ++++++++++++++++++++++++++++++++++
 board/sunxi/cubieboard/post-build.sh  |  19 ++++++

Maybe this should be board/cubietech/cubieboard/, since we generally use board/<manufacturer>/<boardname>/. But that's not really a strong suggestion.

Quoted 9 lines
board/sunxi/cubieboard/mkcubiecard.sh new file +3 -0
new file mode 100755
index 0000000..bed8002
@@ -0,0 +1,119 @@
+#! /bin/sh
+# mkCubieCard.sh v0.1:
+# 2013, Carlo Caione <[email protected]>

board/sunxi/cubieboard/mkcubiecard.sh line 13

Quoted 10 lines
board/sunxi/cubieboard/mkcubiecard.sh new file +10 -0
+# heavely based on :
+# mkA10card.sh v0.1
+# 2012, Jason Plum <[email protected]>
+# loosely based on :
+# mkcard.sh v0.5
+# (c) Copyright 2009 Graeme Gregory <[email protected]>
+# Licensed under terms of GPLv2
+#
+# Parts of the procudure base on the work of Denys Dmytriyenko
+# http://wiki.omap.com/index.php/MMC_Boot_Format

It would be good to have a board/cubietech/cubieboard/readme.txt that explains how to use this script. Look at other readme.txt files in board/, they generally try to give a very quick howto on how to use a given defconfig for a board, and generate something bootable on the board.

I believe this script may possibly be useful for other A10/A13 boards, but we'll see how it turns out when other A10/A13 boards are supported in Buildroot. For now, adding the script in a cubieboard-specific location is fine.

Quoted 6 lines
board/sunxi/cubieboard/post-build.sh new file +0 -0
new file mode 100755
index 0000000..1f560e0

board/sunxi/cubieboard/post-build.sh line 8

Quoted 8 lines
board/sunxi/cubieboard/post-build.sh new file +8 -0
@@ -0,0 +1,19 @@
+#!/bin/sh
+# post-build.sh for CubieBoard
+# 2013, Carlo Caione <[email protected]>
+
+TARGET_DIR=$1
+IMAGES_DIR=$1/../images
+BOARD_DIR="$(dirname $0)"
+HOST_DIR=$1/../host/usr/bin

Unfortunately, this is not really true. If the user sets BR2_HOST_DIR, then it may not be located at a place that can be guessed relatively to $TARGET_DIR.

Instead, HOST_DIR and BINARIES_DIR (which you name IMAGES_DIR) are exported in the environment. You should use these instead.

Quoted 30 lines
board/sunxi/cubieboard/post-build.sh new file +11 -0
+
+MKIMAGE=$HOST_DIR/mkimage
+BOOT_CMD=$BOARD_DIR/boot.cmd
+BOOT_CMD_H=$IMAGES_DIR/boot.scr
+
+# U-Boot script
+if [ -e $MKIMAGE -a -e $BOOT_CMD ];
+then
+	$MKIMAGE -C none -A arm -T script -d $BOOT_CMD $BOOT_CMD_H
+fi
+
configs/cubieboard_defconfig new file +13 -0
new file mode 100644
index 0000000..1e0bfb8
@@ -0,0 +1,47 @@
+# Architecture
+BR2_arm=y
+BR2_cortex_a8=y
+
+# System configuration
+BR2_TARGET_GENERIC_HOSTNAME="Cubieboard"
+BR2_TARGET_GENERIC_ISSUE="Welcome to use Cubieboard!"
+BR2_TARGET_GENERIC_GETTY=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/sunxi/cubieboard/post-build.sh"
+
+# Additional tools
+BR2_PACKAGE_HOST_SUNXI_TOOLS=y

configs/cubieboard_defconfig line 23

Quoted 10 lines
configs/cubieboard_defconfig new file +10 -0
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_SUNXI_TOOLS=y
+BR2_PACKAGE_SUNXI_BOARDS=y
+BR2_PACKAGE_SUNXI_BOARDS_CUBIEBOARD=y
+BR2_PACKAGE_SUNXI_BOARDS_FILE="cubieboard"
+
+# Kernel Header Options
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.4.29"
+BR2_DEFAULT_KERNEL_HEADERS="3.4.29"

Those three lines should just be:

BR2_KERNEL_HEADERS_3_4=y

configs/cubieboard_defconfig line 36

Quoted 12 lines
configs/cubieboard_defconfig new file +12 -0
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_GIT_REPO_URL="https://github.com/linux-sunxi/linux-sunxi.git"
+BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION="66025966cbe563e356b5e1dda0a572e738e13c42"
+BR2_LINUX_KERNEL_VERSION="sunxi-3.4"
+BR2_LINUX_KERNEL_DEFCONFIG="sun4i"
+
+# Misc
+BR2_JLEVEL=0
+BR2_CCACHE=y
+BR2_CCACHE_DIR="$(HOME)/.buildroot-ccache"

Those four lines should be removed. They are not related to Cubieboard specifically.

configs/cubieboard_defconfig line 47

Quoted 10 lines
configs/cubieboard_defconfig new file +10 -0
+# Bootloaders
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="cubieboard"
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_VERSION="sunxi"
+BR2_TARGET_UBOOT_CUSTOM_GIT_REPO_URL="https://github.com/linux-sunxi/u-boot-sunxi.git"
+BR2_TARGET_UBOOT_CUSTOM_GIT_VERSION="7aa9f04f571247a6bb999c168b49e09f05b86465"
+BR2_TARGET_UBOOT_FORMAT_BIN=y
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="spl/sunxi-spl.bin"

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH 1/3 sunxi-tools: new host/taget package

In reply to Carlo Caione

Dear Carlo Caione,

Typo in the title: taget -> target.

package/sunxi-tools/Config.in line 2

Quoted 8 lines · Carlo Caione
package/sunxi-tools/Config.in new file +2 -0
new file mode 100644
index 0000000..d151a74
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_SUNXI_TOOLS
+	bool "sunxi nand-part"

On hardware specific packages, we generally try to restrict them to the architecture on which they make sense, so you could add a:

depends on BR2_arm

here.

package/sunxi-tools/Config.in line 5

Quoted 3 lines
package/sunxi-tools/Config.in new file +3 -0
+	help
+	  nand-part is a tool to repartition the internal NAND on sunxi
+	  devices

It would be good to copy a bit more text from the host-sunxi package description. Something that at least mentions Allwinner A10 and A13.

package/sunxi-tools/Config.in.host line 2

Quoted 10 lines
package/sunxi-tools/Config.in new file +2 -0
+	  http://linux-sunxi.org/Sunxi-tools
+
package/sunxi-tools/Config.in.host new file +2 -0
new file mode 100644
index 0000000..0208adb
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_HOST_SUNXI_TOOLS
+	bool "host sunxi-tools"

depends on BR2_arm

package/sunxi-tools/Config.in.host line 8

Quoted 6 lines
package/sunxi-tools/Config.in.host new file +6 -0
+	help
+	  Tools for Allwinner A10 (aka sun4i) and A13 (aka sun5i) based devices.
+	  This includes fexc which can be used to compile .fex board definition files to
+	  the binary script.bin format required by the linux-sunxi kernel.
+
+	  http://linux-sunxi.org/Sunxi-tools

It would be good to mention explicitly that those tools don't apply to the mainline Linux kernel version.

Quoted 12 lines
package/sunxi-tools/Config.in.host new file +1 -0
+
package/sunxi-tools/sunxi-tools.mk new file +5 -0
new file mode 100644
index 0000000..cfb88d7
@@ -0,0 +1,42 @@
+#############################################################
+#
+# sunxi-tools
+#
+#############################################################

package/sunxi-tools/sunxi-tools.mk line 15

Quoted 10 lines
package/sunxi-tools/sunxi-tools.mk new file +10 -0
+
+SUNXI_TOOLS_VERSION = 3a94e721dd8d1e13d0b25da0a83463891e8e9ee0
+SUNXI_TOOLS_SITE = http://github.com/linux-sunxi/sunxi-tools/tarball/master
+SUNXI_TOOLS_LICENSE = GPLv2+
+SUNXI_TOOLS_LICENSE_FILES = COPYING
+HOST_SUNXI_TOOLS_DEPENDENCIES = host-libusb
+
+define HOST_SUNXI_TOOLS_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) CFLAGS="$(HOST_CFLAGS) -std=c99 \
+	  -D_POSIX_C_SOURCE=200112L -Iinclude/" LDFLAGS="$(HOST_LDFLAGS)" -C $(@D)

Maybe:

	$(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) \
		CFLAGS="$(HOST_CFLAGS) ..." -C $(@D)

we prefer using $(HOST_CONFIGURE_OPTS), which will pass the right CC, LD, LDFLAGS and so on. You only need to override CFLAGS here.

package/sunxi-tools/sunxi-tools.mk line 25

Quoted 10 lines
package/sunxi-tools/sunxi-tools.mk new file +10 -0
+endef
+
+define HOST_SUNXI_TOOLS_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/fexc $(HOST_DIR)/usr/bin/fexc
+	$(INSTALL) -D -m 0755 $(@D)/bin2fex $(HOST_DIR)/usr/bin/bin2fex
+	$(INSTALL) -D -m 0755 $(@D)/fex2bin $(HOST_DIR)/usr/bin/fex2bin
+	$(INSTALL) -D -m 0755 $(@D)/bootinfo $(HOST_DIR)/usr/bin/bootinfo
+	$(INSTALL) -D -m 0755 $(@D)/fel $(HOST_DIR)/usr/bin/fel
+	$(INSTALL) -D -m 0755 $(@D)/pio $(HOST_DIR)/usr/bin/pio
+	$(INSTALL) -D -m 0755 $(@D)/nand-part $(HOST_DIR)/usr/bin/nand-part

This could be changed to:

	for i in fexc bin2fex fex2bin bootinfo fel pio nand-part; do \
		$(INSTALL) -D -m 0755 $(@D)/$$i $(HOST_DIR)/usr/bin/$$i ; \
	done

also, isn't nand-part useful only on the target?

package/sunxi-tools/sunxi-tools.mk line 34

Quoted 9 lines
package/sunxi-tools/sunxi-tools.mk new file +9 -0
+endef
+
+define SUNXI_TOOLS_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)"                               \
+		LDFLAGS="$(TARGET_LDFLAGS)"                     \
+		CFLAGS="$(TARGET_CFLAGS)                        \
+		 -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/" \
+		 -C $(@D)					\
+		nand-part
	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS) ..." -C $(@D) nand-part

TARGET_CONFIGURE_OPTS already defines CC, LDFLAGS, CFLAGS for you. You only have to override the CFLAGS definition.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 1/3 sunxi-tools: new host/taget package

In reply to Carlo Caione

Dear Carlo Caione,

Quoted 11 lines · Carlo Caione
---
 package/Config.in                  |  1 +
 package/Config.in.host             |  1 +
 package/sunxi-tools/Config.in      |  8 ++++++++
 package/sunxi-tools/Config.in.host |  9 ++++++++
 package/sunxi-tools/sunxi-tools.mk | 42 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 61 insertions(+)
 create mode 100644 package/sunxi-tools/Config.in
 create mode 100644 package/sunxi-tools/Config.in.host
 create mode 100644 package/sunxi-tools/sunxi-tools.mk

Do you think you'll have the time to rework your patch series about Sunxi platform support? It would be great to have this in BR.

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com