Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #22 from hypriot/add-hypriot-image-version
Browse files Browse the repository at this point in the history
Add hypriot image version
  • Loading branch information
StefanScherer committed Feb 12, 2016
2 parents c85adb3 + 371818b commit cfbb898
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 36 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ script:
branches:
only:
- master
- /^v\d.*$/
deploy:
provider: releases
api_key:
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ BOARD=black-pearl.local make test-integration

This test works with any Docker Machine, so you do not need to create the Vagrant box.

## Deployment

For maintainers of this project you can release a new version and deploy the SD-Card image to GitHub releases with

```bash
TAG=v0.0.1 make tag
```

After that open the GitHub release of this version and fill it with relevant changes and links to resolved issues.

## License

MIT - see the [LICENSE](./LICENSE) file for details.
19 changes: 10 additions & 9 deletions builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ BUILD_RESULT_PATH="/workspace"
BUILD_PATH="/build"

# where to store our base file system
ROOTFS_TAR_VERSION="v0.7.0"
ROOTFS_TAR="rootfs-armhf-${ROOTFS_TAR_VERSION}.tar.gz"
HYPRIOT_OS_VERSION="v0.7.1"
ROOTFS_TAR="rootfs-armhf-${HYPRIOT_OS_VERSION}.tar.gz"
ROOTFS_TAR_PATH="$BUILD_RESULT_PATH/$ROOTFS_TAR"

# size of root and boot partion
ROOT_PARTITION_SIZE="800M"

# device specific settings
IMAGE_VERSION=${VERSION:="dirty"}
IMAGE_NAME="sd-card-odroid-c1-${IMAGE_VERSION}.img"
HYPRIOT_IMAGE_VERSION=${VERSION:="dirty"}
HYPRIOT_IMAGE_NAME="sd-card-odroid-c1-${HYPRIOT_IMAGE_VERSION}.img"
IMAGE_ROOTFS_PATH="/image-rootfs.tar.gz"
QEMU_ARCH="arm"
export HYPRIOT_IMAGE_VERSION

# specific versions of kernel/firmware and docker tools
export DOCKER_ENGINE_VERSION="1.9.1-1"
Expand All @@ -37,7 +38,7 @@ mkdir -p $BUILD_PATH

# download our base root file system
if [ ! -f $ROOTFS_TAR_PATH ]; then
wget -q -O $ROOTFS_TAR_PATH https://github.com/hypriot/os-rootfs/releases/download/$ROOTFS_TAR_VERSION/$ROOTFS_TAR
wget -q -O $ROOTFS_TAR_PATH https://github.com/hypriot/os-rootfs/releases/download/$HYPRIOT_OS_VERSION/$ROOTFS_TAR
fi

# extract root file system
Expand Down Expand Up @@ -86,7 +87,7 @@ wget -q https://raw.githubusercontent.com/mdrjr/c1_uboot_binaries/master/u-boot.

guestfish <<EOF
# create new image disk
sparse /$IMAGE_NAME $ROOT_PARTITION_SIZE
sparse /$HYPRIOT_IMAGE_NAME $ROOT_PARTITION_SIZE
run
part-init /dev/sda mbr
part-add /dev/sda primary 3072 -1
Expand All @@ -109,13 +110,13 @@ copy-file-to-device /boot/u-boot.bin /dev/sda destoffset:32768 sparse:true
EOF

# log image partioning
fdisk -l "/$IMAGE_NAME"
fdisk -l "/$HYPRIOT_IMAGE_NAME"

# ensure that the travis-ci user can access the sd-card image file
umask 0000

# compress image
pigz --zip -c "$IMAGE_NAME" > "$BUILD_RESULT_PATH/$IMAGE_NAME.zip"
pigz --zip -c "$HYPRIOT_IMAGE_NAME" > "$BUILD_RESULT_PATH/$HYPRIOT_IMAGE_NAME.zip"

# test sd-image that we have built
VERSION=${IMAGE_VERSION} rspec --format documentation --color /builder/test
VERSION=${HYPRIOT_IMAGE_VERSION} rspec --format documentation --color /builder/test
7 changes: 3 additions & 4 deletions builder/chroot-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ DOCKER_OPTS=\"--storage-driver=aufs -D\"" /etc/default/docker
# enable Docker systemd service
systemctl enable docker

