diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2843330 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +image/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3287cf2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "cerbero"] + path = cerbero + url = https://gitlab.freedesktop.org/gstreamer/cerbero.git + branch = 1.14 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2f791e0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +sudo: required + +language: bash + +before_install: + - sudo apt-get update + +script: + - download.sh + - mount.sh diff --git a/cerbero b/cerbero new file mode 160000 index 0000000..b7933b0 --- /dev/null +++ b/cerbero @@ -0,0 +1 @@ +Subproject commit b7933b0f65bc208a27001526f401a5fc6f3a77bd diff --git a/download.sh b/download.sh new file mode 100755 index 0000000..c5f8a43 --- /dev/null +++ b/download.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Downloads latest raspbian lite image + +ZIP=raspbian_lite.zip +IMG=raspbian_lite.img +URL=https://downloads.raspberrypi.org/raspbian_lite_latest + +echo "Downloading latest raspbian lite release" +mkdir -p image +wget $URL -O image/${ZIP} + +echo "Extracting image" +unzip image/${ZIP} -d image/ + +FILE=`zipinfo -1 image/${ZIP}` +mv image/${FILE} image/${IMG} \ No newline at end of file diff --git a/mount.sh b/mount.sh new file mode 100755 index 0000000..e387290 --- /dev/null +++ b/mount.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Mounts raspbian image inside cerbero build system + +IMG='raspbian_lite.img' +MNT='cerbero/config/raspbian_sysroot' + +# Attach loopback device +LOOP_DEV=`losetup -f --show image/${IMG}` +echo "Attached base loopback at: $LOOP_DEV" + +# Fetch and parse partition info +LOOP=`basename ${LOOP_DEV}` +SECTOR_SIZE=`cat /sys/block/${LOOP}/queue/hw_sector_size` +ROOT_START=`fdisk -l $LOOP_DEV | grep ${LOOP_DEV}p2 | awk '{print $2}'` +echo "Located root partition at sector $ROOT_START (sector size: ${SECTOR_SIZE}B)" + +mkdir -p $MNT +mount image/${IMG} -o loop,offset=$(($ROOT_START*$SECTOR_SIZE)),rw $MNT +if [[ $? != 0 ]]; then + echo "Error mounting root partition" +else + echo "Mounted root partition to $MNT" +fi + +losetup -d $LOOP_DEV +echo "Closed loopback $LOOP_DEV"