From 175b923f41b2956cd1170f5e5bfe45589e5349e5 Mon Sep 17 00:00:00 2001 From: Shaun Mulligan Date: Thu, 27 Jul 2017 18:27:47 +0200 Subject: [PATCH] implement flasher type --- .../u-boot/u-boot_2017.07/boot.cmd | 5 +- .../images/resin-image-flasher.bbappend | 1 + .../recipes-core/images/resin-image.bbappend | 78 +------------------ .../recipes-core/images/resin-image.inc | 77 ++++++++++++++++++ .../resin-init/resin-init-flasher.bbappend | 2 + nanopi-neo-air.coffee | 2 +- 6 files changed, 84 insertions(+), 81 deletions(-) create mode 100644 layers/meta-resin-allwinner/recipes-core/images/resin-image-flasher.bbappend create mode 100644 layers/meta-resin-allwinner/recipes-core/images/resin-image.inc create mode 100644 layers/meta-resin-allwinner/recipes-support/resin-init/resin-init-flasher.bbappend diff --git a/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_2017.07/boot.cmd b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_2017.07/boot.cmd index 10b0c8a..baec7ef 100644 --- a/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_2017.07/boot.cmd +++ b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_2017.07/boot.cmd @@ -6,7 +6,6 @@ setenv load_addr "0x44000000" setenv overlay_error "false" # default values -setenv rootdev "/dev/mmcblk0p2" setenv verbosity "1" setenv console "both" setenv disp_mem_reserves "off" @@ -15,8 +14,8 @@ setenv rootfstype "ext4" setenv docker_optimizations "on" # Print boot source -itest.b *0x28 == 0x00 && echo "U-boot loaded from SD" -itest.b *0x28 == 0x02 && echo "U-boot loaded from eMMC or secondary SD" +itest.b *0x28 == 0x00 && echo "U-boot loaded from SD" && setenv rootdev "/dev/mmcblk0p2" +itest.b *0x28 == 0x02 && echo "U-boot loaded from eMMC or secondary SD" && setenv rootdev "/dev/mmcblk2p2" itest.b *0x28 == 0x03 && echo "U-boot loaded from SPI" echo "Boot script loaded from ${devtype}" diff --git a/layers/meta-resin-allwinner/recipes-core/images/resin-image-flasher.bbappend b/layers/meta-resin-allwinner/recipes-core/images/resin-image-flasher.bbappend new file mode 100644 index 0000000..a4568ed --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-core/images/resin-image-flasher.bbappend @@ -0,0 +1 @@ +include resin-image.inc \ No newline at end of file diff --git a/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend b/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend index 2829d6a..a4568ed 100644 --- a/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend +++ b/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend @@ -1,77 +1 @@ -# -# orange-pi-lite -# - -IMAGE_FSTYPES_append_orange-pi-lite = " resinos-img" - -# Customize resinos-img -RESIN_IMAGE_BOOTLOADER_orange-pi-lite = "u-boot" -RESIN_BOOT_PARTITION_FILES_orange-pi-lite = " \ - ${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \ - uImage-sun8i-h3-orangepi-lite.dtb:/dtb/sun8i-h3-orangepi-lite.dtb \ - uImage-sun8i-h3-fixup.scr:/dtb/overlay/sun8i-h3-fixup.scr \ - uImage-sun8i-h3-analog-codec.dtbo:/dtb/overlay/sun8i-h3-analog-codec.dtbo \ - uImage-sun8i-h3-cir.dtbo:/dtb/overlay/sun8i-h3-cir.dtbo \ - uImage-sun8i-h3-i2c0.dtbo:/dtb/overlay/sun8i-h3-i2c0.dtbo \ - uImage-sun8i-h3-i2c1.dtbo:/dtb/overlay/sun8i-h3-i2c1.dtbo \ - uImage-sun8i-h3-i2c2.dtbo:/dtb/overlay/sun8i-h3-i2c2.dtbo \ - uImage-sun8i-h3-pps-gpio.dtbo:/dtb/overlay/sun8i-h3-pps-gpio.dtbo \ - uImage-sun8i-h3-pwm.dtbo:/dtb/overlay/sun8i-h3-pwm.dtbo \ - uImage-sun8i-h3-spdif-out.dtbo:/dtb/overlay/sun8i-h3-spdif-out.dtbo \ - uImage-sun8i-h3-spi-add-cs1.dtbo:/dtb/overlay/sun8i-h3-spi-add-cs1.dtbo \ - uImage-sun8i-h3-spi-jedec-nor.dtbo:/dtb/overlay/sun8i-h3-spi-jedec-nor.dtbo \ - uImage-sun8i-h3-spi-spidev.dtbo:/dtb/overlay/sun8i-h3-spi-spidev.dtbo \ - uImage-sun8i-h3-uart1.dtbo:/dtb/overlay/sun8i-h3-uart1.dtbo \ - uImage-sun8i-h3-uart2.dtbo:/dtb/overlay/sun8i-h3-uart2.dtbo \ - uImage-sun8i-h3-uart3.dtbo:/dtb/overlay/sun8i-h3-uart3.dtbo \ - uImage-sun8i-h3-usbhost0.dtbo:/dtb/overlay/sun8i-h3-usbhost0.dtbo \ - uImage-sun8i-h3-usbhost2.dtbo:/dtb/overlay/sun8i-h3-usbhost1.dtbo \ - uImage-sun8i-h3-usbhost3.dtbo:/dtb/overlay/sun8i-h3-usbhost2.dtbo \ - uImage-sun8i-h3-w1-gpio.dtbo:/dtb/overlay/sun8i-h3-w1-gpio.dtbo \ - boot.scr:/boot.scr \ - armbianEnv.txt:/ \ - " - -IMAGE_CMD_resinos-img_append_orange-pi-lite () { - # orange-pi-lite needs uboot written at a specific location - dd if=${DEPLOY_DIR_IMAGE}/u-boot-sunxi-with-spl.bin of=${RESIN_RAW_IMG} conv=notrunc seek=8 bs=1024 -} - -# -# nanopi-neo-air -# - -IMAGE_FSTYPES_append_nanopi-neo-air = " resinos-img" - -# Customize resinos-img -RESIN_IMAGE_BOOTLOADER_nanopi-neo-air = "u-boot" -RESIN_BOOT_PARTITION_FILES_nanopi-neo-air = " \ - ${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \ - uImage-sun8i-h3-nanopi-neo-air.dtb:/dtb/sun8i-h3-nanopi-neo-air.dtb \ - uImage-sun8i-h3-fixup.scr:/dtb/overlay/sun8i-h3-fixup.scr \ - uImage-sun8i-h3-analog-codec.dtbo:/dtb/overlay/sun8i-h3-analog-codec.dtbo \ - uImage-sun8i-h3-cir.dtbo:/dtb/overlay/sun8i-h3-cir.dtbo \ - uImage-sun8i-h3-i2c0.dtbo:/dtb/overlay/sun8i-h3-i2c0.dtbo \ - uImage-sun8i-h3-i2c1.dtbo:/dtb/overlay/sun8i-h3-i2c1.dtbo \ - uImage-sun8i-h3-i2c2.dtbo:/dtb/overlay/sun8i-h3-i2c2.dtbo \ - uImage-sun8i-h3-pps-gpio.dtbo:/dtb/overlay/sun8i-h3-pps-gpio.dtbo \ - uImage-sun8i-h3-pwm.dtbo:/dtb/overlay/sun8i-h3-pwm.dtbo \ - uImage-sun8i-h3-spdif-out.dtbo:/dtb/overlay/sun8i-h3-spdif-out.dtbo \ - uImage-sun8i-h3-spi-add-cs1.dtbo:/dtb/overlay/sun8i-h3-spi-add-cs1.dtbo \ - uImage-sun8i-h3-spi-jedec-nor.dtbo:/dtb/overlay/sun8i-h3-spi-jedec-nor.dtbo \ - uImage-sun8i-h3-spi-spidev.dtbo:/dtb/overlay/sun8i-h3-spi-spidev.dtbo \ - uImage-sun8i-h3-uart1.dtbo:/dtb/overlay/sun8i-h3-uart1.dtbo \ - uImage-sun8i-h3-uart2.dtbo:/dtb/overlay/sun8i-h3-uart2.dtbo \ - uImage-sun8i-h3-uart3.dtbo:/dtb/overlay/sun8i-h3-uart3.dtbo \ - uImage-sun8i-h3-usbhost0.dtbo:/dtb/overlay/sun8i-h3-usbhost0.dtbo \ - uImage-sun8i-h3-usbhost2.dtbo:/dtb/overlay/sun8i-h3-usbhost1.dtbo \ - uImage-sun8i-h3-usbhost3.dtbo:/dtb/overlay/sun8i-h3-usbhost2.dtbo \ - uImage-sun8i-h3-w1-gpio.dtbo:/dtb/overlay/sun8i-h3-w1-gpio.dtbo \ - boot.scr:/boot.scr \ - armbianEnv.txt:/ \ - " - -IMAGE_CMD_resinos-img_append_nanopi-neo-air () { - # nanopi-neo-air needs uboot written at a specific location - dd if=${DEPLOY_DIR_IMAGE}/u-boot-sunxi-with-spl.bin of=${RESIN_RAW_IMG} conv=notrunc seek=8 bs=1024 -} +include resin-image.inc \ No newline at end of file diff --git a/layers/meta-resin-allwinner/recipes-core/images/resin-image.inc b/layers/meta-resin-allwinner/recipes-core/images/resin-image.inc new file mode 100644 index 0000000..2829d6a --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-core/images/resin-image.inc @@ -0,0 +1,77 @@ +# +# orange-pi-lite +# + +IMAGE_FSTYPES_append_orange-pi-lite = " resinos-img" + +# Customize resinos-img +RESIN_IMAGE_BOOTLOADER_orange-pi-lite = "u-boot" +RESIN_BOOT_PARTITION_FILES_orange-pi-lite = " \ + ${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \ + uImage-sun8i-h3-orangepi-lite.dtb:/dtb/sun8i-h3-orangepi-lite.dtb \ + uImage-sun8i-h3-fixup.scr:/dtb/overlay/sun8i-h3-fixup.scr \ + uImage-sun8i-h3-analog-codec.dtbo:/dtb/overlay/sun8i-h3-analog-codec.dtbo \ + uImage-sun8i-h3-cir.dtbo:/dtb/overlay/sun8i-h3-cir.dtbo \ + uImage-sun8i-h3-i2c0.dtbo:/dtb/overlay/sun8i-h3-i2c0.dtbo \ + uImage-sun8i-h3-i2c1.dtbo:/dtb/overlay/sun8i-h3-i2c1.dtbo \ + uImage-sun8i-h3-i2c2.dtbo:/dtb/overlay/sun8i-h3-i2c2.dtbo \ + uImage-sun8i-h3-pps-gpio.dtbo:/dtb/overlay/sun8i-h3-pps-gpio.dtbo \ + uImage-sun8i-h3-pwm.dtbo:/dtb/overlay/sun8i-h3-pwm.dtbo \ + uImage-sun8i-h3-spdif-out.dtbo:/dtb/overlay/sun8i-h3-spdif-out.dtbo \ + uImage-sun8i-h3-spi-add-cs1.dtbo:/dtb/overlay/sun8i-h3-spi-add-cs1.dtbo \ + uImage-sun8i-h3-spi-jedec-nor.dtbo:/dtb/overlay/sun8i-h3-spi-jedec-nor.dtbo \ + uImage-sun8i-h3-spi-spidev.dtbo:/dtb/overlay/sun8i-h3-spi-spidev.dtbo \ + uImage-sun8i-h3-uart1.dtbo:/dtb/overlay/sun8i-h3-uart1.dtbo \ + uImage-sun8i-h3-uart2.dtbo:/dtb/overlay/sun8i-h3-uart2.dtbo \ + uImage-sun8i-h3-uart3.dtbo:/dtb/overlay/sun8i-h3-uart3.dtbo \ + uImage-sun8i-h3-usbhost0.dtbo:/dtb/overlay/sun8i-h3-usbhost0.dtbo \ + uImage-sun8i-h3-usbhost2.dtbo:/dtb/overlay/sun8i-h3-usbhost1.dtbo \ + uImage-sun8i-h3-usbhost3.dtbo:/dtb/overlay/sun8i-h3-usbhost2.dtbo \ + uImage-sun8i-h3-w1-gpio.dtbo:/dtb/overlay/sun8i-h3-w1-gpio.dtbo \ + boot.scr:/boot.scr \ + armbianEnv.txt:/ \ + " + +IMAGE_CMD_resinos-img_append_orange-pi-lite () { + # orange-pi-lite needs uboot written at a specific location + dd if=${DEPLOY_DIR_IMAGE}/u-boot-sunxi-with-spl.bin of=${RESIN_RAW_IMG} conv=notrunc seek=8 bs=1024 +} + +# +# nanopi-neo-air +# + +IMAGE_FSTYPES_append_nanopi-neo-air = " resinos-img" + +# Customize resinos-img +RESIN_IMAGE_BOOTLOADER_nanopi-neo-air = "u-boot" +RESIN_BOOT_PARTITION_FILES_nanopi-neo-air = " \ + ${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \ + uImage-sun8i-h3-nanopi-neo-air.dtb:/dtb/sun8i-h3-nanopi-neo-air.dtb \ + uImage-sun8i-h3-fixup.scr:/dtb/overlay/sun8i-h3-fixup.scr \ + uImage-sun8i-h3-analog-codec.dtbo:/dtb/overlay/sun8i-h3-analog-codec.dtbo \ + uImage-sun8i-h3-cir.dtbo:/dtb/overlay/sun8i-h3-cir.dtbo \ + uImage-sun8i-h3-i2c0.dtbo:/dtb/overlay/sun8i-h3-i2c0.dtbo \ + uImage-sun8i-h3-i2c1.dtbo:/dtb/overlay/sun8i-h3-i2c1.dtbo \ + uImage-sun8i-h3-i2c2.dtbo:/dtb/overlay/sun8i-h3-i2c2.dtbo \ + uImage-sun8i-h3-pps-gpio.dtbo:/dtb/overlay/sun8i-h3-pps-gpio.dtbo \ + uImage-sun8i-h3-pwm.dtbo:/dtb/overlay/sun8i-h3-pwm.dtbo \ + uImage-sun8i-h3-spdif-out.dtbo:/dtb/overlay/sun8i-h3-spdif-out.dtbo \ + uImage-sun8i-h3-spi-add-cs1.dtbo:/dtb/overlay/sun8i-h3-spi-add-cs1.dtbo \ + uImage-sun8i-h3-spi-jedec-nor.dtbo:/dtb/overlay/sun8i-h3-spi-jedec-nor.dtbo \ + uImage-sun8i-h3-spi-spidev.dtbo:/dtb/overlay/sun8i-h3-spi-spidev.dtbo \ + uImage-sun8i-h3-uart1.dtbo:/dtb/overlay/sun8i-h3-uart1.dtbo \ + uImage-sun8i-h3-uart2.dtbo:/dtb/overlay/sun8i-h3-uart2.dtbo \ + uImage-sun8i-h3-uart3.dtbo:/dtb/overlay/sun8i-h3-uart3.dtbo \ + uImage-sun8i-h3-usbhost0.dtbo:/dtb/overlay/sun8i-h3-usbhost0.dtbo \ + uImage-sun8i-h3-usbhost2.dtbo:/dtb/overlay/sun8i-h3-usbhost1.dtbo \ + uImage-sun8i-h3-usbhost3.dtbo:/dtb/overlay/sun8i-h3-usbhost2.dtbo \ + uImage-sun8i-h3-w1-gpio.dtbo:/dtb/overlay/sun8i-h3-w1-gpio.dtbo \ + boot.scr:/boot.scr \ + armbianEnv.txt:/ \ + " + +IMAGE_CMD_resinos-img_append_nanopi-neo-air () { + # nanopi-neo-air needs uboot written at a specific location + dd if=${DEPLOY_DIR_IMAGE}/u-boot-sunxi-with-spl.bin of=${RESIN_RAW_IMG} conv=notrunc seek=8 bs=1024 +} diff --git a/layers/meta-resin-allwinner/recipes-support/resin-init/resin-init-flasher.bbappend b/layers/meta-resin-allwinner/recipes-support/resin-init/resin-init-flasher.bbappend new file mode 100644 index 0000000..a00af1d --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-support/resin-init/resin-init-flasher.bbappend @@ -0,0 +1,2 @@ +# Flash to internal eMMC - kernel always enumerates emmc as mmcblk2 +INTERNAL_DEVICE_KERNEL_nanopi-neo-air = "mmcblk2" \ No newline at end of file diff --git a/nanopi-neo-air.coffee b/nanopi-neo-air.coffee index 2a9c12c..dd8d75c 100644 --- a/nanopi-neo-air.coffee +++ b/nanopi-neo-air.coffee @@ -20,7 +20,7 @@ module.exports = yocto: machine: 'nanopi-neo-air' - image: 'resin-image' + image: 'resin-image-flasher' fstype: 'resinos-img' version: 'yocto-morty' deployArtifact: 'resin-image-nanopi-neo-air.resinos-img'