# --- install ODROID kernel ---
# install ODROID kernel

apt-get install -y u-boot-tools initramfs-tools

# make the kernel package create a copy of the current kernel here
touch /boot/uImage
apt-get install -y linux-image-c1

# ---

# set device label
# set device label and version number
echo "HYPRIOT_DEVICE=\"$HYPRIOT_DEVICE\"" >> /etc/os-release
echo "HYPRIOT_IMAGE_VERSION=\"$HYPRIOT_IMAGE_VERSION\"" >> /etc/os-release
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
it { should be_file }
it { should be_owned_by 'root' }
its(:content) { should match 'HYPRIOT_OS="HypriotOS/armhf"' }
its(:content) { should match 'HYPRIOT_TAG="v0.7.0"' }
its(:content) { should match 'HYPRIOT_TAG="v0.7.1"' }
its(:content) { should match 'HYPRIOT_DEVICE="ODROID C1/C1+"' }
its(:content) { should match 'HYPRIOT_IMAGE_VERSION=' }
end
58 changes: 37 additions & 21 deletions builder/test/os-release_spec.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,49 @@
require_relative 'spec_helper'

describe "Root filesystem" do
let(:rootfs_path) { return '/build' }
let(:stdout) { run_mounted("cat /etc/os-release").stdout }

it "exists" do
rootfs_dir = file(rootfs_path)
expect(rootfs_dir).to exist
it "is based on debian" do
expect(stdout).to contain('debian')
end

context "Hypriot OS Release in /etc/os-release" do
let(:stdout) { command("cat #{rootfs_path}/etc/os-release").stdout }
it "is debian version jessie" do
expect(stdout).to contain('jessie')
end

it "has a HYPRIOT_OS= entry" do
expect(stdout).to contain('^HYPRIOT_OS=')
end
it "has a HYPRIOT_TAG= entry" do
expect(stdout).to contain('^HYPRIOT_TAG=')
end
it "has a HYPRIOT_DEVICE= entry" do
expect(stdout).to contain('^HYPRIOT_DEVICE=')
end
it "is a HypriotOS" do
expect(stdout).to contain('HypriotOS')
end

it "is for architecure 'HYPRIOT_OS=\"HypriotOS/armhf\"'" do
expect(stdout).to contain('^HYPRIOT_OS="HypriotOS/armhf"$')
end
it "has a HYPRIOT_OS= entry" do
expect(stdout).to contain('^HYPRIOT_OS=')
end
it "has a HYPRIOT_OS_VERSION= entry" do
expect(stdout).to contain('^HYPRIOT_OS_VERSION=')
end
it "has a HYPRIOT_DEVICE= entry" do
expect(stdout).to contain('^HYPRIOT_DEVICE=')
end
it "has a HYPRIOT_IMAGE_VERSION= entry" do
expect(stdout).to contain('^HYPRIOT_IMAGE_VERSION=')
end

it "is for device 'HYPRIOT_DEVICE=\"ODROID C1/C1+\"'" do
expect(stdout).to contain('^HYPRIOT_DEVICE="ODROID C1/C1\+"$')
end
it "is for architecure 'HYPRIOT_OS=\"HypriotOS/armhf\"'" do
expect(stdout).to contain('HYPRIOT_OS="HypriotOS/armhf"')
end

it "is for device 'HYPRIOT_DEVICE=\"ODROID C1/C1+\"'" do
expect(stdout).to contain('HYPRIOT_DEVICE="ODROID C1/C1')
end

it "uses os-rootfs version 'HYPRIOT_OS_VERSION=\"v0.7.1\"'" do
expect(stdout).to contain('^HYPRIOT_OS_VERSION="v0.7.1"$')
end

if ENV.fetch('TRAVIS_TAG','') != ''
it "is not dirty" do
expect(stdout).not_to contain('dirty')
end
end

end
2 changes: 1 addition & 1 deletion builder/test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ def run( cmd )
end

def run_mounted( cmd )
return run("mount /dev/sda2 / : #{cmd}")
return run("mount /dev/sda1 / : #{cmd}")
end

0 comments on commit cfbb898

Please sign in to comment.