Skip to content

Commit

Permalink
Build gadget snap with snapcraft
Browse files Browse the repository at this point in the history
This requires most recent snapcraft with support for hooks. canonical/snapcraft#1026
  • Loading branch information
longsleep committed Jan 9, 2017
1 parent bcd73a2 commit 5c8af02
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
/snappy/*/stage
/snappy/*/prime
/snappy/*/parts
/snappy/gadget/uboot.env
/snappy/gadget/uboot.conf
/snappy/gadget/boot-assets
/snappy/gadget/prebuilt/uboot.env
/snappy/gadget/prebuilt/uboot.conf
/snappy/gadget/prebuilt/boot-assets
2 changes: 1 addition & 1 deletion snappy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
## Build image

```
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
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
```
27 changes: 13 additions & 14 deletions snappy/gadget.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@ include common.mk
all: build

clean:
rm -rf $(GADGET_DIR)/boot-assets
rm -f $(GADGET_DIR)/uboot.conf
rm -f $(GADGET_DIR)/uboot.env
rm -f $(GADGET_SNAP)
rm -rf $(GADGET_DIR)/prebuilt/boot-assets
rm -f $(GADGET_DIR)/prebuilt/uboot.conf
rm -f $(GADGET_DIR)/prebuilt/uboot.env
cd gadget; snapcraft clean

distclean: clean

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

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

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

snappy: preload
snapcraft snap gadget
cd gadget; snapcraft --target-arch amd64 snap

build: dtbs preload snappy

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
6 changes: 6 additions & 0 deletions snappy/gadget/meta/snap.yaml → snappy/gadget/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ description: |
type: gadget
architectures:
- arm64
confinement: strict
grade: stable
parts:
prebuilt:
plugin: dump
source: prebuilt

0 comments on commit 5c8af02

Please sign in to comment.