From 4204309872da5cb401cbb2729d9e2d4869a87f42 Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Thu, 22 Oct 2020 14:58:56 +0900 Subject: agl-basesystem 0.1 --- external/meta-updater-raspberrypi/.gitlab-ci.yml | 58 +++++++++++++++++++++ external/meta-updater-raspberrypi/README.md | 24 +++++++-- external/meta-updater-raspberrypi/conf/layer.conf | 3 ++ .../0001-Add-rpi4-uart0-dtb-overlay.patch | 59 ++++++++++++++++++++++ .../linux/linux-raspberrypi/audio.patch | 13 +++++ .../linux/linux-raspberrypi_%.bbappend | 11 ++++ .../scripts/flash-image.sh | 17 +------ 7 files changed, 167 insertions(+), 18 deletions(-) create mode 100644 external/meta-updater-raspberrypi/.gitlab-ci.yml create mode 100644 external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-Add-rpi4-uart0-dtb-overlay.patch create mode 100644 external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/audio.patch (limited to 'external/meta-updater-raspberrypi') diff --git a/external/meta-updater-raspberrypi/.gitlab-ci.yml b/external/meta-updater-raspberrypi/.gitlab-ci.yml new file mode 100644 index 00000000..eb097fb6 --- /dev/null +++ b/external/meta-updater-raspberrypi/.gitlab-ci.yml @@ -0,0 +1,58 @@ +stages: + - docker + - checkout + - test + +variables: + # bitbake variables + BITBAKE_IMAGE: ${METAUPDATER_REGISTRY_IMAGE}:ci-master-bitbake + BITBAKE_CHECKOUT_IMAGE: ${METAUPDATER_REGISTRY_IMAGE}:ci-master-checkout + +include: + - project: 'olp/edge/ota/connect/client/meta-updater' + ref: 'master' + file: 'scripts/ci/gitlab/docker.yml' + - project: 'olp/edge/ota/connect/client/meta-updater' + ref: 'master' + file: 'scripts/ci/gitlab/checkout.yml' + - project: 'olp/edge/ota/connect/client/meta-updater' + ref: 'master' + file: 'scripts/ci/gitlab/tests.yml' + +Docker setup: + extends: .bb_docker_remote + + stage: docker + except: + - pushes + +Checkout: + extends: .bb_checkout + + stage: checkout + variables: + MANIFEST: thud + CURRENT_PROJECT: meta-updater-raspberrypi + except: + - pushes + +Build core-image-minimal (rpi): + extends: .bitbake + + stage: test + variables: + TEST_BUILD_DIR: 'build-core-image-minimal-rpi' + BITBAKE_TARGETS: 'core-image-minimal' + TEST_MACHINE: 'raspberrypi3' + except: + - pushes + +Oe-selftest rpi: + extends: .oe-selftest + + stage: test + variables: + TEST_BUILD_DIR: 'build-oe-rpi' + OE_SELFTESTS: 'updater_raspberrypi' + except: + - pushes diff --git a/external/meta-updater-raspberrypi/README.md b/external/meta-updater-raspberrypi/README.md index 3623a212..29ea2989 100644 --- a/external/meta-updater-raspberrypi/README.md +++ b/external/meta-updater-raspberrypi/README.md @@ -1,7 +1,25 @@ -# BSP layer for updating Raspberrypi with OSTree +# BSP layer for updating Raspberry Pi with OSTree -* OSTree bootloader integration for Raspberry Pi. Add it to BBLAYERS when using [meta-updater](https://github.com/advancedtelematic/meta-updater) with [Raspberry Pi](https://github.com/agherzan/meta-raspberrypi). -* Wi-Fi enablement for Raspberry Pi +OSTree bootloader integration for Raspberry Pi. Add it to BBLAYERS when using [meta-updater](https://github.com/advancedtelematic/meta-updater) with [Raspberry Pi](https://github.com/agherzan/meta-raspberrypi). + +For more documentation on using this layer and [HERE OTA Connect](https://connect.ota.here.com/), please see the [OTA Connect documentation portal](https://docs.ota.here.com/), in particular the guide on [building a Raspberry Pi image](https://docs.ota.here.com/ota-client/latest/build-raspberry.html). + +## Device tree configuration + +The Raspberry Pi firmware allows customization of the device tree with special entries in `/boot/config.txt`: +. + +This is not supported in this form when using meta-updater, as the device tree and eventual overlays are managed separately via u-boot and ostree. + +Thus, you will have to make the necessary changes directly in yocto and either: + +- patch the kernel sources to modify source dts +- patch the kernel sources to add overlay sources and add the corresponding binaries in `KERNEL_DEVICETREE` +- use a customized complete dtb and declare it with `EXTERNAL_KERNEL_DEVICETREE` + +You can see examples of the first two approaches in [the linux-raspberrypi bbappend](recipes-kernel/linux/linux-raspberrypi_%.bbappend). + +## Wi-Fi enablement for Raspberry Pi | Name | Default | Description | |---|---|---| diff --git a/external/meta-updater-raspberrypi/conf/layer.conf b/external/meta-updater-raspberrypi/conf/layer.conf index 6ae8c76e..6d3859bb 100644 --- a/external/meta-updater-raspberrypi/conf/layer.conf +++ b/external/meta-updater-raspberrypi/conf/layer.conf @@ -9,6 +9,9 @@ BBFILE_COLLECTIONS += "updater-raspberrypi" BBFILE_PATTERN_updater-raspberrypi = "^${LAYERDIR}/" BBFILE_PRIORITY_updater-raspberrypi = "7" +LAYERDEPENDS_updater-raspberrypi = "sota" +LAYERDEPENDS_updater-raspberrypi += "meta-python" +LAYERDEPENDS_updater-raspberrypi += "raspberrypi" LAYERSERIES_COMPAT_updater-raspberrypi = "thud" RPI_WIFI_ENABLE ?= "0" diff --git a/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-Add-rpi4-uart0-dtb-overlay.patch b/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-Add-rpi4-uart0-dtb-overlay.patch new file mode 100644 index 00000000..32731940 --- /dev/null +++ b/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-Add-rpi4-uart0-dtb-overlay.patch @@ -0,0 +1,59 @@ +From cea75af3d1cc86ea8dec19cfe3c817b7c7869037 Mon Sep 17 00:00:00 2001 +From: lbonn +Date: Fri, 13 Sep 2019 12:46:31 +0200 +Subject: [PATCH] Add rpi4 uart0 dtb overlay + +--- + arch/arm/boot/dts/overlays/Makefile | 2 ++ + .../boot/dts/overlays/uart0-rpi4-overlay.dts | 26 +++++++++++++++++++ + 2 files changed, 28 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/uart0-rpi4-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 6b4af500f51c..634a2f252b17 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -185,6 +185,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + w1-gpio-pullup.dtbo \ + wittypi.dtbo + ++dtbo-$(CONFIG_ARCH_BCM2835) += uart0-rpi4.dtbo ++ + targets += dtbs dtbs_install + targets += $(dtbo-y) + +diff --git a/arch/arm/boot/dts/overlays/uart0-rpi4-overlay.dts b/arch/arm/boot/dts/overlays/uart0-rpi4-overlay.dts +new file mode 100644 +index 000000000000..048ec5755f6a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/uart0-rpi4-overlay.dts +@@ -0,0 +1,26 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target = <&uart0>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ uart0_pins: uart0_pins { ++ brcm,pins = <30 31 32 33>; ++ brcm,function = <7>; ++ brcm,pull = <2 0 0 2>; ++ }; ++ }; ++ }; ++}; +-- +2.20.1 + diff --git a/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/audio.patch b/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/audio.patch new file mode 100644 index 00000000..cfa1b65a --- /dev/null +++ b/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi/audio.patch @@ -0,0 +1,13 @@ +diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi +index 6a82591c51d1..783b7306b861 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi +@@ -65,7 +65,7 @@ + audio: audio { + compatible = "brcm,bcm2835-audio"; + brcm,pwm-channels = <8>; +- status = "disabled"; ++ status = "okay"; + }; + + /* External sound card */ diff --git a/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend b/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend index e2e7e60b..1587fbe5 100644 --- a/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend +++ b/external/meta-updater-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend @@ -1,5 +1,16 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" +# dtoverlays and dtparam definitions in rpi's config.txt are ignored when using +# ostree integration. You will have to patch existing dts or add overlays in +# your layer to achieve the same results. +# As a common example, here is a patch to enable audio support. +# +# see README.md and https://github.com/advancedtelematic/meta-updater-raspberrypi/issues/23 for +# more details +SRC_URI_append = " ${@oe.utils.conditional('ENABLE_AUDIO', '1', 'file://audio.patch', '', d)}" + +SRC_URI_append_raspberrypi4 = " file://0001-Add-rpi4-uart0-dtb-overlay.patch" + do_configure_append_sota() { # ramblk for inird kernel_configure_variable BLK_DEV_RAM y diff --git a/external/meta-updater-raspberrypi/scripts/flash-image.sh b/external/meta-updater-raspberrypi/scripts/flash-image.sh index ef59eb37..aa4187b3 100755 --- a/external/meta-updater-raspberrypi/scripts/flash-image.sh +++ b/external/meta-updater-raspberrypi/scripts/flash-image.sh @@ -51,15 +51,12 @@ if [ -z "$1" ]; then echo " Usage: ./flash-configured-image.sh device [imagefile [force]]" echo "" echo "" - echo " device : The device name to flash. Must be a removable device." + echo " device : The device name to flash. Should be a removable device." echo " Example: sdb" echo "" echo " imagefile : An image file generated by bitbake (optional)." echo " Default: ./tmp/deploy/images/raspberrypi3/core-image-minimal-raspberrypi3.wic" echo "" - echo " force : 1 to skip the check if device is removeable." - echo " Default: 0" - echo "" echo " The following utilities are prerequisites:" echo "" echo " dd" @@ -75,22 +72,12 @@ set -euo pipefail DEVICE_TO_FLASH=$1 IMAGE_TO_FLASH="${2-./tmp/deploy/images/raspberrypi3/core-image-minimal-raspberrypi3.wic}" -FORCE_WRITE=${3-0} -DEVICE_IS_REMOVABLE=$(cat "/sys/block/$DEVICE_TO_FLASH/removable") - -if [[ $FORCE_WRITE != "1" && $DEVICE_IS_REMOVABLE != "1" ]]; then - echo "" - echo " For safety, this script will only flash removable block devices." - echo "" - echo " This check is implemented by reading /sys/block/$DEVICE_TO_FLASH/removable." - echo "" - exit 1 -fi echo " " echo " Writing image file: $IMAGE_TO_FLASH " echo " to device : $DEVICE_TO_FLASH " echo " " +echo "Please double-check the device name!" if ask "Do you want to continue?" N; then echo " " else -- cgit 1.2.3-korg