All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions.
@ 2017-06-16 21:15 drew.moseley
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 1/3] u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file drew.moseley
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: drew.moseley @ 2017-06-16 21:15 UTC (permalink / raw)
  To: yocto; +Cc: Drew Moseley

From: Drew Moseley <drew.moseley@mender.io>

This set of patches adds the native tools and target components needed to
reflash the CHIP boards.  Additionally a shell script is added to the deploy
directory showing how to kick off a flash update. It's not ideal as I've
hardcoded a max size for the UBI image into the script and didn't see much
of an alternative. It does function though.

Drew

The following changes since commit 0079e6ac10fc371d6f527270c23b887561f717aa:

  chip: Append to MACHINE_EXTRA_RRECOMMENDS rather than overwriting (2017-06-15 13:37:19 +0100)

are available in the git repository at:

  git@github.com:drewmoseley/meta-chip.git flashing-instructions

for you to fetch changes up to 195a92fc1faa49495d1a2b6cda0134f07ce72189:

  chip: Add chip-u-boot-scr recipe and flash script (2017-06-15 11:27:06 -0400)

----------------------------------------------------------------
Drew Moseley (3):
      u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file.
      chip: Build sunxi-tools-native.
      chip: Add chip-u-boot-scr recipe and flash script

 README                                          | 26 ++++++++-
 conf/layer.conf                                 |  3 ++
 conf/machine/chip.conf                          |  3 +-
 recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb  | 70 +++++++++++++++++++++++++
 recipes-bsp/chip-u-boot-scr/files/boot.cmd.full | 32 +++++++++++
 recipes-bsp/chip-u-boot-scr/files/boot.cmd.in   | 43 +++++++++++++++
 recipes-bsp/u-boot/u-boot-chip_git.bb           |  7 +++
 7 files changed, 182 insertions(+), 2 deletions(-)
 create mode 100644 recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb
 create mode 100644 recipes-bsp/chip-u-boot-scr/files/boot.cmd.full
 create mode 100644 recipes-bsp/chip-u-boot-scr/files/boot.cmd.in

Drew Moseley (3):
  u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file.
  chip: Build sunxi-tools-native.
  chip: Add chip-u-boot-scr recipe and flash script

 README                                          | 26 ++++++++-
 conf/layer.conf                                 |  3 ++
 conf/machine/chip.conf                          |  3 +-
 recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb  | 70 +++++++++++++++++++++++++
 recipes-bsp/chip-u-boot-scr/files/boot.cmd.full | 32 +++++++++++
 recipes-bsp/chip-u-boot-scr/files/boot.cmd.in   | 43 +++++++++++++++
 recipes-bsp/u-boot/u-boot-chip_git.bb           |  7 +++
 7 files changed, 182 insertions(+), 2 deletions(-)
 create mode 100644 recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb
 create mode 100644 recipes-bsp/chip-u-boot-scr/files/boot.cmd.full
 create mode 100644 recipes-bsp/chip-u-boot-scr/files/boot.cmd.in

-- 
2.7.4



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

