build uboot from source, pull blobs from upstream, use dtbs from archive #1

Merged
merged 1 commit into from Sep 20, 2017
Jump to file or symbol
Failed to load files and symbols.
+103 −1,399
Split
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,30 +0,0 @@
-Copyright (c) 2006, Broadcom Corporation.
-Copyright (c) 2015, Raspberry Pi (Trading) Ltd
-All rights reserved.
-
-Redistribution. Redistribution and use in binary form, without
-modification, are permitted provided that the following conditions are
-met:
-
-* This software may only be used for the purposes of developing for,
- running or using a Raspberry Pi device.
-* Redistributions must reproduce the above copyright notice and the
- following disclaimer in the documentation and/or other materials
- provided with the distribution.
-* Neither the name of Broadcom Corporation nor the names of its suppliers
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
View
@@ -1,7 +1,17 @@
# Raspberry CM3 Gadget Snap
-This repository contains the official Ubuntu Core gadget snap for the Raspberry
-CM3.
+This repository contains the source for an official Ubuntu Core gadget snap
+for the Raspberry CM3.
+
+Building it with snapcraft will automatically pull, configure, patch and build
+the git.denx.de/u-boot.git upstream source for rpi_3_32b_defconfig at
+release v2017.05, produce a u-boot.bin binary and put it inside the gadget.
+
+It will then download the latest stable binary boot firmware
+from https://github.com/raspberrypi/firmware/tree/stable/boot and add it to the gadget.
+
+Last it will pull the latest linux-image-raspi2 from the xenial-updates archive, extract the
+devicetree and overlay files from it and add them to the gadget as well.
## Gadget Snaps
@@ -19,31 +29,14 @@ projects better than what is available with Github issues.
## Building
-To build the gadget snap locally please use `snapcraft`. This repository will
-be soon updated to support snapcraft natively, via a `snapcraft.yaml` file,
-stay tuned!
-
-In case you need to rebuild u-boot, the steps are
-
-```
-sudo apt install gcc-arm-linux-gnueabi
-export CROSS_COMPILE=arm-linux-gnueabi-
-git clone git://git.denx.de/u-boot.git
-cd u-boot; git checkout v2017.01-rc1
-git apply <gadget-folder>/prebuilt/uboot.patch
-make rpi_3_32b_defconfig
-make -j8
-```
-
-Building the uboot environment
+To build the gadget snap locally on an armhf system please use `snapcraft`.
-```
-mkenvimage -r -s 131072 -o uboot.env uboot.env.in
-```
+To cross build this gadget snap on a PC please install the gcc-arm-linux-gnueabihf package
+before running `snapcraft`
## Launchpad Mirror and Automatic Builds.
-All commits from the master branch of https://github.com/snapcore/cm3 are
+All commits from the master branch of https://github.com/snapcore/cm3-gadget are
automatically mirrored by Launchpad to the https://launchpad.net/snap-cm3
project.
File renamed without changes.
@@ -47,7 +47,7 @@ kernel=uboot.bin
dtparam=i2c_arm=on
dtparam=i2c_vc=on
#i2s=on
-#spi=on
+dtparam=spi=on
dtparam=act_led_trigger=heartbeat
dtparam=pwr_led_trigger=mmc0
dtparam=audio=on

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
View
Binary file not shown.
File renamed without changes
View
@@ -7,6 +7,76 @@ type: gadget
architectures:
- armhf
confinement: strict
+grade: stable
+parts:
+ uboot:
+ plugin: make
+ source: git://git.denx.de/u-boot.git
+ source-branch: v2017.05
+ prepare: |
+ git apply ../../../uboot.patch
+ make rpi_3_32b_defconfig
+ build: |
+ if [ "$(arch)" = "x86_64" ]; then
+ if [ ! -x /usr/bin/arm-linux-gnueabihf-gcc ]; then
+ echo "ERROR: You are cross building this snap, please install gcc-arm-linux-gnueabihf"
+ exit 1
+ fi
+ CROSS_COMPILE=arm-linux-gnueabihf- make
+ else
+ make
+ fi
+ install: |
+ mkdir -p $SNAPCRAFT_PART_INSTALL/boot-assets
+ cp u-boot.bin $SNAPCRAFT_PART_INSTALL/boot-assets/uboot.bin
+ tools/mkenvimage -r -s 131072 -o $SNAPCRAFT_PART_INSTALL/uboot.env ../../../uboot.env.in
+ ln -s uboot.env $SNAPCRAFT_PART_INSTALL/uboot.conf
+ build-packages:
+ - bc
+ - build-essential
+ - device-tree-compiler
+ - libpython2.7-dev
+ - python-minimal
+ boot-firmware:
+ plugin: nil
+ source: .
+ after:
+ - uboot
+ prepare: |
+ git clone --depth=1 https://github.com/raspberrypi/firmware.git -b "1.20170515"
+ install: |
+ mkdir -p $SNAPCRAFT_PART_INSTALL/boot-assets
+ for file in fixup start bootcode LICENCE COPYING; do
+ cp firmware/boot/${file}* $SNAPCRAFT_PART_INSTALL/boot-assets
+ done
+ configs:
+ plugin: dump
+ source: configs
+ after:
+ - boot-firmware
+ organize:
+ config.txt: boot-assets/config.txt
+ cmdline.txt: boot-assets/cmdline.txt
+ devicetrees:
+ plugin: nil
+ source: .
+ after:
+ - configs
+ prepare: |
+ PACKAGES="http://ports.ubuntu.com/ubuntu-ports/dists/xenial-updates/universe/binary-armhf/Packages.gz"
+ PKGPATH="$(wget -q -O- $PACKAGES|zcat|grep-dctrl linux-raspi2 |\
+ grep linux-image|grep Filename|tail -1| sed 's/^Filename: //')"
+ wget http://ports.ubuntu.com/ubuntu-ports/$PKGPATH
+ dpkg -x $(basename $PKGPATH) unpack/
+ install: |
+ mkdir -p $SNAPCRAFT_PART_INSTALL/boot-assets
+ cp -a unpack/lib/firmware/*/device-tree/* $SNAPCRAFT_PART_INSTALL/boot-assets
+ rm -rf unpack
+ build-packages:
+ - coreutils
+ - dctrl-tools
+ - sed
+ - wget
slots:
bcm-gpio-0:
@@ -105,14 +175,9 @@ slots:
bt-serial:
interface: serial-port
path: /dev/ttyAMA0
-
-grade: stable
-parts:
- prebuilt:
- plugin: dump
- source: prebuilt
- licenses:
- plugin: copy
- files:
- COPYING.linux: .
- LICENCE.broadcom: .
+ spidev0.0:
+ interface: spi
+ path: /dev/spidev0.0
+ spidev0.1:
+ interface: spi
+ path: /dev/spidev0.1
File renamed without changes.
@@ -1,9 +1,9 @@
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
-index 22e87a2..7da5213 100644
+index 2146534..9c4035c 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
-@@ -103,6 +103,11 @@ static const struct rpi_model rpi_models_new_scheme[] = {
- "bcm2835-rpi-zero.dtb",
+@@ -109,6 +109,11 @@ static const struct rpi_model rpi_models_new_scheme[] = {
+ DTB_DIR "bcm2835-rpi-zero.dtb",
false,
},
+ [0xa] = {
@@ -15,10 +15,10 @@ index 22e87a2..7da5213 100644
static const struct rpi_model rpi_models_old_scheme[] = {
diff --git a/include/configs/rpi.h b/include/configs/rpi.h
-index 4406366..15b5cc8 100644
+index 5caf90a..b673aa4 100644
--- a/include/configs/rpi.h
+++ b/include/configs/rpi.h
-@@ -103,11 +103,7 @@
+@@ -92,11 +92,8 @@
#endif
/* Console UART */
@@ -28,9 +28,10 @@ index 4406366..15b5cc8 100644
#define CONFIG_PL01X_SERIAL
-#endif
#define CONFIG_CONS_INDEX 0
- #define CONFIG_BAUDRATE 115200
++#define CONFIG_BAUDRATE 115200
-@@ -117,7 +113,7 @@
+ /* Console configuration */
+@@ -105,7 +101,7 @@
sizeof(CONFIG_SYS_PROMPT) + 16)
/* Environment */
@@ -39,7 +40,7 @@ index 4406366..15b5cc8 100644
#define CONFIG_ENV_IS_IN_FAT
#define FAT_ENV_INTERFACE "mmc"
#define FAT_ENV_DEVICE_AND_PART "0:1"
-@@ -125,7 +121,12 @@
+@@ -113,7 +109,12 @@
#define CONFIG_FAT_WRITE
#define CONFIG_ENV_VARS_UBOOT_CONFIG
#define CONFIG_SYS_LOAD_ADDR 0x1000000
@@ -53,7 +54,7 @@ index 4406366..15b5cc8 100644
/* Shell */
#define CONFIG_SYS_MAXARGS 16
-@@ -139,6 +140,7 @@
+@@ -123,6 +124,7 @@
#define CONFIG_SETUP_MEMORY_TAGS
#define CONFIG_CMDLINE_TAG
#define CONFIG_INITRD_TAG