All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-rockchip][PATCH 0/3] firefly gpt emmc update
@ 2017-02-17 18:07 Trevor Woerner
  2017-02-17 18:07 ` [meta-rockchip][PATCH 1/3] remove DEFAULTTUNEs Trevor Woerner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Trevor Woerner @ 2017-02-17 18:07 UTC (permalink / raw)
  To: yocto

This set of patches adds to meta-rockchip the ability to create an update
image using the latest GPT-style image for flashing to a firefly-rk3288's
eMMC.

Jacob Chen (2):
  u-boot-rockchip: add
  rockchip-next-img: add image for rockchip next-dev u-boot

Trevor Woerner (1):
  remove DEFAULTTUNEs

 README                                     |  15 ++++
 classes/rockchip-next-img.bbclass          | 130 +++++++++++++++++++++++++++++
 conf/machine/firefly-rk3288.conf           |   1 +
 conf/machine/include/rk3066.inc            |   1 -
 conf/machine/include/rk3288.inc            |  13 ++-
 recipes-bsp/u-boot/u-boot-rockchip_next.bb |  18 ++++
 6 files changed, 175 insertions(+), 3 deletions(-)
 create mode 100644 classes/rockchip-next-img.bbclass
 create mode 100644 recipes-bsp/u-boot/u-boot-rockchip_next.bb

-- 
2.11.0.258.ge05806d



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

* [meta-rockchip][PATCH 1/3] remove DEFAULTTUNEs
  2017-02-17 18:07 [meta-rockchip][PATCH 0/3] firefly gpt emmc update Trevor Woerner
@ 2017-02-17 18:07 ` Trevor Woerner
  2017-02-17 18:07 ` [meta-rockchip][PATCH 2/3] u-boot-rockchip: add Trevor Woerner
  2017-02-17 18:07 ` [meta-rockchip][PATCH 3/3] rockchip-next-img: add image for rockchip next-dev u-boot Trevor Woerner
  2 siblings, 0 replies; 7+ messages in thread
From: Trevor Woerner @ 2017-02-17 18:07 UTC (permalink / raw)
  To: yocto

