Skip to content

Commit 267ad78

Browse files
committed
Build gadget snap with snapcraft
This requires most recent snapcraft with support for hooks. canonical/snapcraft#1026
1 parent 019b0db commit 267ad78

File tree

9 files changed

+23
-18
lines changed

9 files changed

+23
-18
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
/snappy/*/stage
2323
/snappy/*/prime
2424
/snappy/*/parts
25-
/snappy/gadget/uboot.env
26-
/snappy/gadget/uboot.conf
27-
/snappy/gadget/boot-assets
25+
/snappy/gadget/prebuilt/uboot.env
26+
/snappy/gadget/prebuilt/uboot.conf
27+
/snappy/gadget/prebuilt/boot-assets

snappy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
## Build image
33

44
```
5-
UBUNTU_IMAGE_SKIP_COPY_UNVERIFIED_MODEL=1 ubuntu-image -c stable --image-size 2G --extra-snaps pine64_16.04-2_arm64.snap --extra-snaps kernel/pine64-kernel_3.10.104-2_arm64.snap -o test2.img pine64.model --debug
5+
UBUNTU_IMAGE_SKIP_COPY_UNVERIFIED_MODEL=1 ubuntu-image -c stable --image-size 2G --extra-snaps gadget/pine64_16.04-3_arm64.snap --extra-snaps kernel/pine64-kernel_3.10.104-2_arm64.snap -o test4.img pine64.model --debug
66
```

snappy/gadget.mk

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,30 @@ include common.mk
33
all: build
44

55
clean:
6-
rm -rf $(GADGET_DIR)/boot-assets
7-
rm -f $(GADGET_DIR)/uboot.conf
8-
rm -f $(GADGET_DIR)/uboot.env
9-
rm -f $(GADGET_SNAP)
6+
rm -rf $(GADGET_DIR)/prebuilt/boot-assets
7+
rm -f $(GADGET_DIR)/prebuilt/uboot.conf
8+
rm -f $(GADGET_DIR)/prebuilt/uboot.env
9+
cd gadget; snapcraft clean
1010

1111
distclean: clean
1212

1313
u-boot:
14-
@if [ ! -d $(GADGET_DIR)/boot-assets ] ; then mkdir -p $(GADGET_DIR)/boot-assets; fi
14+
@if [ ! -d $(GADGET_DIR)/prebuilt/boot-assets ] ; then mkdir -p $(GADGET_DIR)/prebuilt/boot-assets; fi
1515
@if [ ! -f $(UBOOT_BIN) ]; then echo "Build u-boot first."; exit 1; fi
16-
cp -fa $(UBOOT_BIN) $(GADGET_DIR)/boot-assets/u-boot-with-dtb.bin
16+
cp -fa $(UBOOT_BIN) $(GADGET_DIR)/prebuilt/boot-assets/u-boot-with-dtb.bin
1717

1818
dtbs:
19-
@if [ ! -d $(GADGET_DIR)/boot-assets/dtbs ] ; then mkdir -p $(GADGET_DIR)/boot-assets/dtbs; fi
20-
dtc -Odtb -o $(GADGET_DIR)/boot-assets/dtbs/sun50i-a64-pine64-plus.dtb $(BLOBS_DIR)/pine64.dts
21-
dtc -Odtb -o $(GADGET_DIR)/boot-assets/dtbs/sun50i-a64-pine64.dtb $(BLOBS_DIR)/pine64noplus.dts
22-
dtc -Odtb -o $(GADGET_DIR)/boot-assets/dtbs/sun50i-a64-pine64so.dtb $(BLOBS_DIR)/pine64so.dts
19+
@if [ ! -d $(GADGET_DIR)/prebuilt/boot-assets/dtbs ] ; then mkdir -p $(GADGET_DIR)/prebuilt/boot-assets/dtbs; fi
20+
dtc -Odtb -o $(GADGET_DIR)/prebuilt/boot-assets/dtbs/sun50i-a64-pine64-plus.dtb $(BLOBS_DIR)/pine64.dts
21+
dtc -Odtb -o $(GADGET_DIR)/prebuilt/boot-assets/dtbs/sun50i-a64-pine64.dtb $(BLOBS_DIR)/pine64noplus.dts
22+
dtc -Odtb -o $(GADGET_DIR)/prebuilt/boot-assets/dtbs/sun50i-a64-pine64so.dtb $(BLOBS_DIR)/pine64so.dts
2323

2424
preload: u-boot dtbs
25-
cp -fa $(BLOBS_DIR)/boot0.bin $(GADGET_DIR)/boot-assets/boot0.bin
26-
mkenvimage -r -s 131072 -o $(GADGET_DIR)/uboot.env $(GADGET_DIR)/uboot.env.in
27-
@if [ ! -f $(GADGET_DIR)/uboot.conf ]; then ln -s uboot.env $(GADGET_DIR)/uboot.conf; fi
25+
cp -fa $(BLOBS_DIR)/boot0.bin $(GADGET_DIR)/prebuilt/boot-assets/boot0.bin
26+
mkenvimage -r -s 131072 -o $(GADGET_DIR)/prebuilt/uboot.env $(GADGET_DIR)/prebuilt/uboot.env.in
2827

2928
snappy: preload
30-
snapcraft snap gadget
29+
cd gadget; snapcraft --target-arch amd64 snap
3130

3231
build: dtbs preload snappy
3332

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

snappy/gadget/meta/snap.yaml renamed to snappy/gadget/snapcraft.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ description: |
66
type: gadget
77
architectures:
88
- arm64
9+
confinement: strict
10+
grade: stable
11+
parts:
12+
prebuilt:
13+
plugin: dump
14+
source: prebuilt

0 commit comments

Comments
 (0)