gadget snap build improvements #6

Merged
merged 3 commits into from Sep 21, 2017
View
@@ -1,11 +1,11 @@
#name,size,align,type,format,file
,1024,,,,
-sbl1,1024,,DEA0BA2C-CBDD-4805-B4F9-F428251C3E98,,sbl1.mbn
-rpm,1024,,098DF793-D712-413D-9D4E-89D711772228,,rpm.mbn
-tz,1024,,A053AA7F-40B8-4B1C-BA08-2F68AC71A4F4,,tz.mbn
-hyp,1024,,E1A6A689-0C8D-4CC6-B4E8-55A4320FBD8A,,hyp.mbn
-sec,1024,65536,303E6AC3-AF15-4C54-9E9B-D9A8FBECF401,,
-aboot,2048,,400FFDCD-22E0-47E7-9A23-F16ED9382388,,emmc_appsboot.mbn
-boot,1024,,20117F86-E985-4357-B9EE-374BC1D8487D,,boot.img
-system-boot,131072,,EBD0A0A2-B9E5-4433-87C0-68B6B72699C7,,system-boot.img
+sbl1,sbl1-size,,DEA0BA2C-CBDD-4805-B4F9-F428251C3E98,,sbl1.mbn
+rpm,rpm-size,,098DF793-D712-413D-9D4E-89D711772228,,rpm.mbn
+tz,tz-size,,A053AA7F-40B8-4B1C-BA08-2F68AC71A4F4,,tz.mbn
+hyp,hyp-size,,E1A6A689-0C8D-4CC6-B4E8-55A4320FBD8A,,hyp.mbn
+sec,sec-size,65536,303E6AC3-AF15-4C54-9E9B-D9A8FBECF401,,
+aboot,aboot-size,,400FFDCD-22E0-47E7-9A23-F16ED9382388,,emmc_appsboot.mbn
+boot,boot-size,,20117F86-E985-4357-B9EE-374BC1D8487D,,boot.img
+system-boot,system-boot-size,,EBD0A0A2-B9E5-4433-87C0-68B6B72699C7,,system-boot.img
writable,0,,0FC63DAF-8483-4772-8E79-3D69D8477DE4,fastboot,writable.img
View
@@ -1,107 +0,0 @@
-From c392071efdb00f63a449e3d29b2ccf7e6c69c831 Mon Sep 17 00:00:00 2001
-From: Ondrej Kubik <ondrej.kubik@canonical.com>
-Date: Wed, 21 Jun 2017 17:23:58 +0000
-Subject: [PATCH 1/1] suport patch for dragonboard410c for ubuntu-core - needs
- to revert changes to driver/mmc/sdhci.c which breaks support for emmc
-
-Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
----
- drivers/mmc/sdhci.c | 15 ++++-----------
- include/configs/dragonboard410c.h | 18 +++++++++++++++---
- 2 files changed, 19 insertions(+), 14 deletions(-)
-
-diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
-index b745977..c94d58d 100644
---- a/drivers/mmc/sdhci.c
-+++ b/drivers/mmc/sdhci.c
-@@ -72,7 +72,6 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
- unsigned int start_addr)
- {
- unsigned int stat, rdy, mask, timeout, block = 0;
-- bool transfer_done = false;
- #ifdef CONFIG_MMC_SDHCI_SDMA
- unsigned char ctrl;
- ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
-@@ -90,23 +89,17 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
- __func__, stat);
- return -EIO;
- }
-- if (!transfer_done && (stat & rdy)) {
-+ if (stat & rdy) {
- if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & mask))
- continue;
- sdhci_writel(host, rdy, SDHCI_INT_STATUS);
- sdhci_transfer_pio(host, data);
- data->dest += data->blocksize;
-- if (++block >= data->blocks) {
-- /* Keep looping until the SDHCI_INT_DATA_END is
-- * cleared, even if we finished sending all the
-- * blocks.
-- */
-- transfer_done = true;
-- continue;
-- }
-+ if (++block >= data->blocks)
-+ break;
- }
- #ifdef CONFIG_MMC_SDHCI_SDMA
-- if (!transfer_done && (stat & SDHCI_INT_DMA_END)) {
-+ if (stat & SDHCI_INT_DMA_END) {
- sdhci_writel(host, SDHCI_INT_DMA_END, SDHCI_INT_STATUS);
- start_addr &= ~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1);
- start_addr += SDHCI_DEFAULT_BOUNDARY_SIZE;
-diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
-index b97c6c4..03a9011 100644
---- a/include/configs/dragonboard410c.h
-+++ b/include/configs/dragonboard410c.h
-@@ -14,6 +14,9 @@
-
- #define CONFIG_MISC_INIT_R /* To stop autoboot */
-
-+/* raw initrd support for snappy */
-+#define CONFIG_SUPPORT_RAW_INITRD
-+
- /* Physical Memory Map */
- #define CONFIG_NR_DRAM_BANKS 1
- #define PHYS_SDRAM_1 0x80000000
-@@ -45,6 +48,9 @@
- #define CONFIG_USB_ETHER_MCS7830
- #define CONFIG_USB_ETHER_SMSC95XX
-
-+/* vfat support for snappy */
-+#define CONFIG_SUPPORT_VFAT
-+
- /* Extra Commands */
- #define CONFIG_CMD_ENV
- /* Enable that for switching of boot partitions */
-@@ -66,8 +72,8 @@
-
- #define BOOT_TARGET_DEVICES(func) \
- func(USB, usb, 0) \
-- func(MMC, mmc, 1) \
- func(MMC, mmc, 0) \
-+ func(MMC, mmc, 1) \
- func(DHCP, dhcp, na)
-
- #include <config_distro_bootcmd.h>
-@@ -112,9 +118,15 @@ REFLASH(dragonboard/u-boot.img, 8)\
- "pxefile_addr_r=0x90100000\0"\
- BOOTENV
-
--#define CONFIG_ENV_IS_NOWHERE
--#define CONFIG_ENV_SIZE 0x2000
-+#undef CONFIG_ENV_IS_NOWHERE
-+#define CONFIG_ENV_SIZE SZ_128K
-+#define CONFIG_ENV_IS_IN_FAT
-+#define CONFIG_FAT_WRITE
-+#define FAT_ENV_INTERFACE "mmc"
-+#define FAT_ENV_DEVICE_AND_PART "0:8"
-+#define FAT_ENV_FILE "uboot.env"
- #define CONFIG_ENV_VARS_UBOOT_CONFIG
-+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
-
- /* Size of malloc() pool */
- #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M)
---
-2.7.4
-
View
@@ -33,12 +33,12 @@ volumes:
- name: aboot
size: 2097152
content:
- - image: sd_appsboot.mbn
+ - image: blobs/sd_appsboot.mbn
type: 400FFDCD-22E0-47E7-9A23-F16ED9382388
- name: boot
size: 1048576
content:
- - image: sd_u-boot.img
+ - image: blobs/sd_u-boot.img
type: 20117F86-E985-4357-B9EE-374BC1D8487D
- name: system-boot
type: 0C,EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
View
@@ -1,96 +0,0 @@
-From 71965b205f852b757ba4d73873b6ed113ef5166a Mon Sep 17 00:00:00 2001
-From: Ondrej Kubik <ondrej.kubik@canonical.com>
-Date: Wed, 21 Jun 2017 17:23:58 +0000
-Subject: [PATCH 1/1] suport patch for dragonboard410c for ubuntu-core
-
-Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
----
- drivers/mmc/sdhci.c | 15 ++++-----------
- include/configs/dragonboard410c.h | 16 ++++++++++++++--
- 2 files changed, 18 insertions(+), 13 deletions(-)
-
-diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
-index b745977..c94d58d 100644
---- a/drivers/mmc/sdhci.c
-+++ b/drivers/mmc/sdhci.c
-@@ -72,7 +72,6 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
- unsigned int start_addr)
- {
- unsigned int stat, rdy, mask, timeout, block = 0;
-- bool transfer_done = false;
- #ifdef CONFIG_MMC_SDHCI_SDMA
- unsigned char ctrl;
- ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
-@@ -90,23 +89,17 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
- __func__, stat);
- return -EIO;
- }
-- if (!transfer_done && (stat & rdy)) {
-+ if (stat & rdy) {
- if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & mask))
- continue;
- sdhci_writel(host, rdy, SDHCI_INT_STATUS);
- sdhci_transfer_pio(host, data);
- data->dest += data->blocksize;
-- if (++block >= data->blocks) {
-- /* Keep looping until the SDHCI_INT_DATA_END is
-- * cleared, even if we finished sending all the
-- * blocks.
-- */
-- transfer_done = true;
-- continue;
-- }
-+ if (++block >= data->blocks)
-+ break;
- }
- #ifdef CONFIG_MMC_SDHCI_SDMA
-- if (!transfer_done && (stat & SDHCI_INT_DMA_END)) {
-+ if (stat & SDHCI_INT_DMA_END) {
- sdhci_writel(host, SDHCI_INT_DMA_END, SDHCI_INT_STATUS);
- start_addr &= ~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1);
- start_addr += SDHCI_DEFAULT_BOUNDARY_SIZE;
-diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
-index b97c6c4..f29c527 100644
---- a/include/configs/dragonboard410c.h
-+++ b/include/configs/dragonboard410c.h
-@@ -14,6 +14,9 @@
-
- #define CONFIG_MISC_INIT_R /* To stop autoboot */
-
-+/* raw initrd support for snappy */
-+#define CONFIG_SUPPORT_RAW_INITRD
-+
- /* Physical Memory Map */
- #define CONFIG_NR_DRAM_BANKS 1
- #define PHYS_SDRAM_1 0x80000000
-@@ -45,6 +48,9 @@
- #define CONFIG_USB_ETHER_MCS7830
- #define CONFIG_USB_ETHER_SMSC95XX
-
-+/* vfat support for snappy */
-+#define CONFIG_SUPPORT_VFAT
-+
- /* Extra Commands */
- #define CONFIG_CMD_ENV
- /* Enable that for switching of boot partitions */
-@@ -112,9 +118,15 @@ REFLASH(dragonboard/u-boot.img, 8)\
- "pxefile_addr_r=0x90100000\0"\
- BOOTENV
-
--#define CONFIG_ENV_IS_NOWHERE
--#define CONFIG_ENV_SIZE 0x2000
-+#undef CONFIG_ENV_IS_NOWHERE
-+#define CONFIG_ENV_SIZE SZ_128K
-+#define CONFIG_ENV_IS_IN_FAT
-+#define CONFIG_FAT_WRITE
-+#define FAT_ENV_INTERFACE "mmc"
-+#define FAT_ENV_DEVICE_AND_PART "1:8"
-+#define FAT_ENV_FILE "uboot.env"
- #define CONFIG_ENV_VARS_UBOOT_CONFIG
-+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
-
- /* Size of malloc() pool */
- #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M)
---
-2.7.4
-
View
@@ -26,13 +26,15 @@ parts:
target-arch: arm
build-packages: [device-tree-compiler, libfdt-dev, python, curl]
prepare: |
- git am --3way ../../../sd_u-boot.patch
+ git am --3way ../../../u-boot-generic*.patch
+ git am --3way ../../../u-boot-sd*.patch
git clone git://codeaurora.org/quic/kernel/skales
install: |
skales/dtbTool -o u-boot-dt.img -s 2048 arch/arm/dts/
touch u-boot-ramdisk.img
+ mkdir -p $SNAPCRAFT_PART_INSTALL/blobs
skales/mkbootimg --kernel=u-boot.bin \
- --output=$SNAPCRAFT_PART_INSTALL/sd_u-boot.img \
+ --output=$SNAPCRAFT_PART_INSTALL/blobs/sd_u-boot.img \
--dt=u-boot-dt.img \
--pagesize 2048 \
--base 0x80000000 \
@@ -52,7 +54,8 @@ parts:
target-arch: arm
build-packages: [device-tree-compiler, libfdt-dev, python, curl]
prepare: |
- git am --3way ../../../emmc_u-boot.patch
+ git am --3way ../../../u-boot-generic*.patch
+ git am --3way ../../../u-boot-emmc*.patch
git clone git://codeaurora.org/quic/kernel/skales
install: |
skales/dtbTool -o u-boot-dt.img -s 2048 arch/arm/dts/
@@ -76,10 +79,11 @@ parts:
- -MD5SUMS.txt
- -NON-HLOS.bin
organize:
- sbl1.mbn: blobs/sbl1.mbn
- tz.mbn: blobs/tz.mbn
- rpm.mbn: blobs/rpm.mbn
- hyp.mbn: blobs/hyp.mbn
+ sbl1.mbn: blobs/sbl1.mbn
+ tz.mbn: blobs/tz.mbn
+ rpm.mbn: blobs/rpm.mbn
+ hyp.mbn: blobs/hyp.mbn
+ sd_appsboot.mbn: blobs/sd_appsboot.mbn
emmc-build-blobs:
plugin: dump
@@ -104,7 +108,18 @@ parts:
build-packages: [gdisk, fakeroot]
build: |
mkdir -p $SNAPCRAFT_PART_INSTALL/blobs
- fakeroot ./mksdcard -g -o sd.img -p ../../../emmc-partitions.txt
+ cp ../../../emmc-partitions.txt .
+ sizes=$(grep -e 'size' ../../../gadget.yaml | awk -F ": " '{ print $2}')
+ for name in $(grep -e 'name' ../../../gadget.yaml | awk -F ": " '{ print $2}'); do
+ set $sizes; size=$1; shift; sizes="$*";
+ case $size in
+ (*M) size=$(expr $(echo $size | sed 's/M//g') \* 1024) ;;
+ (*K) size=$(echo $size | sed 's/K//g');;
+ (*) size=$(expr $size / 1024);;
+ esac;
+ sed -i 's/,'"${name}"'-size,/,'"${size}"',/g' emmc-partitions.txt;
+ done
+ fakeroot ./mksdcard -g -o sd.img -p emmc-partitions.txt
fakeroot sgdisk -bgpt.bin sd.img
fakeroot ./mkgpt -i gpt.bin -o $SNAPCRAFT_PART_INSTALL/blobs/gpt_both0.bin
rm -rf *
@@ -0,0 +1,36 @@
+From 753c7c7cc0d778f8e200d7cdc3def2fd76fdf1b9 Mon Sep 17 00:00:00 2001
+From: Ondrej Kubik <ondrej.kubik@canonical.com>
+Date: Tue, 12 Sep 2017 21:58:48 +0000
+Subject: [PATCH 5/5] setting emmc system-boot partition
+
+Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
+---
+ include/configs/dragonboard410c.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
+index 6647f67..76b375d 100644
+--- a/include/configs/dragonboard410c.h
++++ b/include/configs/dragonboard410c.h
+@@ -72,8 +72,8 @@
+
+ #define BOOT_TARGET_DEVICES(func) \
+ func(USB, usb, 0) \
+- func(MMC, mmc, 1) \
+ func(MMC, mmc, 0) \
++ func(MMC, mmc, 1) \
+ func(DHCP, dhcp, na)
+
+ #include <config_distro_bootcmd.h>
+@@ -123,7 +123,7 @@ REFLASH(dragonboard/u-boot.img, 8)\
+ #define CONFIG_ENV_IS_IN_FAT
+ #define CONFIG_FAT_WRITE
+ #define FAT_ENV_INTERFACE "mmc"
+-#define FAT_ENV_DEVICE_AND_PART "0:0"
++#define FAT_ENV_DEVICE_AND_PART "0:8"
+ #define FAT_ENV_FILE "uboot.env"
+ #define CONFIG_ENV_VARS_UBOOT_CONFIG
+ #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+--
+2.7.4
+
Oops, something went wrong.