The DEFAULTTUNE configuration should not be set at the BSP layer but in a
DISTRO layer (or a user's conf/local.conf). Remove the two DEFAULTTUNEs that
are currently in the layer and add a note in the README to inform users of
this issue and potential settings.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 README                          | 15 +++++++++++++++
 conf/machine/include/rk3066.inc |  1 -
 conf/machine/include/rk3288.inc |  1 -
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/README b/README
index ff28887..68ff433 100644
--- a/README
+++ b/README
@@ -49,6 +49,7 @@ Table of Contents
   I. Configure yocto/oe environment
  II. Building a second level bootloader based on kexec
 III. Booting your device
+ IV. Performance
 
 I. Configure yocto/oe environment
 ========================================
@@ -127,3 +128,17 @@ Then, plug your SDCARD into your Rockchip device and power on the board. If
 everything worked fine, Petitboot should be started automatically and list all 
 entries found in the configuration file.
 
+IV. Performance
+===============
+
+By default a BSP layer should not be tuning a build, this is a DISTRO-level
+decision. As such the default machine settings are meant to be the lowest
+common denominator in order to maximize generality. If you are interested in
+tweaking your build to maximize performance you can either use a DISTRO that
+has these same goals, or you can add settings in your configuration files
+(e.g. local.conf) as follows:
+
+	for rk3288:
+		DEFAULTTUNE = "cortexa17hf-neon-vfpv4"
+	for rk3066:
+		DEFAULTTUNE = "cortexa9-neon"
diff --git a/conf/machine/include/rk3066.inc b/conf/machine/include/rk3066.inc
index d43a88c..e307074 100644
--- a/conf/machine/include/rk3066.inc
+++ b/conf/machine/include/rk3066.inc
@@ -1,7 +1,6 @@
 # Copyright (C) 2014 NEO-Technologies
 # Released under the MIT license (see COPYING.MIT for the terms)
 
-DEFAULTTUNE = "cortexa9-neon"
 require conf/machine/include/tune-cortexa9.inc
 
 PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg"
diff --git a/conf/machine/include/rk3288.inc b/conf/machine/include/rk3288.inc
index e6c19a2..86fc567 100644
--- a/conf/machine/include/rk3288.inc
+++ b/conf/machine/include/rk3288.inc
@@ -3,7 +3,6 @@
 
 require conf/machine/include/tune-cortexa17.inc
 
-DEFAULTTUNE="cortexa17-neon"
 PREFERRED_PROVIDER_virtual/kernel = "linux"
 SERIAL_CONSOLES = "115200;ttyS2"
 KERNEL_IMAGETYPE = "zImage"
-- 
2.11.0.258.ge05806d



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

* [meta-rockchip][PATCH 2/3] u-boot-rockchip: add
  2017-02-17 18:07 [meta-rockchip][PATCH 0/3] firefly gpt emmc update Trevor Woerner
  2017-02-17 18:07 ` [meta-rockchip][PATCH 1/3] remove DEFAULTTUNEs Trevor Woerner
@ 2017-02-17 18:07 ` Trevor Woerner
  2017-02-18 17:42   ` Romain Perier
  2017-02-17 18:07 ` [meta-rockchip][PATCH 3/3] rockchip-next-img: add image for rockchip next-dev u-boot Trevor Woerner
  2 siblings, 1 reply; 7+ messages in thread
From: Trevor Woerner @ 2017-02-17 18:07 UTC (permalink / raw)
  To: yocto; +Cc: Jacob Chen

From: Jacob Chen <jacob-chen@iotwrt.com>

Rockchip next-dev U-boot is the next generation of rockchip u-boot, will also
be an upstream tracking branch At present, this branch is just a rebased
upstream u-boot.

Reviewed-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
---
 conf/machine/firefly-rk3288.conf           |  1 +
 conf/machine/include/rk3288.inc            |  8 +++++++-
 recipes-bsp/u-boot/u-boot-rockchip_next.bb | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 recipes-bsp/u-boot/u-boot-rockchip_next.bb

diff --git a/conf/machine/firefly-rk3288.conf b/conf/machine/firefly-rk3288.conf
index 8fa005d..58d752b 100644
--- a/conf/machine/firefly-rk3288.conf
+++ b/conf/machine/firefly-rk3288.conf
@@ -8,3 +8,4 @@
 
 include conf/machine/include/rk3288.inc
 KERNEL_DEVICETREE = "rk3288-firefly.dtb"
+UBOOT_MACHINE = "firefly-rk3288_defconfig"
diff --git a/conf/machine/include/rk3288.inc b/conf/machine/include/rk3288.inc
index 86fc567..f067ad5 100644
--- a/conf/machine/include/rk3288.inc
+++ b/conf/machine/include/rk3288.inc
@@ -1,9 +1,15 @@
 # Copyright (C) 2015 Romain Perier
 # Released under the MIT license (see COPYING.MIT for the terms)
 
+SOC_FAMILY = "rk3288"
+
 require conf/machine/include/tune-cortexa17.inc
+require conf/machine/include/soc-family.inc
 
 PREFERRED_PROVIDER_virtual/kernel = "linux"
-SERIAL_CONSOLES = "115200;ttyS2"
 KERNEL_IMAGETYPE = "zImage"
 KBUILD_DEFCONFIG = "multi_v7_defconfig"
+
+PREFERRED_PROVIDER_virtual/bootloader = "u-boot-rockchip"
+SERIAL_CONSOLES = "115200;ttyS2"
+SPL_BINARY = "u-boot-spl-dtb.bin"
diff --git a/recipes-bsp/u-boot/u-boot-rockchip_next.bb b/recipes-bsp/u-boot/u-boot-rockchip_next.bb
new file mode 100644
index 0000000..845f9da
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-rockchip_next.bb
@@ -0,0 +1,18 @@
+# Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require recipes-bsp/u-boot/u-boot.inc
+
+DESCRIPTION = "Rockchip next-dev U-Boot"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
+COMPATIBLE_MACHINE = "(rk3288)"
+
+SRC_URI = "git://github.com/rockchip-linux/u-boot.git;branch=release;"
+SRCREV = "${AUTOREV}"
+S = "${WORKDIR}/git"
+
+do_deploy_prepend () {
+	# copy to default search path
+	cp ${B}/spl/${SPL_BINARY} ${B}/
+}
-- 
2.11.0.258.ge05806d



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

* [meta-rockchip][PATCH 3/3] rockchip-next-img: add image for rockchip next-dev u-boot
  2017-02-17 18:07 [meta-rockchip][PATCH 0/3] firefly gpt emmc update Trevor Woerner
  2017-02-17 18:07 ` [meta-rockchip][PATCH 1/3] remove DEFAULTTUNEs Trevor Woerner
  2017-02-17 18:07 ` [meta-rockchip][PATCH 2/3] u-boot-rockchip: add Trevor Woerner
@ 2017-02-17 18:07 ` Trevor Woerner
  2017-02-18 17:50   ` Romain Perier
  2 siblings, 1 reply; 7+ messages in thread
From: Trevor Woerner @ 2017-02-17 18:07 UTC (permalink / raw)
  To: yocto; +Cc: Jacob Chen

From: Jacob Chen <jacob-chen@iotwrt.com>

Being different from the previous rk-boot which use parameter, next-dev u-boot
use gpt partition, so it needs to generate a different image.

Reviewed-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
---
 classes/rockchip-next-img.bbclass | 130 ++++++++++++++++++++++++++++++++++++++
 conf/machine/include/rk3288.inc   |   4 ++
 2 files changed, 134 insertions(+)
 create mode 100644 classes/rockchip-next-img.bbclass

diff --git a/classes/rockchip-next-img.bbclass b/classes/rockchip-next-img.bbclass
new file mode 100644
index 0000000..cd87dee
--- /dev/null
+++ b/classes/rockchip-next-img.bbclass
@@ -0,0 +1,130 @@
+# Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+inherit image_types
+
+# Use an uncompressed ext4 by default as rootfs
+IMG_ROOTFS_TYPE = "ext4"
+IMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.${IMG_ROOTFS_TYPE}"
+
+# This image depends on the rootfs image
+IMAGE_TYPEDEP_rockchip-next-img = "${IMG_ROOTFS_TYPE}"
+
+NEXT_IMG       = "${IMAGE_NAME}.next.img"
+BOOT_IMG       = "boot.img"
+MINILOADER     = "loader.bin"
+UBOOT          = "u-boot.out"
+TRUST          = "trust.out"
+
+# Target image total size [in MiB]
+NEXT_IMG_SIZE ?= "4096"
+
+# default partitions [in Sectors]
+# More info at http://rockchip.wikidot.com/partitions
+LOADER1_SIZE = "8000"
+RESERVED1_SIZE = "128"
+RESERVED2_SIZE = "8192"
+LOADER2_SIZE = "8192"
+ATF_SIZE = "8192"
+BOOT_SIZE = "229376"
+
+IMAGE_DEPENDS_rockchip-next-img = "parted-native \
+	u-boot-mkimage-native \
+	mtools-native \
+	dosfstools-native \
+	virtual/kernel:do_deploy \
+	virtual/bootloader:do_deploy"
+
+PER_CHIP_IMG_GENERATION_COMMAND_rk3288 = "generate_rk3288_image"
+
+IMAGE_CMD_rockchip-next-img () {
+	# Change to image directory
+	cd ${DEPLOY_DIR_IMAGE}
+
+	create_rk_image
+
+	${PER_CHIP_IMG_GENERATION_COMMAND}
+}
+
+create_rk_image () {
+
+	echo "Creating filesystem with total size ${NEXT_IMG_SIZE} MiB"
+
+	# Remove the exist image
+	rm -rf *.next.img
+
+	# Initialize sdcard image file
+	dd if=/dev/zero of=${NEXT_IMG} bs=1M count=0 seek=${NEXT_IMG_SIZE}
+
+	# Create partition table
+	parted -s ${NEXT_IMG} mklabel gpt
+
+	# Create vendor defined partitions
+	LOADER1_START=64
+	RESERVED1_START=`expr ${LOADER1_START}  + ${LOADER1_SIZE}`
+	RESERVED2_START=`expr ${RESERVED1_START}  + ${RESERVED1_SIZE}`
+	LOADER2_START=`expr ${RESERVED2_START}  + ${RESERVED2_SIZE}`
+	ATF_START=`expr ${LOADER2_START}  + ${LOADER2_SIZE}`
+	BOOT_START=`expr ${ATF_START}  + ${ATF_SIZE}`
+	ROOTFS_START=`expr ${BOOT_START}  + ${BOOT_SIZE}`
+
+	parted -s ${NEXT_IMG} unit s mkpart loader1 ${LOADER1_START} `expr ${RESERVED1_START} - 1`
+	parted -s ${NEXT_IMG} unit s mkpart reserved1 ${RESERVED1_START} `expr ${RESERVED2_START} - 1`
+	parted -s ${NEXT_IMG} unit s mkpart reserved2 ${RESERVED2_START} `expr ${LOADER2_START} - 1`
+	parted -s ${NEXT_IMG} unit s mkpart loader2 ${LOADER2_START} `expr ${ATF_START} - 1`
+	parted -s ${NEXT_IMG} unit s mkpart atf ${ATF_START} `expr ${BOOT_START} - 1`
+
+	# Create boot partition and mark it as bootable
+	parted -s ${NEXT_IMG} unit s mkpart boot ${BOOT_START} `expr ${ROOTFS_START} - 1`
+	parted -s ${NEXT_IMG} set 6 boot on
+
+	# Create rootfs partition
+	parted -s ${NEXT_IMG} unit s mkpart root ${ROOTFS_START} 100%
+
+	parted ${NEXT_IMG} print
+
+	# Delete the boot image to avoid trouble with the build cache
+	rm -f ${WORKDIR}/${BOOT_IMG}
+
+	# Create boot partition image
+	BOOT_BLOCKS=$(LC_ALL=C parted -s ${NEXT_IMG} unit b print | awk '/ 6 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
+	BOOT_BLOCKS=`expr $BOOT_BLOCKS / 63 \* 63`
+
+	mkfs.vfat -n "boot" -S 512 -C ${WORKDIR}/${BOOT_IMG} $BOOT_BLOCKS
+	mcopy -i ${WORKDIR}/${BOOT_IMG} -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin ::${KERNEL_IMAGETYPE}
+
+	DEVICETREE_DEFAULT=""
+	for DTS_FILE in ${KERNEL_DEVICETREE}; do
+		[ -n "${DEVICETREE_DEFAULT}"] && DEVICETREE_DEFAULT="${DTS_FILE}"
+		mcopy -i ${WORKDIR}/${BOOT_IMG} -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_FILE} ::${DTS_FILE}
+	done
+
+	# Create extlinux config file
+	cat > ${WORKDIR}/extlinux.conf <<EOF
+default yocto
+
+label yocto
+	kernel /${KERNEL_IMAGETYPE}
+	devicetree /${DEVICETREE_DEFAULT}
+	append ${APPEND}
+EOF
+
+	mmd -i ${WORKDIR}/${BOOT_IMG} ::/extlinux
+	mcopy -i ${WORKDIR}/${BOOT_IMG} -s ${WORKDIR}/extlinux.conf ::/extlinux/
+
+	# Burn Boot Partition
+	dd if=${WORKDIR}/${BOOT_IMG} of=${NEXT_IMG} conv=notrunc,fsync seek=${BOOT_START}
+
+	# Burn Rootfs Partition
+	dd if=${IMG_ROOTFS} of=${NEXT_IMG} seek=${ROOTFS_START}
+
+}
+
+generate_rk3288_image () {
+
+	# Burn bootloader
+	mkimage -n rk3288 -T rksd -d ${DEPLOY_DIR_IMAGE}/${SPL_BINARY} ${WORKDIR}/${UBOOT}
+	cat ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin >>  ${WORKDIR}/${UBOOT}
+	dd if=${WORKDIR}/${UBOOT} of=${NEXT_IMG} conv=notrunc,fsync seek=64
+
+}
diff --git a/conf/machine/include/rk3288.inc b/conf/machine/include/rk3288.inc
index f067ad5..68936bf 100644
--- a/conf/machine/include/rk3288.inc
+++ b/conf/machine/include/rk3288.inc
@@ -9,7 +9,11 @@ require conf/machine/include/soc-family.inc
 PREFERRED_PROVIDER_virtual/kernel = "linux"
 KERNEL_IMAGETYPE = "zImage"
 KBUILD_DEFCONFIG = "multi_v7_defconfig"
+APPEND = "console=tty1 console=ttyS2,115200n8 rw root=/dev/mmcblk2p7 rootfstype=ext4 init=/sbin/init"
 
 PREFERRED_PROVIDER_virtual/bootloader = "u-boot-rockchip"
 SERIAL_CONSOLES = "115200;ttyS2"
 SPL_BINARY = "u-boot-spl-dtb.bin"
+
+IMAGE_CLASSES += "rockchip-next-img"
+IMAGE_FSTYPES += "ext4 rockchip-next-img"
-- 
2.11.0.258.ge05806d



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

* Re: [meta-rockchip][PATCH 2/3] u-boot-rockchip: add
  2017-02-17 18:07 ` [meta-rockchip][PATCH 2/3] u-boot-rockchip: add Trevor Woerner
@ 2017-02-18 17:42   ` Romain Perier
  0 siblings, 0 replies; 7+ messages in thread
From: Romain Perier @ 2017-02-18 17:42 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: Romain Perier, yocto, Jacob Chen

[-- Attachment #1: Type: text/plain, Size: 3196 bytes --]

Hi.

Could you:
- Split this commit into 3 differents commits: one for firefly, one for
rk3288.inc and another one for the recipe
- Just call the recipe u-boot-rockchip, even if that's next we don't care.
That's your version of uboot based on mainline and it's a release branch,
so "next" is useless.
- I don't like COMPATIBLE_MACHINE=(rk3288)... only add supported boards
(that are parts of the meta layer)

Thanks!
Romain

2017-02-17 19:07 GMT+01:00 Trevor Woerner <twoerner@gmail.com>:

> From: Jacob Chen <jacob-chen@iotwrt.com>
>
> Rockchip next-dev U-boot is the next generation of rockchip u-boot, will
> also
> be an upstream tracking branch At present, this branch is just a rebased
> upstream u-boot.
>
> Reviewed-by: Trevor Woerner <twoerner@gmail.com>
> Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
> ---
>  conf/machine/firefly-rk3288.conf           |  1 +
>  conf/machine/include/rk3288.inc            |  8 +++++++-
>  recipes-bsp/u-boot/u-boot-rockchip_next.bb | 18 ++++++++++++++++++
>  3 files changed, 26 insertions(+), 1 deletion(-)
>  create mode 100644 recipes-bsp/u-boot/u-boot-rockchip_next.bb
>
> diff --git a/conf/machine/firefly-rk3288.conf
> b/conf/machine/firefly-rk3288.conf
> index 8fa005d..58d752b 100644
> --- a/conf/machine/firefly-rk3288.conf
> +++ b/conf/machine/firefly-rk3288.conf
> @@ -8,3 +8,4 @@
>
>  include conf/machine/include/rk3288.inc
>  KERNEL_DEVICETREE = "rk3288-firefly.dtb"
> +UBOOT_MACHINE = "firefly-rk3288_defconfig"
> diff --git a/conf/machine/include/rk3288.inc
> b/conf/machine/include/rk3288.inc
> index 86fc567..f067ad5 100644
> --- a/conf/machine/include/rk3288.inc
> +++ b/conf/machine/include/rk3288.inc
> @@ -1,9 +1,15 @@
>  # Copyright (C) 2015 Romain Perier
>  # Released under the MIT license (see COPYING.MIT for the terms)
>
> +SOC_FAMILY = "rk3288"
> +
>  require conf/machine/include/tune-cortexa17.inc
> +require conf/machine/include/soc-family.inc
>
>  PREFERRED_PROVIDER_virtual/kernel = "linux"
> -SERIAL_CONSOLES = "115200;ttyS2"
>  KERNEL_IMAGETYPE = "zImage"
>  KBUILD_DEFCONFIG = "multi_v7_defconfig"
> +
> +PREFERRED_PROVIDER_virtual/bootloader = "u-boot-rockchip"
> +SERIAL_CONSOLES = "115200;ttyS2"
> +SPL_BINARY = "u-boot-spl-dtb.bin"
> diff --git a/recipes-bsp/u-boot/u-boot-rockchip_next.bb
> b/recipes-bsp/u-boot/u-boot-rockchip_next.bb
> new file mode 100644
> index 0000000..845f9da
> --- /dev/null
> +++ b/recipes-bsp/u-boot/u-boot-rockchip_next.bb
> @@ -0,0 +1,18 @@
> +# Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd
> +# Released under the MIT license (see COPYING.MIT for the terms)
> +
> +require recipes-bsp/u-boot/u-boot.inc
> +
> +DESCRIPTION = "Rockchip next-dev U-Boot"
> +LICENSE = "GPLv2+"
> +LIC_FILES_CHKSUM = "file://Licenses/README;md5=
> a2c678cfd4a4d97135585cad908541c6"
> +COMPATIBLE_MACHINE = "(rk3288)"
> +
> +SRC_URI = "git://github.com/rockchip-linux/u-boot.git;branch=release;"
> +SRCREV = "${AUTOREV}"
> +S = "${WORKDIR}/git"
> +
> +do_deploy_prepend () {
> +       # copy to default search path
> +       cp ${B}/spl/${SPL_BINARY} ${B}/
> +}
> --
> 2.11.0.258.ge05806d
>
>

[-- Attachment #2: Type: text/html, Size: 4751 bytes --]

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

* Re: [meta-rockchip][PATCH 3/3] rockchip-next-img: add image for rockchip next-dev u-boot
  2017-02-17 18:07 ` [meta-rockchip][PATCH 3/3] rockchip-next-img: add image for rockchip next-dev u-boot Trevor Woerner
@ 2017-02-18 17:50   ` Romain Perier
  2017-02-19  2:37     ` Trevor Woerner
  0 siblings, 1 reply; 7+ messages in thread
From: Romain Perier @ 2017-02-18 17:50 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: yocto, Jacob Chen

[-- Attachment #1: Type: text/plain, Size: 7212 bytes --]

Hi,

1 patch per feature or per different component. So  I should get a patch
for rk3288.inc and another one for the class :)

Suppose I am a user of meta-rockchip. I want to use a class for generating
a image. The name "rockchip-img-next" is not clear at all for me.
If that's for the sdcard call it rockchip-img-sdmmc if later you plan to
add a class for emmc call it rockchip-img-emmc :)

Why so complicated when you can make it simple ? ;)

Also, could you add more details to your commit messages please

Regards,
Romain



2017-02-17 19:07 GMT+01:00 Trevor Woerner <twoerner@gmail.com>:

> From: Jacob Chen <jacob-chen@iotwrt.com>
>
> Being different from the previous rk-boot which use parameter, next-dev
> u-boot
> use gpt partition, so it needs to generate a different image.
>
> Reviewed-by: Trevor Woerner <twoerner@gmail.com>
> Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
> ---
>  classes/rockchip-next-img.bbclass | 130 ++++++++++++++++++++++++++++++
> ++++++++
>  conf/machine/include/rk3288.inc   |   4 ++
>  2 files changed, 134 insertions(+)
>  create mode 100644 classes/rockchip-next-img.bbclass
>
> diff --git a/classes/rockchip-next-img.bbclass
> b/classes/rockchip-next-img.bbclass
> new file mode 100644
> index 0000000..cd87dee
> --- /dev/null
> +++ b/classes/rockchip-next-img.bbclass
> @@ -0,0 +1,130 @@
> +# Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd
> +# Released under the MIT license (see COPYING.MIT for the terms)
> +
> +inherit image_types
> +
> +# Use an uncompressed ext4 by default as rootfs
> +IMG_ROOTFS_TYPE = "ext4"
> +IMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.${IMG_ROOTFS_TYPE}"
> +
> +# This image depends on the rootfs image
> +IMAGE_TYPEDEP_rockchip-next-img = "${IMG_ROOTFS_TYPE}"
> +
> +NEXT_IMG       = "${IMAGE_NAME}.next.img"
> +BOOT_IMG       = "boot.img"
> +MINILOADER     = "loader.bin"
> +UBOOT          = "u-boot.out"
> +TRUST          = "trust.out"
> +
> +# Target image total size [in MiB]
> +NEXT_IMG_SIZE ?= "4096"
> +
> +# default partitions [in Sectors]
> +# More info at http://rockchip.wikidot.com/partitions
> +LOADER1_SIZE = "8000"
> +RESERVED1_SIZE = "128"
> +RESERVED2_SIZE = "8192"
> +LOADER2_SIZE = "8192"
> +ATF_SIZE = "8192"
> +BOOT_SIZE = "229376"
> +
> +IMAGE_DEPENDS_rockchip-next-img = "parted-native \
> +       u-boot-mkimage-native \
> +       mtools-native \
> +       dosfstools-native \
> +       virtual/kernel:do_deploy \
> +       virtual/bootloader:do_deploy"
> +
> +PER_CHIP_IMG_GENERATION_COMMAND_rk3288 = "generate_rk3288_image"
> +
> +IMAGE_CMD_rockchip-next-img () {
> +       # Change to image directory
> +       cd ${DEPLOY_DIR_IMAGE}
> +
> +       create_rk_image
> +
> +       ${PER_CHIP_IMG_GENERATION_COMMAND}
> +}
> +
> +create_rk_image () {
> +
> +       echo "Creating filesystem with total size ${NEXT_IMG_SIZE} MiB"
> +
> +       # Remove the exist image
> +       rm -rf *.next.img
> +
> +       # Initialize sdcard image file
> +       dd if=/dev/zero of=${NEXT_IMG} bs=1M count=0 seek=${NEXT_IMG_SIZE}
> +
> +       # Create partition table
> +       parted -s ${NEXT_IMG} mklabel gpt
> +
> +       # Create vendor defined partitions
> +       LOADER1_START=64
> +       RESERVED1_START=`expr ${LOADER1_START}  + ${LOADER1_SIZE}`
> +       RESERVED2_START=`expr ${RESERVED1_START}  + ${RESERVED1_SIZE}`
> +       LOADER2_START=`expr ${RESERVED2_START}  + ${RESERVED2_SIZE}`
> +       ATF_START=`expr ${LOADER2_START}  + ${LOADER2_SIZE}`
> +       BOOT_START=`expr ${ATF_START}  + ${ATF_SIZE}`
> +       ROOTFS_START=`expr ${BOOT_START}  + ${BOOT_SIZE}`
> +
> +       parted -s ${NEXT_IMG} unit s mkpart loader1 ${LOADER1_START} `expr
> ${RESERVED1_START} - 1`
> +       parted -s ${NEXT_IMG} unit s mkpart reserved1 ${RESERVED1_START}
> `expr ${RESERVED2_START} - 1`
> +       parted -s ${NEXT_IMG} unit s mkpart reserved2 ${RESERVED2_START}
> `expr ${LOADER2_START} - 1`
> +       parted -s ${NEXT_IMG} unit s mkpart loader2 ${LOADER2_START} `expr
> ${ATF_START} - 1`
> +       parted -s ${NEXT_IMG} unit s mkpart atf ${ATF_START} `expr
> ${BOOT_START} - 1`
> +
> +       # Create boot partition and mark it as bootable
> +       parted -s ${NEXT_IMG} unit s mkpart boot ${BOOT_START} `expr
> ${ROOTFS_START} - 1`
> +       parted -s ${NEXT_IMG} set 6 boot on
> +
> +       # Create rootfs partition
> +       parted -s ${NEXT_IMG} unit s mkpart root ${ROOTFS_START} 100%
> +
> +       parted ${NEXT_IMG} print
> +
> +       # Delete the boot image to avoid trouble with the build cache
> +       rm -f ${WORKDIR}/${BOOT_IMG}
> +
> +       # Create boot partition image
> +       BOOT_BLOCKS=$(LC_ALL=C parted -s ${NEXT_IMG} unit b print | awk '/
> 6 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
> +       BOOT_BLOCKS=`expr $BOOT_BLOCKS / 63 \* 63`
> +
> +       mkfs.vfat -n "boot" -S 512 -C ${WORKDIR}/${BOOT_IMG} $BOOT_BLOCKS
> +       mcopy -i ${WORKDIR}/${BOOT_IMG} -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin
> ::${KERNEL_IMAGETYPE}
> +
> +       DEVICETREE_DEFAULT=""
> +       for DTS_FILE in ${KERNEL_DEVICETREE}; do
> +               [ -n "${DEVICETREE_DEFAULT}"] && DEVICETREE_DEFAULT="${DTS_
> FILE}"
> +               mcopy -i ${WORKDIR}/${BOOT_IMG} -s
> ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_FILE} ::${DTS_FILE}
> +       done
> +
> +       # Create extlinux config file
> +       cat > ${WORKDIR}/extlinux.conf <<EOF
> +default yocto
> +
> +label yocto
> +       kernel /${KERNEL_IMAGETYPE}
> +       devicetree /${DEVICETREE_DEFAULT}
> +       append ${APPEND}
> +EOF
> +
> +       mmd -i ${WORKDIR}/${BOOT_IMG} ::/extlinux
> +       mcopy -i ${WORKDIR}/${BOOT_IMG} -s ${WORKDIR}/extlinux.conf
> ::/extlinux/
> +
> +       # Burn Boot Partition
> +       dd if=${WORKDIR}/${BOOT_IMG} of=${NEXT_IMG} conv=notrunc,fsync
> seek=${BOOT_START}
> +
> +       # Burn Rootfs Partition
> +       dd if=${IMG_ROOTFS} of=${NEXT_IMG} seek=${ROOTFS_START}
> +
> +}
> +
> +generate_rk3288_image () {
> +
> +       # Burn bootloader
> +       mkimage -n rk3288 -T rksd -d ${DEPLOY_DIR_IMAGE}/${SPL_BINARY}
> ${WORKDIR}/${UBOOT}
> +       cat ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin >>
> ${WORKDIR}/${UBOOT}
> +       dd if=${WORKDIR}/${UBOOT} of=${NEXT_IMG} conv=notrunc,fsync seek=64
> +
> +}
> diff --git a/conf/machine/include/rk3288.inc
> b/conf/machine/include/rk3288.inc
> index f067ad5..68936bf 100644
> --- a/conf/machine/include/rk3288.inc
> +++ b/conf/machine/include/rk3288.inc
> @@ -9,7 +9,11 @@ require conf/machine/include/soc-family.inc
>  PREFERRED_PROVIDER_virtual/kernel = "linux"
>  KERNEL_IMAGETYPE = "zImage"
>  KBUILD_DEFCONFIG = "multi_v7_defconfig"
> +APPEND = "console=tty1 console=ttyS2,115200n8 rw root=/dev/mmcblk2p7
> rootfstype=ext4 init=/sbin/init"
>
>  PREFERRED_PROVIDER_virtual/bootloader = "u-boot-rockchip"
>  SERIAL_CONSOLES = "115200;ttyS2"
>  SPL_BINARY = "u-boot-spl-dtb.bin"
> +
> +IMAGE_CLASSES += "rockchip-next-img"
> +IMAGE_FSTYPES += "ext4 rockchip-next-img"
> --
> 2.11.0.258.ge05806d
>
>

[-- Attachment #2: Type: text/html, Size: 8997 bytes --]

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

* Re: [meta-rockchip][PATCH 3/3] rockchip-next-img: add image for rockchip next-dev u-boot
  2017-02-18 17:50   ` Romain Perier
@ 2017-02-19  2:37     ` Trevor Woerner
  0 siblings, 0 replies; 7+ messages in thread
From: Trevor Woerner @ 2017-02-19  2:37 UTC (permalink / raw)
  To: Romain Perier; +Cc: yocto, Jacob Chen

On Sat 2017-02-18 @ 06:50:05 PM, Romain Perier wrote:
> 1 patch per feature or per different component. So  I should get a patch
> for rk3288.inc and another one for the class :)

I could argue that this is one patch since the only way to flash (for example)
the Firefly is to use the image this class generates so now that this bbclass
exists, rk3288 builds should be using it.

In any case I've split them up and taken the opportunity to rename and re-work
the commit.

> Suppose I am a user of meta-rockchip. I want to use a class for generating
> a image. The name "rockchip-img-next" is not clear at all for me.
> If that's for the sdcard call it rockchip-img-sdmmc if later you plan to
> add a class for emmc call it rockchip-img-emmc :)

Agreed, it is too vague. A v2 is on its way! :-)


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

end of thread, other threads:[~2017-02-19  2:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 18:07 [meta-rockchip][PATCH 0/3] firefly gpt emmc update Trevor Woerner
2017-02-17 18:07 ` [meta-rockchip][PATCH 1/3] remove DEFAULTTUNEs Trevor Woerner
2017-02-17 18:07 ` [meta-rockchip][PATCH 2/3] u-boot-rockchip: add Trevor Woerner
2017-02-18 17:42   ` Romain Perier
2017-02-17 18:07 ` [meta-rockchip][PATCH 3/3] rockchip-next-img: add image for rockchip next-dev u-boot Trevor Woerner
2017-02-18 17:50   ` Romain Perier
2017-02-19  2:37     ` Trevor Woerner

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.