* [meta-chip][RFC PATCH 1/3] u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file.
  2017-06-16 21:15 [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions drew.moseley
@ 2017-06-16 21:15 ` drew.moseley
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 2/3] chip: Build sunxi-tools-native drew.moseley
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: drew.moseley @ 2017-06-16 21:15 UTC (permalink / raw)
  To: yocto

From: Drew Moseley <drew.moseley@mender.io>

Signed-off-by: Drew Moseley <drew.moseley@mender.io>
---
 conf/machine/chip.conf                | 1 +
 recipes-bsp/u-boot/u-boot-chip_git.bb | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/conf/machine/chip.conf b/conf/machine/chip.conf
index 0a45a2f..8f54067 100644
--- a/conf/machine/chip.conf
+++ b/conf/machine/chip.conf
@@ -21,6 +21,7 @@ KERNEL_IMAGETYPE = "zImage"
 KERNEL_DEVICETREE = "sun5i-r8-chip.dtb"
 
 SPL_BINARY = "sunxi-spl.bin"
+SPL_ECC_BINARY = "sunxi-spl-with-ecc.bin"
 UBOOT_BINARY = "u-boot-dtb.bin"
 UBOOT_MACHINE = "CHIP_defconfig"
 
diff --git a/recipes-bsp/u-boot/u-boot-chip_git.bb b/recipes-bsp/u-boot/u-boot-chip_git.bb
index 8e2be50..f12fae6 100644
--- a/recipes-bsp/u-boot/u-boot-chip_git.bb
+++ b/recipes-bsp/u-boot/u-boot-chip_git.bb
@@ -19,7 +19,13 @@ SRC_URI = " \
 S = "${WORKDIR}/git"
 
 do_compile_append() {
+    install ${B}/spl/${SPL_ECC_BINARY} ${B}/${SPL_ECC_BINARY}
     install ${B}/spl/${SPL_BINARY} ${B}/${SPL_BINARY}
 }
 
 COMPATIBLE_MACHINE = "chip"
+
+do_deploy_append() {
+    install -m 644 ${B}/${SPL_ECC_BINARY} ${DEPLOYDIR}/${SPL_ECC_BINARY}-${PV}-${PR}
+    ln -sf ${SPL_ECC_BINARY}-${PV}-${PR} ${DEPLOYDIR}/${SPL_ECC_BINARY}
+}
\ No newline at end of file
-- 
2.7.4



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

* [meta-chip][RFC PATCH 2/3] chip: Build sunxi-tools-native.
  2017-06-16 21:15 [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions drew.moseley
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 1/3] u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file drew.moseley
@ 2017-06-16 21:15 ` drew.moseley
  2017-06-19  4:30   ` Trevor Woerner
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script drew.moseley
  2017-06-22  4:16 ` [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions Petter Mabäcker
  3 siblings, 1 reply; 13+ messages in thread
From: drew.moseley @ 2017-06-16 21:15 UTC (permalink / raw)
  To: yocto

From: Drew Moseley <drew.moseley@mender.io>

Add LAYERDEPENDS on meta-sunxi and add the sunxi-tools-native
pacakage to EXTRA_IMAGEDEPENDS.

Signed-off-by: Drew Moseley <drew.moseley@mender.io>
---
 conf/layer.conf        | 3 +++
 conf/machine/chip.conf | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/conf/layer.conf b/conf/layer.conf
index 5dad66e..3324908 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -8,3 +8,6 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
 BBFILE_COLLECTIONS += "meta-chip"
 BBFILE_PATTERN_meta-chip = "^${LAYERDIR}/"
 BBFILE_PRIORITY_meta-chip = "6"
+
+# Add this to get access to sunxi-tools recipe
+LAYERDEPENDS_meta-chip = "meta-sunxi"
\ No newline at end of file
diff --git a/conf/machine/chip.conf b/conf/machine/chip.conf
index 8f54067..ae166f9 100644
--- a/conf/machine/chip.conf
+++ b/conf/machine/chip.conf
@@ -5,7 +5,7 @@
 MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
 MACHINE_ESSENTIAL_EXTRA_RDEPENDS = " kernel-image kernel-devicetree"
 
-EXTRA_IMAGEDEPENDS += "u-boot"
+EXTRA_IMAGEDEPENDS += "u-boot sunxi-tools-native"
 
 DEFAULTTUNE ?= "cortexa8t-neon"
 include conf/machine/include/tune-cortexa8.inc
-- 
2.7.4



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

* [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-16 21:15 [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions drew.moseley
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 1/3] u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file drew.moseley
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 2/3] chip: Build sunxi-tools-native drew.moseley
@ 2017-06-16 21:15 ` drew.moseley
  2017-06-19  5:19   ` Trevor Woerner
  2017-06-19  5:48   ` Trevor Woerner
  2017-06-22  4:16 ` [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions Petter Mabäcker
  3 siblings, 2 replies; 13+ messages in thread
From: drew.moseley @ 2017-06-16 21:15 UTC (permalink / raw)
  To: yocto

From: Drew Moseley <drew.moseley@mender.io>

Add a U-Boot script to handle flashing the SPL, U-Boot
and UBI root filesystem images into the onboard flash.
Also generate a script showing how to execute the flash
steps.

Signed-off-by: Drew Moseley <drew.moseley@mender.io>
---
 README                                          | 26 ++++++++-
 recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb  | 70 +++++++++++++++++++++++++
 recipes-bsp/chip-u-boot-scr/files/boot.cmd.full | 32 +++++++++++
 recipes-bsp/chip-u-boot-scr/files/boot.cmd.in   | 43 +++++++++++++++
 recipes-bsp/u-boot/u-boot-chip_git.bb           |  1 +
 5 files changed, 171 insertions(+), 1 deletion(-)
 create mode 100644 recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb
 create mode 100644 recipes-bsp/chip-u-boot-scr/files/boot.cmd.full
 create mode 100644 recipes-bsp/chip-u-boot-scr/files/boot.cmd.in

diff --git a/README b/README
index cccf59e..cf52e05 100644
--- a/README
+++ b/README
@@ -59,4 +59,28 @@ To build a machine supported by this BSP layer follow the next steps:
 II. Flashing a C.H.I.P. board
 ========================================
 
-<TODO>
+As part of the build including this BSP layer, a U-Boot script and a shell script
+are created to assist in flashing your images to the CHIP board.  Note that this
+script assumes a maximum size for your UBI image of 0x0A000000 bytes.  If your UBI
+image exceeds that, then you will need to adapt this to your environment.
+
+To successfully run this script you will first need to set your board into FEL mode.
+chip. https://docs.getchip.com/chip.html#flash-chip-with-an-os
+Insert a wire into the U14 header between pin 7 (FEL) and GND.  Then connect the
+board with a USB cable to your build system.
+
+You need to specify the base filename of your UBI image using the UBI_IMAGE shell
+variable before invoking the generated script as follows:
+
+$ UBI_IMAGE=core-image-full-cmdline-chip.ubi ./tmp/deploy/images/chip/flash_CHIP_board.sh
+
+This script will take some time to execute.  If you have a serial console connected to
+your board, you will see the progress and a message on the console will indicate when
+the flashing is completed. Additionally, once the image is properly flashed, the status
+LED on the CHIP board will flash 30 times per second indicating that it is safe to power
+down your board and disable FEL mode.
+
+WARNING: This will erase the entire contents of your CHIP board.
+
+NOTE: This setup is still compatible with the CHIP flashing utility available
+at http://flash.getchip.com if you choose to reinstall the stock images.
diff --git a/recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb b/recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb
new file mode 100644
index 0000000..726fca3
--- /dev/null
+++ b/recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb
@@ -0,0 +1,70 @@
+SUMMARY = "U-boot boot scripts for CHIP boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+COMPATIBLE_MACHINE = "chip"
+
+inherit deploy
+
+DEPENDS = "u-boot-mkimage-native"
+
+SRC_URI = "file://boot.cmd.in"
+
+NAND_FLASH_START_ADDR = "0x00000000"
+SPL_MEMIMG_ADDR = "0x44000000"
+UBOOT_MEMIMG_ADDR = "0x4a000000"
+SPL_FLASH_UPPER_ADDR = "0x400000"
+LED_I2C_CHIP = "0x34"
+LED_I2C_ADDR = "0x93"
+UBOOT_FLASH_ADDR = "0x800000"
+UBI_MEMIMG_ADDR = "0x4b000000"
+UBI_FLASH_ADDR = "0x1000000"
+PAGE_SIZE = "16384"
+OOB_SIZE = "1664"
+SCRIPTADDR = "0x43100000"
+
+do_compile[depends] += "u-boot-chip:do_deploy"
+do_compile() {
+    PADDED_SPL_SIZE_BLOCKS=$(stat --dereference --printf="%s" "${DEPLOY_DIR_IMAGE}/${SPL_ECC_BINARY}")
+    PADDED_SPL_SIZE_BLOCKS=$(expr $PADDED_SPL_SIZE_BLOCKS / \( ${PAGE_SIZE} + ${OOB_SIZE} \))
+    PADDED_SPL_SIZE_BLOCKS=$(echo $PADDED_SPL_SIZE_BLOCKS | xargs printf "0x%08x")
+    PADDED_UBOOT_SIZE=$(stat --dereference  --printf="%s" "${DEPLOY_DIR_IMAGE}/${UBOOT_BINARY}" | xargs printf "0x%08x")
+    UBI_SIZE="0x0A000000"
+
+    sed -e "s,@NAND_FLASH_START_ADDR@,${NAND_FLASH_START_ADDR},g" \
+        -e "s,@SPL_MEMIMG_ADDR@,${SPL_MEMIMG_ADDR},g" \
+        -e "s,@UBOOT_MEMIMG_ADDR@,${UBOOT_MEMIMG_ADDR},g" \
+        -e "s,@SPL_FLASH_UPPER_ADDR@,${SPL_FLASH_UPPER_ADDR},g" \
+        -e "s,@LED_I2C_CHIP@,${LED_I2C_CHIP},g" \
+        -e "s,@LED_I2C_ADDR@,${LED_I2C_ADDR},g" \
+        -e "s,@PADDED_SPL_SIZE_BLOCKS@,${PADDED_SPL_SIZE_BLOCKS},g" \
+        -e "s,@PADDED_UBOOT_SIZE@,${PADDED_UBOOT_SIZE},g" \
+        -e "s,@UBOOT_FLASH_ADDR@,${UBOOT_FLASH_ADDR},g" \
+        -e "s,@UBI_FLASH_ADDR@,${UBI_FLASH_ADDR},g" \
+        -e "s,@UBI_MEMIMG_ADDR@,${UBI_MEMIMG_ADDR},g" \
+        -e "s,@UBI_SIZE@,${UBI_SIZE},g" \
+        < "${WORKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd"
+    mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" "${WORKDIR}/boot.scr"
+}
+
+do_deploy() {
+    install -d ${DEPLOYDIR}
+    install -m 0644 ${WORKDIR}/boot.scr ${DEPLOYDIR}/boot.scr-${PV}-${PR}
+    ln -sf boot.scr-${PV}-${PR} ${DEPLOYDIR}/boot.scr
+
+    cat > ${DEPLOYDIR}/flash_CHIP_board.sh-${PV}-${PR} <<-EOF
+	#!/bin/sh
+	#
+	
+	${COMPONENTS_DIR}/x86_64/sunxi-tools-native/usr/bin/sunxi-fel spl ${DEPLOY_DIR_IMAGE}/${SPL_BINARY}
+	${COMPONENTS_DIR}/x86_64/sunxi-tools-native/usr/bin/sunxi-fel --progress write ${SPL_MEMIMG_ADDR} ${DEPLOY_DIR_IMAGE}/${SPL_ECC_BINARY}
+	${COMPONENTS_DIR}/x86_64/sunxi-tools-native/usr/bin/sunxi-fel --progress write ${UBOOT_MEMIMG_ADDR} ${DEPLOY_DIR_IMAGE}/${UBOOT_BINARY}
+	${COMPONENTS_DIR}/x86_64/sunxi-tools-native/usr/bin/sunxi-fel --progress write ${SCRIPTADDR} ${DEPLOY_DIR_IMAGE}/boot.scr
+	${COMPONENTS_DIR}/x86_64/sunxi-tools-native/usr/bin/sunxi-fel --progress write ${UBI_MEMIMG_ADDR} ${DEPLOY_DIR_IMAGE}/\${UBI_IMAGE}
+	${COMPONENTS_DIR}/x86_64/sunxi-tools-native/usr/bin/sunxi-fel exe ${UBOOT_MEMIMG_ADDR}
+	EOF
+    chmod +x ${DEPLOYDIR}/flash_CHIP_board.sh-${PV}-${PR}
+
+    ln -sf flash_CHIP_board.sh-${PV}-${PR} ${DEPLOYDIR}/flash_CHIP_board.sh
+}
+
+addtask do_deploy after do_compile before do_build
diff --git a/recipes-bsp/chip-u-boot-scr/files/boot.cmd.full b/recipes-bsp/chip-u-boot-scr/files/boot.cmd.full
new file mode 100644
index 0000000..9589c87
--- /dev/null
+++ b/recipes-bsp/chip-u-boot-scr/files/boot.cmd.full
@@ -0,0 +1,32 @@
+echo Scrubbing NAND
+nand scrub -y 0x0 0x200000000
+echo Writing SPL (with ECC) to NAND address 0x0
+nand write.raw.noverify $SPL_MEM_ADDR 0x0 $PADDED_SPL_SIZE
+echo Writing SPL (with ECC) to NAND address 0x400000
+nand write.raw.noverify $SPL_MEM_ADDR 0x400000 $PADDED_SPL_SIZE
+echo Writing UBoot image to address 0x800000
+nand write $UBOOT_MEM_ADDR 0x800000 $PADDED_UBOOT_SIZE
+
+# Setup the default environment
+setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4
+setenv bootcmd 'mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'
+setenv fel_booted 0
+
+echo Enabling Splash
+setenv stdout serial
+setenv stderr serial
+setenv splashpos m,m
+
+echo Setting Video Mode
+setenv video-mode sunxi:640x480-24@60,monitor=composite-ntsc,overscan_x=40,overscan_y=20
+
+echo Saving default environment
+saveenv
+
+echo Writing UBI rootfs to NAND address 0x1000000
+nand write.slc-mode.trimffs $UBI_MEM_ADDR 0x1000000 $UBI_SIZE
+
+echo ===========================================================
+echo Flashing Complete.  Please power down and disable FEL mode.
+echo ===========================================================
+
diff --git a/recipes-bsp/chip-u-boot-scr/files/boot.cmd.in b/recipes-bsp/chip-u-boot-scr/files/boot.cmd.in
new file mode 100644
index 0000000..dc060be
--- /dev/null
+++ b/recipes-bsp/chip-u-boot-scr/files/boot.cmd.in
@@ -0,0 +1,43 @@
+echo Erasing NAND
+nand erase.chip
+echo Writing SPL (with ECC) to NAND address @NAND_FLASH_START_ADDR@
+nand write.raw.noverify @SPL_MEMIMG_ADDR@ @NAND_FLASH_START_ADDR@ @PADDED_SPL_SIZE_BLOCKS@
+echo Writing SPL (with ECC) to NAND address @SPL_FLASH_UPPER_ADDR@
+nand write.raw.noverify @SPL_MEMIMG_ADDR@ @SPL_FLASH_UPPER_ADDR@ @PADDED_SPL_SIZE_BLOCKS@
+echo Writing UBoot image to address 0x800000
+nand write @UBOOT_MEMIMG_ADDR@ @UBOOT_FLASH_ADDR@ @PADDED_UBOOT_SIZE@
+
+# Setup the default environment
+setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4
+setenv bootcmd_ubi 'mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'
+setenv boot_targets fel ubi usb0 pxe dhcp 
+setenv fel_booted 0
+
+echo Enabling Splash
+setenv stdout serial
+setenv stderr serial
+setenv splashpos m,m
+
+echo Setting Video Mode
+setenv video-mode sunxi:640x480-24@60,monitor=composite-ntsc,overscan_x=40,overscan_y=20
+
+echo Saving default environment
+saveenv
+
+echo Writing UBI rootfs to NAND address 0x1000000
+nand write.slc-mode.trimffs @UBI_MEMIMG_ADDR@ @UBI_FLASH_ADDR@ @UBI_SIZE@
+
+
+echo ===========================================================
+echo Flashing Complete.  Please power down and disable FEL mode.
+echo ===========================================================
+
+# Loop continually flashing the status LED
+while true ; do
+    mw.l @SPL_MEMIMG_ADDR@ 0x00000000 1
+    i2c write @SPL_MEMIMG_ADDR@ @LED_I2C_CHIP@ @LED_I2C_ADDR@ 4
+    sleep 1
+    mw.l @SPL_MEMIMG_ADDR@ 0xffffffff 1
+    i2c write @SPL_MEMIMG_ADDR@ @LED_I2C_CHIP@ @LED_I2C_ADDR@ 4
+    sleep 1
+done
diff --git a/recipes-bsp/u-boot/u-boot-chip_git.bb b/recipes-bsp/u-boot/u-boot-chip_git.bb
index f12fae6..008f346 100644
--- a/recipes-bsp/u-boot/u-boot-chip_git.bb
+++ b/recipes-bsp/u-boot/u-boot-chip_git.bb
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=0507cd7da8e7ad6d6701926ec9b84c95"
 
 DEPENDS += "dtc-native"
 PROVIDES += "u-boot"
+RDEPENDS_${PN}_append_chip = " chip-u-boot-scr"
 
 UBOOT_VERSION ?= "2016.01"
 PV = "${UBOOT_VERSION}+git${SRCPV}"
-- 
2.7.4



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

* Re: [meta-chip][RFC PATCH 2/3] chip: Build sunxi-tools-native.
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 2/3] chip: Build sunxi-tools-native drew.moseley
@ 2017-06-19  4:30   ` Trevor Woerner
  0 siblings, 0 replies; 13+ messages in thread
From: Trevor Woerner @ 2017-06-19  4:30 UTC (permalink / raw)
  To: drew.moseley; +Cc: yocto

On Fri, Jun 16, 2017 at 5:15 PM,  <drew.moseley@mender.io> wrote:
> Add LAYERDEPENDS on meta-sunxi and add the sunxi-tools-native
> pacakage to EXTRA_IMAGEDEPENDS.


meta-chip's README should also indicate this dependency.


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

* Re: [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script drew.moseley
@ 2017-06-19  5:19   ` Trevor Woerner
  2017-06-19  5:48   ` Trevor Woerner
  1 sibling, 0 replies; 13+ messages in thread
From: Trevor Woerner @ 2017-06-19  5:19 UTC (permalink / raw)
  To: drew.moseley; +Cc: yocto

On Fri 2017-06-16 @ 05:15:40 PM, drew.moseley@mender.io wrote:
> diff --git a/README b/README
> index cccf59e..cf52e05 100644
> --- a/README
> +++ b/README
> @@ -59,4 +59,28 @@ To build a machine supported by this BSP layer follow the next steps:

Please wrap the additions to the README to 80 columns.

>  II. Flashing a C.H.I.P. board
>  ========================================
>  
> -<TODO>
> +As part of the build including this BSP layer, a U-Boot script and a shell script
> +are created to assist in flashing your images to the CHIP board.  Note that this
> +script assumes a maximum size for your UBI image of 0x0A000000 bytes.  If your UBI
> +image exceeds that, then you will need to adapt this to your environment.
> +
> +To successfully run this script you will first need to set your board into FEL mode.
> +chip. https://docs.getchip.com/chip.html#flash-chip-with-an-os
> +Insert a wire into the U14 header between pin 7 (FEL) and GND.  Then connect the
> +board with a USB cable to your build system.
> +
> +You need to specify the base filename of your UBI image using the UBI_IMAGE shell
> +variable before invoking the generated script as follows:
> +
> +$ UBI_IMAGE=core-image-full-cmdline-chip.ubi ./tmp/deploy/images/chip/flash_CHIP_board.sh

Outside of a udev tweak, this script needs to be run as root. It's traditional
to indicate commands run as root by prefixing them with a PS1 of '#'.

> +
> +This script will take some time to execute.  If you have a serial console connected to
> +your board, you will see the progress and a message on the console will indicate when
> +the flashing is completed. Additionally, once the image is properly flashed, the status
> +LED on the CHIP board will flash 30 times per second indicating that it is safe to power
> +down your board and disable FEL mode.
> +
> +WARNING: This will erase the entire contents of your CHIP board.
> +
> +NOTE: This setup is still compatible with the CHIP flashing utility available
> +at http://flash.getchip.com if you choose to reinstall the stock images.


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

* Re: [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script drew.moseley
  2017-06-19  5:19   ` Trevor Woerner
@ 2017-06-19  5:48   ` Trevor Woerner
  2017-06-19  7:33     ` Trevor Woerner
  2017-06-19 11:22     ` Drew Moseley
  1 sibling, 2 replies; 13+ messages in thread
From: Trevor Woerner @ 2017-06-19  5:48 UTC (permalink / raw)
  To: drew.moseley; +Cc: yocto

On Fri 2017-06-16 @ 05:15:40 PM, drew.moseley@mender.io wrote:
> +This script will take some time to execute.

true

> If you have a serial console connected to
> +your board, you will see the progress and a message on the console will indicate when
> +the flashing is completed.

hmmm, never saw this. I have a console connected, the moment the script
started, on the console I got:

	U-Boot SPL 2016.01 (Jun 19 2017 - 00:32:19)
	DRAM: 512 MiB
	CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
	Trying to boot from

which looks right, the date+time are good.

Where I started the script I get:

	# UBI_IMAGE=core-image-full-cmdline-chip.ubi
	# tmp-glibc/deploy/images/chip/flash_CHIP_board.sh
	100% [================================================]  3537 kB,  557.5 kB/s 
	100% [================================================]   616 kB,  823.9 kB/s 
	100% [================================================]     2 kB,  733.9 kB/s
	100% [================================================] 654311 kB,  771.4 kB/s

> Additionally, once the image is properly flashed, the status
> +LED on the CHIP board will flash 30 times per second indicating that it is safe to power
> +down your board and disable FEL mode.

I don't get any LED flashing, and nothing other than what I've pasted above on
the console.

Rebooting the board after flashing outside of FEL mode simply boots the
previous u-boot and image.

Any thoughts?


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

* Re: [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-19  5:48   ` Trevor Woerner
@ 2017-06-19  7:33     ` Trevor Woerner
  2017-06-19 11:22     ` Drew Moseley
  1 sibling, 0 replies; 13+ messages in thread
From: Trevor Woerner @ 2017-06-19  7:33 UTC (permalink / raw)
  To: drew.moseley; +Cc: yocto

On Mon, Jun 19, 2017 at 1:48 AM, Trevor Woerner <twoerner@gmail.com> wrote:
> On Fri 2017-06-16 @ 05:15:40 PM, drew.moseley@mender.io wrote:
> Any thoughts?

It appears my image was too large. Using a smaller image appears to
work as expected!


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

* Re: [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-19  5:48   ` Trevor Woerner
  2017-06-19  7:33     ` Trevor Woerner
@ 2017-06-19 11:22     ` Drew Moseley
  2017-06-19 14:40       ` Trevor Woerner
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Moseley @ 2017-06-19 11:22 UTC (permalink / raw)
  To: Trevor Woerner; +Cc: yocto


> On Jun 19, 2017, at 1:48 AM, Trevor Woerner <twoerner@gmail.com> wrote:
> 
>> If you have a serial console connected to
>> +your board, you will see the progress and a message on the console will indicate when
>> +the flashing is completed.
> 
> hmmm, never saw this. I have a console connected, the moment the script
> started, on the console I got:
> 
> 	U-Boot SPL 2016.01 (Jun 19 2017 - 00:32:19)
> 	DRAM: 512 MiB
> 	CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
> 	Trying to boot from
> 
> which looks right, the date+time are good.

Did you see the proper serial output after using a smaller image?

Drew

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

* Re: [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-19 11:22     ` Drew Moseley
@ 2017-06-19 14:40       ` Trevor Woerner
  2017-06-22  4:22         ` Petter Mabäcker
  0 siblings, 1 reply; 13+ messages in thread
From: Trevor Woerner @ 2017-06-19 14:40 UTC (permalink / raw)
  To: Drew Moseley; +Cc: yocto

On Mon, Jun 19, 2017 at 7:22 AM, Drew Moseley <drew.moseley@mender.io> wrote:
>
>> On Jun 19, 2017, at 1:48 AM, Trevor Woerner <twoerner@gmail.com> wrote:
>>
>>> If you have a serial console connected to
>>> +your board, you will see the progress and a message on the console will indicate when
>>> +the flashing is completed.
>>
>> hmmm, never saw this. I have a console connected, the moment the script
>> started, on the console I got:
>>
>>       U-Boot SPL 2016.01 (Jun 19 2017 - 00:32:19)
>>       DRAM: 512 MiB
>>       CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
>>       Trying to boot from
>>
>> which looks right, the date+time are good.
>
> Did you see the proper serial output after using a smaller image?

Yes. With a smaller image (~90MB) the flash update worked. Maybe
another improvement for a v2 would be for the script to look at the
size of /full/path/to/UBI_IMAGE and issue a warning/error if it's too
big?

I think the wording of what to expect on the host and over the serial
console could use some updating. Not to mention you say: "the status
LED on the CHIP board will flash 30 times per second..." which doesn't
seem to be the case, it looks more like the LED is toggled every 2
seconds (??), in any case, it's a lot slower than 30/sec.


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

* Re: [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions.
  2017-06-16 21:15 [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions drew.moseley
                   ` (2 preceding siblings ...)
  2017-06-16 21:15 ` [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script drew.moseley
@ 2017-06-22  4:16 ` Petter Mabäcker
  3 siblings, 0 replies; 13+ messages in thread
From: Petter Mabäcker @ 2017-06-22  4:16 UTC (permalink / raw)
  To: yocto, drew.moseley, Andrei Gherzan

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

 

2017-06-16 23:15 skrev drew.moseley@mender.io: 

> From: Drew
Moseley <drew.moseley@mender.io>
> 
> This set of patches adds the
native tools and target components needed to
> reflash the CHIP boards.
Additionally a shell script is added to the deploy
> directory showing
how to kick off a flash update. It's not ideal as I've
> hardcoded a max
size for the UBI image into the script and didn't see much
> of an
alternative. It does function though.
> 
> Drew
> 
> The following
changes since commit 0079e6ac10fc371d6f527270c23b887561f717aa:
> 
>
chip: Append to MACHINE_EXTRA_RRECOMMENDS rather than overwriting
(2017-06-15 13:37:19 +0100)
> 
> are available in the git repository
at:
> 
> git@github.com:drewmoseley/meta-chip.git
flashing-instructions
> 
> for you to fetch changes up to
195a92fc1faa49495d1a2b6cda0134f07ce72189:
> 
> chip: Add chip-u-boot-scr
recipe and flash script (2017-06-15 11:27:06 -0400)
> 
>
----------------------------------------------------------------
> Drew
Moseley (3):
> u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file.
>
chip: Build sunxi-tools-native.
> chip: Add chip-u-boot-scr recipe and
flash script
> 
> README | 26 ++++++++-
> conf/layer.conf | 3 ++
>
conf/machine/chip.conf | 3 +-
>
recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb | 70
+++++++++++++++++++++++++
>
recipes-bsp/chip-u-boot-scr/files/boot.cmd.full | 32 +++++++++++
>
recipes-bsp/chip-u-boot-scr/files/boot.cmd.in | 43 +++++++++++++++
>
recipes-bsp/u-boot/u-boot-chip_git.bb | 7 +++
> 7 files changed, 182
insertions(+), 2 deletions(-)
> create mode 100644
recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb
> create mode 100644
recipes-bsp/chip-u-boot-scr/files/boot.cmd.full
> create mode 100644
recipes-bsp/chip-u-boot-scr/files/boot.cmd.in
> 
> Drew Moseley (3):
>
u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file.
> chip: Build
sunxi-tools-native.
> chip: Add chip-u-boot-scr recipe and flash
script
> 
> README | 26 ++++++++-
> conf/layer.conf | 3 ++
>
conf/machine/chip.conf | 3 +-
>
recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb | 70
+++++++++++++++++++++++++
>
recipes-bsp/chip-u-boot-scr/files/boot.cmd.full | 32 +++++++++++
>
recipes-bsp/chip-u-boot-scr/files/boot.cmd.in | 43 +++++++++++++++
>
recipes-bsp/u-boot/u-boot-chip_git.bb | 7 +++
> 7 files changed, 182
insertions(+), 2 deletions(-)
> create mode 100644
recipes-bsp/chip-u-boot-scr/chip-u-boot-scr.bb
> create mode 100644
recipes-bsp/chip-u-boot-scr/files/boot.cmd.full
> create mode 100644
recipes-bsp/chip-u-boot-scr/files/boot.cmd.in
> 
> -- 
> 2.7.4

Hi Drew,


First of all, great work. The flashing mechanism have been sort of a
headache for many. Even if like you say there are some limitations etc
with this proposal, it works and it's easy to use. Also since no other
major concern have been provided by other reviewers, I think you should
fix the comments received and then send it as non-RFC patch. Also check
with Andrei if he want to have this as a PR in github as well. 

BR
Petter 

Petter Mabäcker

Technux <petter@technux.se>
www.technux.se
 

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

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

* Re: [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-19 14:40       ` Trevor Woerner
@ 2017-06-22  4:22         ` Petter Mabäcker
  2017-06-22 12:16           ` Drew Moseley
  0 siblings, 1 reply; 13+ messages in thread
From: Petter Mabäcker @ 2017-06-22  4:22 UTC (permalink / raw)
  To: yocto, Drew moseley

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

 

2017-06-19 16:40 skrev Trevor Woerner: 

> On Mon, Jun 19, 2017 at
7:22 AM, Drew Moseley <drew.moseley@mender.io> wrote:
> 
>>> On Jun 19,
2017, at 1:48 AM, Trevor Woerner <twoerner@gmail.com> wrote: 
>>> 
>>>>
If you have a serial console connected to +your board, you will see the
progress and a message on the console will indicate when +the flashing
is completed.
>>> hmmm, never saw this. I have a console connected, the
moment the script started, on the console I got: U-Boot SPL 2016.01 (Jun
19 2017 - 00:32:19) DRAM: 512 MiB CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from which looks right, the date+time are good.
>> Did
you see the proper serial output after using a smaller image?
> 
> Yes.
With a smaller image (~90MB) the flash update worked. Maybe
> another
improvement for a v2 would be for the script to look at the
> size of
/full/path/to/UBI_IMAGE and issue a warning/error if it's too
> big?
>

> I think the wording of what to expect on the host and over the
serial
> console could use some updating. Not to mention you say: "the
status
> LED on the CHIP board will flash 30 times per second..." which
doesn't
> seem to be the case, it looks more like the LED is toggled
every 2
> seconds (??), in any case, it's a lot slower than 30/sec.

I
also had the same experience as Trevor, that the led seems to flash
every 2 seconds. Also the code indicate that 2 x 1 sec sleep is used in
this area, so please go through the above description when it comes to
led experience during flashing. Another minor comment is that I believe
you should update the UBI_IMAGE example in README to use the "default"
meta-chip hwup image (chip-hwup-image-chip.ubi). 

BR Petter 

Petter
Mabäcker

Technux <petter@technux.se>
www.technux.se
 

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

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

* Re: [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script
  2017-06-22  4:22         ` Petter Mabäcker
@ 2017-06-22 12:16           ` Drew Moseley
  0 siblings, 0 replies; 13+ messages in thread
From: Drew Moseley @ 2017-06-22 12:16 UTC (permalink / raw)
  To: petter; +Cc: yocto

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


> On Jun 22, 2017, at 12:22 AM, Petter Mabäcker <petter@technux.se> wrote:
> 
> 2017-06-19 16:40 skrev Trevor Woerner:
> 
>> On Mon, Jun 19, 2017 at 7:22 AM, Drew Moseley <drew.moseley@mender.io <mailto:drew.moseley@mender.io>> wrote:
>>>> On Jun 19, 2017, at 1:48 AM, Trevor Woerner <twoerner@gmail.com <mailto:twoerner@gmail.com>> wrote:
>>>>> 
>>>>> If you have a serial console connected to +your board, you will see the progress and a message on the console will indicate when +the flashing is completed.
>>>> hmmm, never saw this. I have a console connected, the moment the script started, on the console I got: U-Boot SPL 2016.01 (Jun 19 2017 - 00:32:19) DRAM: 512 MiB CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2 Trying to boot from which looks right, the date+time are good.
>>> Did you see the proper serial output after using a smaller image?
>> Yes. With a smaller image (~90MB) the flash update worked. Maybe
>> another improvement for a v2 would be for the script to look at the
>> size of /full/path/to/UBI_IMAGE and issue a warning/error if it's too
>> big?
>> 
>> I think the wording of what to expect on the host and over the serial
>> console could use some updating. Not to mention you say: "the status
>> LED on the CHIP board will flash 30 times per second..." which doesn't
>> seem to be the case, it looks more like the LED is toggled every 2
>> seconds (??), in any case, it's a lot slower than 30/sec.
> I also had the same experience as Trevor, that the led seems to flash every 2 seconds. Also the code indicate that 2 x 1 sec sleep is used in this area, so please go through the above description when it comes to led experience during flashing. Another minor comment is that I believe you should update the UBI_IMAGE example in README to use the "default" meta-chip hwup image (chip-hwup-image-chip.ubi).
> 
> BR Petter
> 
> Petter Mabäcker
> 
> Technux <petter@technux.se>
> www.technux.se

Indeed.  The comment was intended to say that it flashes 30/min.  Obviously flashing 30/sec would not be a very easy thing for people to spot.

I’ll work through the comments and submit V2.  It will take me a few days.

Many thanks for the feedback.

Drew


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

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

end of thread, other threads:[~2017-06-22 12:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16 21:15 [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions drew.moseley
2017-06-16 21:15 ` [meta-chip][RFC PATCH 1/3] u-boot-chip: Deploy the sunxi-spl-with-ecc.bin file drew.moseley
2017-06-16 21:15 ` [meta-chip][RFC PATCH 2/3] chip: Build sunxi-tools-native drew.moseley
2017-06-19  4:30   ` Trevor Woerner
2017-06-16 21:15 ` [meta-chip][RFC PATCH 3/3] chip: Add chip-u-boot-scr recipe and flash script drew.moseley
2017-06-19  5:19   ` Trevor Woerner
2017-06-19  5:48   ` Trevor Woerner
2017-06-19  7:33     ` Trevor Woerner
2017-06-19 11:22     ` Drew Moseley
2017-06-19 14:40       ` Trevor Woerner
2017-06-22  4:22         ` Petter Mabäcker
2017-06-22 12:16           ` Drew Moseley
2017-06-22  4:16 ` [meta-chip][RFC PATCH 0/3] Initial attempt at flashing instructions Petter Mabäcker

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.