From 0a43cbdb053b3c6e128757c8b0e9e8e51e457497 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 14 Jun 2018 16:44:40 +0200 Subject: [PATCH 01/26] Update hassio-supervisor --- buildroot-external/apparmor/hassio-supervisor | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot-external/apparmor/hassio-supervisor b/buildroot-external/apparmor/hassio-supervisor index f4c735db6..c06a9dc49 100644 --- a/buildroot-external/apparmor/hassio-supervisor +++ b/buildroot-external/apparmor/hassio-supervisor @@ -22,6 +22,7 @@ profile hassio-supervisor flags=(attach_disconnected,mediate_deleted) { /** r, /tmp/** rw, /data/** rw, + /usr/lib/python{,3,3.[0-9]}/** mr, /{,var/}run/docker.sock rw, capability net_bind_service, From c657f6f3e7c9d934e24b4e327fa166d1803cb076 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sat, 16 Jun 2018 01:27:34 +0200 Subject: [PATCH 02/26] Ignore debug stack usage --- buildroot-external/kernel.config | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot-external/kernel.config b/buildroot-external/kernel.config index 0d526034c..5e10e7e52 100644 --- a/buildroot-external/kernel.config +++ b/buildroot-external/kernel.config @@ -97,3 +97,4 @@ CONFIG_EFI_PARTITION=y # CONFIG_LOGO is not set # CONFIG_VIRTUALIZATION is not set +# CONFIG_DEBUG_STACK_USAGE is not set From 49df049f2cf45034cd8b11ab7d469a7d074b00da Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sat, 16 Jun 2018 09:06:07 +0000 Subject: [PATCH 03/26] Change rauc mark handling --- .../hassos-supervisor.service.d/rauc.conf | 2 -- .../timers.target.wants/rauc-good.timer | 1 - .../timers.target.wants/rauc-mark.timer | 1 + .../lib/systemd/system/hassos-expand.service | 2 ++ .../usr/lib/systemd/system/rauc-bad.service | 10 ------- .../{rauc-good.service => rauc-mark.service} | 3 +-- .../{rauc-good.timer => rauc-mark.timer} | 0 .../usr/lib/systemd/system/zram-swap.service | 2 ++ .../usr/lib/systemd/system/zram-tmp.service | 2 ++ .../usr/lib/systemd/system/zram-var.service | 2 ++ .../rootfs-overlay/usr/sbin/hassos-rate | 26 +++++++++++++++++++ 11 files changed, 36 insertions(+), 15 deletions(-) delete mode 100644 buildroot-external/rootfs-overlay/etc/systemd/system/hassos-supervisor.service.d/rauc.conf delete mode 120000 buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-good.timer create mode 120000 buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-mark.timer delete mode 100644 buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-bad.service rename buildroot-external/rootfs-overlay/usr/lib/systemd/system/{rauc-good.service => rauc-mark.service} (58%) rename buildroot-external/rootfs-overlay/usr/lib/systemd/system/{rauc-good.timer => rauc-mark.timer} (100%) create mode 100755 buildroot-external/rootfs-overlay/usr/sbin/hassos-rate diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-supervisor.service.d/rauc.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-supervisor.service.d/rauc.conf deleted file mode 100644 index e001464d1..000000000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-supervisor.service.d/rauc.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Unit] -OnFailure=rauc-bad.service diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-good.timer b/buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-good.timer deleted file mode 120000 index d010b7029..000000000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-good.timer +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/systemd/system/rauc-good.timer \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-mark.timer b/buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-mark.timer new file mode 120000 index 000000000..bbdfaf738 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/timers.target.wants/rauc-mark.timer @@ -0,0 +1 @@ +/usr/lib/systemd/system/rauc-mark.timer \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-expand.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-expand.service index b916789bf..cc50a0bf2 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-expand.service +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-expand.service @@ -2,6 +2,8 @@ Description=HassOS data resizing DefaultDependencies=no Before=mnt-data.mount +RefuseManualStart=true +RefuseManualStop=true [Service] Type=oneshot diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-bad.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-bad.service deleted file mode 100644 index baf737fe9..000000000 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-bad.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=HassOS rauc bad -Requires=rauc.service -RefuseManualStart=true -RefuseManualStop=true - -[Service] -Type=oneshot -ExecStart=/usr/bin/rauc status mark-bad -ExecStartPost=/usr/bin/systemctl reboot diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-good.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-mark.service similarity index 58% rename from buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-good.service rename to buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-mark.service index 1e7935471..01d62f8c6 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-good.service +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-mark.service @@ -1,10 +1,9 @@ [Unit] Description=HassOS rauc good -Requires=hassos-supervisor.service rauc.service RefuseManualStart=true RefuseManualStop=true [Service] Type=oneshot -ExecStart=/usr/bin/rauc status mark-good +ExecStart=/usr/sbin/hassos-rate RemainAfterExit=true diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-good.timer b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-mark.timer similarity index 100% rename from buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-good.timer rename to buildroot-external/rootfs-overlay/usr/lib/systemd/system/rauc-mark.timer diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-swap.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-swap.service index 2f340f0d6..93cad3868 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-swap.service +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-swap.service @@ -2,6 +2,8 @@ Description=HassOS ZRAM swap DefaultDependencies=no Before=dev-zram0.swap +RefuseManualStart=true +RefuseManualStop=true [Service] Type=oneshot diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-tmp.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-tmp.service index a7a6a5edc..b4e9d6862 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-tmp.service +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-tmp.service @@ -2,6 +2,8 @@ Description=HassOS ZRAM tmp DefaultDependencies=no Before=tmp.mount +RefuseManualStart=true +RefuseManualStop=true [Service] Type=oneshot diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-var.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-var.service index 89640cd81..410f9b6fd 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-var.service +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/zram-var.service @@ -2,6 +2,8 @@ Description=HassOS ZRAM var DefaultDependencies=no Before=var.mount +RefuseManualStart=true +RefuseManualStop=true [Service] Type=oneshot diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate b/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate new file mode 100755 index 000000000..4d79724df --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + + +function mark_good() { + rauc status mark-good + exit 0 +} + +function mark_bad() { + rauc status mark-bad + exit 0 +} + +# Docker state +if ! systemctl -q is-active docker; then + mark_bad +fi + +# Docker state +if ! systemctl -q is-active hassos-supervisor; then + mark_bad +fi + +mark_good + From 1a3d063fec5c3c512cefdd50d1df25b950748551 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sat, 16 Jun 2018 22:24:36 +0200 Subject: [PATCH 04/26] Reboot after mark partition as bad --- buildroot-external/rootfs-overlay/usr/sbin/hassos-rate | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate b/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate index 4d79724df..79bbe662a 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate @@ -9,9 +9,11 @@ function mark_good() { function mark_bad() { rauc status mark-bad - exit 0 + systemctl reboot } +#### Check system #### + # Docker state if ! systemctl -q is-active docker; then mark_bad @@ -23,4 +25,3 @@ if ! systemctl -q is-active hassos-supervisor; then fi mark_good - From fa44e0a7fd60289471a9f0f1a7c3e92381bf4e13 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 17 Jun 2018 01:25:47 +0200 Subject: [PATCH 05/26] cleanup --- .../etc/systemd/system/local-fs.target.wants/mnt-state.mount | 1 - 1 file changed, 1 deletion(-) delete mode 120000 buildroot-external/rootfs-overlay/etc/systemd/system/local-fs.target.wants/mnt-state.mount diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/local-fs.target.wants/mnt-state.mount b/buildroot-external/rootfs-overlay/etc/systemd/system/local-fs.target.wants/mnt-state.mount deleted file mode 120000 index b6842350e..000000000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/local-fs.target.wants/mnt-state.mount +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/systemd/system/mnt-state.mount \ No newline at end of file From 2abbbbd1fabfa1ff823ec8e979fcf6b53b4b8bad Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 20 Jun 2018 10:41:45 +0000 Subject: [PATCH 06/26] Cleanup uboot handling like linux kernel --- .../board/raspberrypi/rpi/uboot.config | 3 --- .../board/raspberrypi/rpi0-w/uboot.config | 3 --- .../board/raspberrypi/rpi2/uboot.config | 4 --- .../board/raspberrypi/rpi3-64/uboot.config | 6 ----- .../board/raspberrypi/rpi3/uboot.config | 6 ----- .../board/raspberrypi/uboot.config | 27 +++---------------- buildroot-external/bootloader/uboot.config | 3 --- buildroot-external/configs/rpi0_w_defconfig | 3 +-- buildroot-external/configs/rpi2_defconfig | 3 +-- buildroot-external/configs/rpi3_64_defconfig | 3 +-- buildroot-external/configs/rpi3_defconfig | 3 +-- buildroot-external/configs/rpi_defconfig | 3 +-- 12 files changed, 8 insertions(+), 59 deletions(-) delete mode 100644 buildroot-external/board/raspberrypi/rpi/uboot.config delete mode 100644 buildroot-external/board/raspberrypi/rpi0-w/uboot.config delete mode 100644 buildroot-external/board/raspberrypi/rpi2/uboot.config delete mode 100644 buildroot-external/board/raspberrypi/rpi3-64/uboot.config delete mode 100644 buildroot-external/board/raspberrypi/rpi3/uboot.config diff --git a/buildroot-external/board/raspberrypi/rpi/uboot.config b/buildroot-external/board/raspberrypi/rpi/uboot.config deleted file mode 100644 index b2a22b5e1..000000000 --- a/buildroot-external/board/raspberrypi/rpi/uboot.config +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_TARGET_RPI=y -CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b" -CONFIG_SYS_TEXT_BASE=0x00008000 diff --git a/buildroot-external/board/raspberrypi/rpi0-w/uboot.config b/buildroot-external/board/raspberrypi/rpi0-w/uboot.config deleted file mode 100644 index 0b4f39372..000000000 --- a/buildroot-external/board/raspberrypi/rpi0-w/uboot.config +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_TARGET_RPI_0_W=y -CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-zero-w" -CONFIG_SYS_TEXT_BASE=0x00008000 diff --git a/buildroot-external/board/raspberrypi/rpi2/uboot.config b/buildroot-external/board/raspberrypi/rpi2/uboot.config deleted file mode 100644 index 4b9c35d07..000000000 --- a/buildroot-external/board/raspberrypi/rpi2/uboot.config +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_TARGET_RPI_2=y -CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b" -CONFIG_SYS_TEXT_BASE=0x00008000 -CONFIG_SYS_TEXT_BASE=0x00008000 diff --git a/buildroot-external/board/raspberrypi/rpi3-64/uboot.config b/buildroot-external/board/raspberrypi/rpi3-64/uboot.config deleted file mode 100644 index 550b90c67..000000000 --- a/buildroot-external/board/raspberrypi/rpi3-64/uboot.config +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_TARGET_RPI_3=y -CONFIG_SYS_MALLOC_F_LEN=0x2000 -CONFIG_SYS_TEXT_BASE=0x00080000 -CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" -CONFIG_PHYLIB=y -CONFIG_USB_ETHER_LAN78XX=y diff --git a/buildroot-external/board/raspberrypi/rpi3/uboot.config b/buildroot-external/board/raspberrypi/rpi3/uboot.config deleted file mode 100644 index 1290a4ba9..000000000 --- a/buildroot-external/board/raspberrypi/rpi3/uboot.config +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_TARGET_RPI_3_32B=y -CONFIG_SYS_MALLOC_F_LEN=0x2000 -CONFIG_SYS_TEXT_BASE=0x00008000 -CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" -CONFIG_PHYLIB=y -CONFIG_USB_ETHER_LAN78XX=y diff --git a/buildroot-external/board/raspberrypi/uboot.config b/buildroot-external/board/raspberrypi/uboot.config index f9c0cf01c..0043ca31e 100644 --- a/buildroot-external/board/raspberrypi/uboot.config +++ b/buildroot-external/board/raspberrypi/uboot.config @@ -1,24 +1,3 @@ -CONFIG_ARM=y -CONFIG_ARCH_BCM283X=y -CONFIG_OF_BOARD_SETUP=y -# CONFIG_CMD_FLASH is not set -CONFIG_CMD_GPIO=y -CONFIG_CMD_MMC=y -CONFIG_CMD_USB=y -CONFIG_OF_EMBED=y -CONFIG_DM_KEYBOARD=y -CONFIG_DM_MMC=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_BCM2835=y -CONFIG_DM_ETH=y -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_GENERIC is not set -# CONFIG_REQUIRE_SERIAL_CONSOLE is not set -CONFIG_USB=y -CONFIG_DM_USB=y -CONFIG_USB_DWC2=y -CONFIG_USB_KEYBOARD=y -CONFIG_USB_HOST_ETHER=y -CONFIG_USB_ETHER_SMSC95XX=y -CONFIG_DM_VIDEO=y -CONFIG_PHYS_TO_BUS=y +# CONFIG_USB_STORAGE is not set +# CONFIG_ENV_FAT_INTERFACE is not set +# CONFIG_ENV_FAT_DEVICE_AND_PART is not set diff --git a/buildroot-external/bootloader/uboot.config b/buildroot-external/bootloader/uboot.config index de619a0f3..ab447877b 100644 --- a/buildroot-external/bootloader/uboot.config +++ b/buildroot-external/bootloader/uboot.config @@ -13,7 +13,4 @@ CONFIG_FS_EXT4=y # CONFIG_ENV_IS_IN_EXT4 is not set CONFIG_ENV_IS_IN_MMC=y CONFIG_CONSOLE_SCROLL_LINES=10 -CONFIG_SYS_WHITE_ON_BLACK=y -CONFIG_REGEX=y -CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER is not set diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index fca796cb9..fae1ecff8 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -69,8 +69,7 @@ BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2018.05" -BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y -BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi0-w/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_0_w" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/uboot.config" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_BOOT_SCRIPT=y diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index 476193d44..a96cebdd2 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -68,8 +68,7 @@ BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2018.05" -BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y -BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi2/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_2" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/uboot.config" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_BOOT_SCRIPT=y diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index e3bc7ba6d..88340db37 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -69,8 +69,7 @@ BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2018.05" -BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y -BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi3-64/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_3" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/uboot.config" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_BOOT_SCRIPT=y diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index 998a089d8..39c1b814c 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -69,8 +69,7 @@ BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2018.05" -BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y -BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi3/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_3_32b" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/uboot.config" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_BOOT_SCRIPT=y diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index 1e3880894..b9a25400c 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -68,8 +68,7 @@ BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2018.05" -BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y -BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/uboot.config" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_BOOT_SCRIPT=y From ed5a5033dde54b027048137ba4ae58e49bf5646d Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 20 Jun 2018 13:28:30 +0000 Subject: [PATCH 07/26] Use apparmor from s3 --- buildroot-external/apparmor/hassio-supervisor | 78 ------------------- buildroot-external/configs/ova_defconfig | 1 + buildroot-external/configs/rpi0_w_defconfig | 1 + buildroot-external/configs/rpi2_defconfig | 1 + buildroot-external/configs/rpi3_64_defconfig | 1 + buildroot-external/configs/rpi3_defconfig | 1 + buildroot-external/configs/rpi_defconfig | 1 + buildroot-external/package/hassos/Config.in | 12 ++- .../package/hassos/builder/Dockerfile | 2 +- .../package/hassos/builder/hostapp.sh | 21 ++++- buildroot-external/package/hassos/hassos.mk | 3 +- 11 files changed, 40 insertions(+), 82 deletions(-) delete mode 100644 buildroot-external/apparmor/hassio-supervisor diff --git a/buildroot-external/apparmor/hassio-supervisor b/buildroot-external/apparmor/hassio-supervisor deleted file mode 100644 index c06a9dc49..000000000 --- a/buildroot-external/apparmor/hassio-supervisor +++ /dev/null @@ -1,78 +0,0 @@ -#include - -profile hassio-supervisor flags=(attach_disconnected,mediate_deleted) { - #include - #include - - network, - deny network raw, - - signal (send) set=(kill,term), - - /bin/busybox ix, - /usr/bin/python{,3,3.[0-9]} ix, - /usr/bin/git cx, - /usr/bin/socat cx, - /usr/bin/gdbus cx, - - deny /proc/** wl, - deny /root/** wl, - deny /sys/** wl, - - /** r, - /tmp/** rw, - /data/** rw, - /usr/lib/python{,3,3.[0-9]}/** mr, - /{,var/}run/docker.sock rw, - - capability net_bind_service, - - profile /usr/bin/socat flags=(attach_disconnected,mediate_deleted) { - #include - - network inet udp, - network inet tcp, - - deny network raw, - deny network packet, - - signal (receive) set=(kill,term), - capability net_bind_service, - - /lib/* mr, - /usr/bin/socat mr, - } - - profile /usr/bin/gdbus flags=(attach_disconnected,mediate_deleted) { - #include - #include - - unix (send, receive) type=stream, - - /usr/bin/gdbus mr, - /lib/* mr, - /** r, - - /{,var/}run/dbus/system_bus_socket rw, - } - - profile /usr/bin/git flags=(attach_disconnected,mediate_deleted) { - #include - - network, - deny network raw, - - /bin/busybox ix, - /usr/bin/git mr, - /usr/libexec/git-core/* ix, - - deny /data/homeassistant rw, - deny /data/ssl rw, - - /** r, - /lib/* mr, - /data/addons/** lrw, - - capability dac_override, - } -} diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index c44c5fc42..55adda9fc 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -75,6 +75,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/amd64-hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/qemux86-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" +BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/amd64-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="3" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index fae1ecff8..357b44b41 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -84,6 +84,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" +BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="3" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index a96cebdd2..6acf08a0a 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -83,6 +83,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi2-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" +BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="3" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index 88340db37..9aa4db114 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -84,6 +84,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/aarch64-hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" +BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/aarch64-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="3" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index 39c1b814c..ad7e73aae 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -84,6 +84,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" +BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="3" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index b9a25400c..c81d34f83 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -83,6 +83,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" +BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="3" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" diff --git a/buildroot-external/package/hassos/Config.in b/buildroot-external/package/hassos/Config.in index 6d5c8298d..098988066 100644 --- a/buildroot-external/package/hassos/Config.in +++ b/buildroot-external/package/hassos/Config.in @@ -28,6 +28,11 @@ config BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE help AppArmor profile for supervisor. +config BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL + string "AppArmor supervisor profile URL" + help + AppArmor profile for supervisor url. + config BR2_PACKAGE_HASSOS_CLI string "cli docker image" help @@ -48,9 +53,14 @@ config BR2_PACKAGE_HASSOS_CLI_PROFILE help AppArmor profile for cli. +config BR2_PACKAGE_HASSOS_CLI_PROFILE_URL + string "AppArmor cli profile url" + help + AppArmor profile for cli url. + config BR2_PACKAGE_HASSOS_APPARMOR_DIR string "AppArmor profiles folder" help - AppArmor profiles folder for supervisor. + AppArmor profiles folder for HassOS. endif diff --git a/buildroot-external/package/hassos/builder/Dockerfile b/buildroot-external/package/hassos/builder/Dockerfile index e2ca34998..f97a86b1d 100644 --- a/buildroot-external/package/hassos/builder/Dockerfile +++ b/buildroot-external/package/hassos/builder/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.7 # Install packages RUN apk add --no-cache \ - bash coreutils e2fsprogs + bash coreutils e2fsprogs curl RUN apk add --no-cache --repository http://nl.alpinelinux.org/alpine/v3.7/community \ docker diff --git a/buildroot-external/package/hassos/builder/hostapp.sh b/buildroot-external/package/hassos/builder/hostapp.sh index f140bc989..b0c1eac3f 100755 --- a/buildroot-external/package/hassos/builder/hostapp.sh +++ b/buildroot-external/package/hassos/builder/hostapp.sh @@ -5,10 +5,12 @@ SUPERVISOR="" SUPERVISOR_VERSION="" SUPERVISOR_ARGS="" SUPERVISOR_PROFILE="" +SUPERVISOR_PROFILE_URL="" CLI="" CLI_VERSION="" CLI_ARGS="" CLI_PROFILE="" +CLI_PROFILE_URL="" APPARMOR="" DATA_IMG="/export/data.ext4" @@ -32,6 +34,10 @@ while [[ $# -gt 0 ]]; do SUPERVISOR_PROFILE=$2 shift ;; + --supervisor-profile-url) + SUPERVISOR_PROFILE_URL=$2 + shift + ;; --cli) CLI=$2 shift @@ -48,6 +54,10 @@ while [[ $# -gt 0 ]]; do CLI_PROFILE=$2 shift ;; + --cli-profile-url) + CLI_PROFILE_URL=$2 + shift + ;; --apparmor) APPARMOR=$2 shift @@ -106,7 +116,16 @@ EOF # Setup AppArmor if [ ! -z "${APPARMOR}" ]; then mkdir -p /mnt/data/${APPARMOR} - cp -f /apparmor/* /mnt/data/${APPARMOR}/ + + # Supervisor + if [ ! -z "${SUPERVISOR_PROFILE_URL}" ]; then + curl -L -o /mnt/data/${APPARMOR}/${SUPERVISOR_PROFILE} ${SUPERVISOR_PROFILE_URL} + fi + + # CLI + if [ ! -z "${CLI_PROFILE_URL}" ]; then + curl -L -o /mnt/data/${APPARMOR}/${CLI_PROFILE} ${CLI_PROFILE_URL} + fi fi # Finish diff --git a/buildroot-external/package/hassos/hassos.mk b/buildroot-external/package/hassos/hassos.mk index dc32946a9..68f9946c6 100644 --- a/buildroot-external/package/hassos/hassos.mk +++ b/buildroot-external/package/hassos/hassos.mk @@ -17,16 +17,17 @@ endef define HASSOS_INSTALL_TARGET_CMDS docker run --rm --privileged \ -v $(BINARIES_DIR):/export \ - -v $(BR2_EXTERNAL_HASSOS_PATH)/apparmor:/apparmor \ hassos-hostapps \ --supervisor $(BR2_PACKAGE_HASSOS_SUPERVISOR) \ --supervisor-version $(BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION) \ --supervisor-args $(BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS) \ --supervisor-profile $(BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE) \ + --supervisor-profile-url $(BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL) \ --cli $(BR2_PACKAGE_HASSOS_CLI) \ --cli-version $(BR2_PACKAGE_HASSOS_CLI_VERSION) \ --cli-args $(BR2_PACKAGE_HASSOS_CLI_ARGS) \ --cli-profile $(BR2_PACKAGE_HASSOS_CLI_PROFILE) \ + --cli-profile-url $(BR2_PACKAGE_HASSOS_CLI_PROFILE_URL) \ --apparmor $(BR2_PACKAGE_HASSOS_APPARMOR_DIR) endef From 56afd74720ba0628285dfdf098dfb9ddb26e7b3a Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 21 Jun 2018 09:15:28 +0000 Subject: [PATCH 08/26] Don't install kernel to rootfs --- buildroot-external/configs/ova_defconfig | 1 - buildroot-external/configs/rpi0_w_defconfig | 1 - buildroot-external/configs/rpi2_defconfig | 1 - buildroot-external/configs/rpi3_64_defconfig | 1 - buildroot-external/configs/rpi3_defconfig | 1 - buildroot-external/configs/rpi_defconfig | 1 - 6 files changed, 6 deletions(-) diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index 55adda9fc..dbfd4bf40 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -22,7 +22,6 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.14.41" BR2_LINUX_KERNEL_DEFCONFIG="x86_64" BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel.config $(BR2_EXTERNAL_HASSOS_PATH)/board/ova/kernel.config" BR2_LINUX_KERNEL_LZ4=y -BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config" diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index 357b44b41..e0e92a70b 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -27,7 +27,6 @@ BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel.confi BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-0-w" -BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config" diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index 6acf08a0a..e5453182c 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -27,7 +27,6 @@ BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel.confi BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2709-rpi-2-b" -BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config" diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index 9aa4db114..3b2073132 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -27,7 +27,6 @@ BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel.confi BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2710-rpi-3-b broadcom/bcm2837-rpi-3-b broadcom/bcm2710-rpi-3-b-plus" -BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config" diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index ad7e73aae..753a4ed2d 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -27,7 +27,6 @@ BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel.confi BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3" -BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config" diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index c81d34f83..ba5e09aa4 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -27,7 +27,6 @@ BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel.confi BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm" -BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_HASSOS_PATH)/busybox.config" From 161c8624e03fffa8664f5e83744d760ec70bce25 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 21 Jun 2018 11:17:23 +0200 Subject: [PATCH 09/26] Bump version to 0.7 --- buildroot-external/info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot-external/info b/buildroot-external/info index 95747de1a..445b1d82e 100644 --- a/buildroot-external/info +++ b/buildroot-external/info @@ -1,5 +1,5 @@ VERSION_MAJOR=0 -VERSION_BUILD=6 +VERSION_BUILD=7 HASSOS_NAME="HassOS" HASSOS_ID="hassos" From 3aaadf3f5fa097f13e3edc6dc889abac7f25ed3f Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 21 Jun 2018 11:37:10 +0000 Subject: [PATCH 10/26] Update supervisor 108 --- buildroot-external/configs/ova_defconfig | 2 +- buildroot-external/configs/rpi0_w_defconfig | 2 +- buildroot-external/configs/rpi2_defconfig | 2 +- buildroot-external/configs/rpi3_64_defconfig | 2 +- buildroot-external/configs/rpi3_defconfig | 2 +- buildroot-external/configs/rpi_defconfig | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index dbfd4bf40..e6582f86b 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -71,7 +71,7 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/amd64-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/qemux86-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index e0e92a70b..3d8eeb5a0 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -80,7 +80,7 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index e5453182c..bb619557b 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -79,7 +79,7 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi2-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index 3b2073132..1b52033af 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -80,7 +80,7 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/aarch64-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index 753a4ed2d..2ccb033e0 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -80,7 +80,7 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index ba5e09aa4..189abab69 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -79,7 +79,7 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="107" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" From e30e15dc535e1194af2cf0c0ed5a3a7e27cbbb41 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 21 Jun 2018 15:49:37 +0200 Subject: [PATCH 11/26] fix rauc name --- buildroot-external/rootfs-overlay/usr/sbin/hassos-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config index 7531216ac..7b5bdd3ce 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config @@ -41,10 +41,10 @@ fi ## # Firmware update -if ls /mnt/config/*.rauc > /dev/null; then +if ls /mnt/config/*.raucb > /dev/null; then echo "[Info] Performe a firmware update" - rauc_filename=$(ls /mnt/config/*.rauc | head -n 1) + rauc_filename=$(ls /mnt/config/*.raucb | head -n 1) rauc install /mnt/config/$rauc_filename fi From 1e30f5120c55739be36a0566dcaad16d0b2889e3 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 21 Jun 2018 15:50:01 +0200 Subject: [PATCH 12/26] Update configuration.md --- Documentation/configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/configuration.md b/Documentation/configuration.md index 20a2dd53d..7af004b42 100644 --- a/Documentation/configuration.md +++ b/Documentation/configuration.md @@ -7,13 +7,13 @@ You can format a USB stick with FAT32 and name it with `hassos-config`. The layo network/ modules/ known_hosts -hassos-xy.rauc +hassos-xy.raucb ``` - On `network` folder can hold any kind of NetworkManager connections files. - The folder `modules` is for modules-load configuration files. - `known_hosts` file activate debug SSH access of port `22222`. -- For firmware updates you can but the `hassos-*.rauc` OTA update they should be install. +- For firmware updates you can but the `hassos-*.raucb` OTA update they should be install. ## Local From 17ca2ccf0a0e87fd40f1bfc685b39d16e0bb8131 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 24 Jun 2018 00:11:54 +0200 Subject: [PATCH 13/26] Create OTA updater (#34) * Create OTA updater * Create .gitignore * Update build-all.sh * Update hdd-image.sh * Update ota.sh * Update ota.sh * Update ota.sh * Update ota.sh * Update post-image.sh * Create name.sh * Update name.sh * Update post-build.sh * Update name.sh * Update post-image.sh * Update ota.sh * Update hdd-image.sh * Update post-image.sh * Update name.sh * Update ota.sh * Update post-image.sh * Update hdd-image.sh * Update hdd-image.sh * Update hdd-image.sh * Update post-image.sh * Update post-image.sh * Update hdd-image.sh * Update hdd-image.sh * Update post-image.sh * Update post-image.sh * Update post-image.sh * Update info * Update info * Update info * Update info * Update info * Update info * Rename buildroot-external/board/raspberrypi/uboot-boot64.sh to buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh * Update rpi3_64_defconfig * Update hdd-image.sh * Update ota.sh * Update post-image.sh * Update post-image.sh * Fix building Signed-off-by: Pascal Vizeli * Fix building v2 Signed-off-by: Pascal Vizeli --- .gitignore | 2 + buildroot-external/board/ova/info | 1 + buildroot-external/board/ova/post-image.sh | 19 ++++--- .../board/raspberrypi/post-image.sh | 22 +++----- buildroot-external/board/raspberrypi/rpi/info | 1 + .../board/raspberrypi/rpi0-w/info | 1 + .../board/raspberrypi/rpi2/info | 1 + .../board/raspberrypi/rpi3-64/info | 1 + .../uboot-boot.sh} | 0 .../board/raspberrypi/rpi3/info | 1 + buildroot-external/configs/rpi3_64_defconfig | 2 +- buildroot-external/scripts/hdd-image.sh | 55 ++++++++++++++----- buildroot-external/scripts/name.sh | 13 +++++ buildroot-external/scripts/ota.sh | 32 +++++++++++ buildroot-external/scripts/post-build.sh | 4 +- scripts/build-all.sh | 2 +- 16 files changed, 118 insertions(+), 39 deletions(-) create mode 100644 .gitignore rename buildroot-external/board/raspberrypi/{uboot-boot64.sh => rpi3-64/uboot-boot.sh} (100%) create mode 100644 buildroot-external/scripts/name.sh create mode 100644 buildroot-external/scripts/ota.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..34991bff5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/release +*.pem diff --git a/buildroot-external/board/ova/info b/buildroot-external/board/ova/info index 2ce3bc85c..1c591f9df 100644 --- a/buildroot-external/board/ova/info +++ b/buildroot-external/board/ova/info @@ -2,3 +2,4 @@ BOARD_ID=ova BOARD_NAME="Open Virtual Appliance" CHASSIS=vm BOOTLOADER=barebox +KERNEL_FILE=bzImage diff --git a/buildroot-external/board/ova/post-image.sh b/buildroot-external/board/ova/post-image.sh index 1ad965289..9a38c47fa 100755 --- a/buildroot-external/board/ova/post-image.sh +++ b/buildroot-external/board/ova/post-image.sh @@ -6,12 +6,11 @@ BOARD_DIR=${2} BOOT_DATA=${BINARIES_DIR}/boot . ${SCRIPT_DIR}/hdd-image.sh +. ${SCRIPT_DIR}/name.sh +. ${SCRIPT_DIR}/ota.sh . ${BR2_EXTERNAL_HASSOS_PATH}/info . ${BOARD_DIR}/info -# Filename -IMAGE_FILE=${HASSOS_ID}_${BOARD_ID}-${VERSION_MAJOR}.${VERSION_BUILD}.vmdk - # Init boot data rm -rf ${BOOT_DATA} mkdir -p ${BOOT_DATA}/EFI/BOOT @@ -23,10 +22,14 @@ cp ${BR2_EXTERNAL_HASSOS_PATH}/misc/barebox-state-efi.dtb ${BOOT_DATA}/EFI/bareb echo "console=tty1" > ${BOOT_DATA}/cmdline.txt # Create other layers -create_boot_image ${BINARIES_DIR} -create_overlay_image ${BINARIES_DIR} -create_kernel_image ${BINARIES_DIR} bzImage +prepare_disk_image -create_disk_image ${BINARIES_DIR} ${BINARIES_DIR}/harddisk.img 6 +# Create disk images +create_disk_image 6 +convert_disk_image_vdmk -qemu-img convert -O vmdk ${BINARIES_DIR}/harddisk.img ${BINARIES_DIR}/${IMAGE_FILE} +# Generate OTA update file +rm -rf ${BOOT_DATA}/EFI/barebox +rm -f ${BOOT_DATA}/cmdline.txt + +create_ota_update bzImage diff --git a/buildroot-external/board/raspberrypi/post-image.sh b/buildroot-external/board/raspberrypi/post-image.sh index 409481fdc..655967f08 100755 --- a/buildroot-external/board/raspberrypi/post-image.sh +++ b/buildroot-external/board/raspberrypi/post-image.sh @@ -6,12 +6,10 @@ BOARD_DIR=${2} BOOT_DATA=${BINARIES_DIR}/boot . ${SCRIPT_DIR}/hdd-image.sh +. ${SCRIPT_DIR}/name.sh . ${BR2_EXTERNAL_HASSOS_PATH}/info . ${BOARD_DIR}/info -# Filename -IMAGE_FILE=${BINARIES_DIR}/${HASSOS_ID}_${BOARD_ID}-${VERSION_MAJOR}.${VERSION_BUILD}.img - # Init boot data rm -rf ${BOOT_DATA} mkdir -p ${BOOT_DATA} @@ -38,18 +36,16 @@ echo "dwc_otg.lpm_enable=0 console=tty1" > ${BOOT_DATA}/cmdline.txt # Enable 64bit support if [ "${BOARD_ID}" == "rpi3-64" ]; then echo "arm_64bit=1" >> ${BOOT_DATA}/config.txt - KERNEL_NAME="Image" -else - KERNEL_NAME="zImage" fi # Create other layers -create_boot_image ${BINARIES_DIR} -create_overlay_image ${BINARIES_DIR} -create_kernel_image ${BINARIES_DIR} ${KERNEL_NAME} +prepare_disk_image -create_disk_image ${BINARIES_DIR} ${IMAGE_FILE} 2 -fix_disk_image_mbr ${IMAGE_FILE} +create_disk_image 2 +fix_disk_image_mbr +convert_disk_image_gz -rm -rf ${IMAGE_FILE}.gz -gzip --best ${IMAGE_FILE} +# Generate OTA update file +rm -f ${BOOT_DATA}/*.txt + +create_ota_update ${KERNEL_NAME} diff --git a/buildroot-external/board/raspberrypi/rpi/info b/buildroot-external/board/raspberrypi/rpi/info index dcdcd912b..9e6bfaab4 100644 --- a/buildroot-external/board/raspberrypi/rpi/info +++ b/buildroot-external/board/raspberrypi/rpi/info @@ -2,3 +2,4 @@ BOARD_ID=rpi BOARD_NAME="RaspberryPi" CHASSIS=embedded BOOTLOADER=uboot +KERNEL_FILE=zImage diff --git a/buildroot-external/board/raspberrypi/rpi0-w/info b/buildroot-external/board/raspberrypi/rpi0-w/info index 80244fe15..dbba2f4a2 100644 --- a/buildroot-external/board/raspberrypi/rpi0-w/info +++ b/buildroot-external/board/raspberrypi/rpi0-w/info @@ -2,3 +2,4 @@ BOARD_ID=rpi0-w BOARD_NAME="RaspberryPi Zero-W" CHASSIS=embedded BOOTLOADER=uboot +KERNEL_FILE=zImage diff --git a/buildroot-external/board/raspberrypi/rpi2/info b/buildroot-external/board/raspberrypi/rpi2/info index ed3a68dcf..25ea4007a 100644 --- a/buildroot-external/board/raspberrypi/rpi2/info +++ b/buildroot-external/board/raspberrypi/rpi2/info @@ -2,3 +2,4 @@ BOARD_ID=rpi2 BOARD_NAME="RaspberryPi 2" CHASSIS=embedded BOOTLOADER=uboot +KERNEL_FILE=zImage diff --git a/buildroot-external/board/raspberrypi/rpi3-64/info b/buildroot-external/board/raspberrypi/rpi3-64/info index c794e9dba..6371c6119 100644 --- a/buildroot-external/board/raspberrypi/rpi3-64/info +++ b/buildroot-external/board/raspberrypi/rpi3-64/info @@ -2,3 +2,4 @@ BOARD_ID=rpi3-64 BOARD_NAME="RaspberryPi 3 64bit" CHASSIS=embedded BOOTLOADER=uboot +KERNEL_FILE=Image diff --git a/buildroot-external/board/raspberrypi/uboot-boot64.sh b/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh similarity index 100% rename from buildroot-external/board/raspberrypi/uboot-boot64.sh rename to buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh diff --git a/buildroot-external/board/raspberrypi/rpi3/info b/buildroot-external/board/raspberrypi/rpi3/info index c6be500c9..118931786 100644 --- a/buildroot-external/board/raspberrypi/rpi3/info +++ b/buildroot-external/board/raspberrypi/rpi3/info @@ -2,3 +2,4 @@ BOARD_ID=rpi3 BOARD_NAME="RaspberryPi 3" CHASSIS=embedded BOOTLOADER=uboot +KERNEL_FILE=zImage diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index 1b52033af..63da4555c 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -72,7 +72,7 @@ BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_3" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/uboot.config" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_BOOT_SCRIPT=y -BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/uboot-boot64.sh" +BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rpi3-64/uboot-boot.sh" BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_E2FSPROGS=y BR2_PACKAGE_HOST_GPTFDISK=y diff --git a/buildroot-external/scripts/hdd-image.sh b/buildroot-external/scripts/hdd-image.sh index 911551ae1..772988406 100755 --- a/buildroot-external/scripts/hdd-image.sh +++ b/buildroot-external/scripts/hdd-image.sh @@ -18,8 +18,8 @@ DATA_SIZE=1G function create_boot_image() { - local boot_data="${1}/boot" - local boot_img="${1}/boot.vfat" + local boot_data="${BINARIES_DIR}/boot" + local boot_img="${BINARIES_DIR}/boot.vfat" echo "mtools_skip_check=1" > ~/.mtoolsrc dd if=/dev/zero of=${boot_img} bs=${BOOT_SIZE} count=1 @@ -29,7 +29,7 @@ function create_boot_image() { function create_overlay_image() { - local overlay_img="${1}/overlay.ext4" + local overlay_img="${BINARIES_DIR}/overlay.ext4" dd if=/dev/zero of=${overlay_img} bs=${OVERLAY_SIZE} count=1 mkfs.ext4 -L "hassos-overlay" -E lazy_itable_init=0,lazy_journal_init=0 ${overlay_img} @@ -37,9 +37,9 @@ function create_overlay_image() { function create_kernel_image() { - local kernel0_img="${1}/kernel0.ext4" - local kernel1_img="${1}/kernel1.ext4" - local kernel=${1}/${2} + local kernel0_img="${BINARIES_DIR}/kernel0.ext4" + local kernel1_img="${BINARIES_DIR}/kernel1.ext4" + local kernel="${BINARIES_DIR}/${KERNEL_FILE}" # Make image dd if=/dev/zero of=${kernel0_img} bs=${KERNEL_SIZE} count=1 @@ -55,15 +55,22 @@ function create_kernel_image() { } +function prepare_disk_image() { + create_boot_image + create_overlay_image + create_kernel_image +} + + function create_disk_image() { - local boot_img="${1}/boot.vfat" - local rootfs_img="${1}/rootfs.squashfs" - local overlay_img="${1}/overlay.ext4" - local data_img="${1}/data.ext4" - local kernel0_img="${1}/kernel0.ext4" - local kernel1_img="${1}/kernel1.ext4" - local hdd_img=${2} - local hdd_count=${3:-2} + local boot_img="${BINARIES_DIR}/boot.vfat" + local rootfs_img="${BINARIES_DIR}/rootfs.squashfs" + local overlay_img="${BINARIES_DIR}/overlay.ext4" + local data_img="${BINARIES_DIR}/data.ext4" + local kernel0_img="${BINARIES_DIR}/kernel0.ext4" + local kernel1_img="${BINARIES_DIR}/kernel1.ext4" + local hdd_img="$(hassos_image_name img)" + local hdd_count=${1:-2} local loop_dev="/dev/mapper/$(losetup -f | cut -d'/' -f3)" local boot_offset=0 @@ -112,8 +119,26 @@ function create_disk_image() { function fix_disk_image_mbr() { - local hdd_img=${1} + local hdd_img="$(hassos_image_name img)" sgdisk -t 1:"E3C9E316-0B5C-4DB8-817D-F92DF00215AE" ${hdd_img} dd if=${BR2_EXTERNAL_HASSOS_PATH}/misc/mbr.img of=${hdd_img} conv=notrunc bs=512 count=1 } + + +function convert_disk_image_vdmk() { + local hdd_img="$(hassos_image_name img)" + local hdd_vdmk="$(hassos_image_name vdmk)" + + rm -f ${hdd_vdmk} + qemu-img convert -O vmdk ${hdd_img} ${hdd_vdmk} + rm -f ${hdd_img} +} + + +function convert_disk_image_gz() { + local hdd_img="$(hassos_image_name img)" + + rm -f ${hdd_img}.gz + gzip --best ${hdd_img} +} diff --git a/buildroot-external/scripts/name.sh b/buildroot-external/scripts/name.sh new file mode 100644 index 000000000..2307427e0 --- /dev/null +++ b/buildroot-external/scripts/name.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +function hassos_image_name() { + echo "${BINARIES_DIR}/${HASSOS_ID}_${BOARD_ID}-${VERSION_MAJOR}.${VERSION_BUILD}.${1}" +} + +function hassos_rauc_compatible() { + echo "${HASSOS_ID}-${BOARD_ID}" +} + +function hassos_version() { + echo "${VERSION_MAJOR}.${VERSION_BUILD}" +} diff --git a/buildroot-external/scripts/ota.sh b/buildroot-external/scripts/ota.sh new file mode 100644 index 000000000..b9f3a3f9e --- /dev/null +++ b/buildroot-external/scripts/ota.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +function create_ota_update() { + local ota_file="$(hassos_image_name raucb)" + local rauc_folder="${BINARIES_DIR}/rauc" + local boot_folder="${BINARIES_DIR}/boot" + local kernel="${BINARIES_DIR}/${KERNEL_FILE}" + local rootfs="${BINARIES_DIR}/rootfs.squashfs" + local key="/build/key.pem" + local cert="/build/cert.pem" + + rm -rf ${rauc_folder} ${ota_file} + mkdir -p ${rauc_folder} + + tar -P -cf ${rauc_folder}/kernel.tar ${kernel} + tar -P -cf ${rauc_folder}/boot.tar ${boot_folder} + cp -f ${rootfs} ${rauc_folder}/rootfs.img + + ( + echo "[update]" + echo "compatible=$(hassos_rauc_compatible)" + echo "version=$(hassos_version)" + echo "[image.boot]" + echo "filename=boot.tar" + echo "[image.kernel]" + echo "filename=kernel.tar" + echo "[image.rootfs]" + echo "filename=rootfs.img" + ) > ${rauc_folder}/manifest.raucm + + rauc bundle -d --cert=${cert} --key=${key} ${rauc_folder} ${ota_file} +} diff --git a/buildroot-external/scripts/post-build.sh b/buildroot-external/scripts/post-build.sh index 904c4fb55..a0eb5fea2 100755 --- a/buildroot-external/scripts/post-build.sh +++ b/buildroot-external/scripts/post-build.sh @@ -7,6 +7,8 @@ BOARD_DIR=${2} . ${SCRIPT_DIR}/rootfs-layer.sh . ${BR2_EXTERNAL_HASSOS_PATH}/info . ${BOARD_DIR}/info +. ${SCRIPT_DIR}/name.sh + # HassOS tasks fix_rootfs @@ -32,7 +34,7 @@ install_hassos_cli ) > ${TARGET_DIR}/etc/machine-info # Settup rauc -sed -i "s/%COMPATIBLE%/${HASSOS_ID}-${BOARD_ID}/g" ${TARGET_DIR}/etc/rauc/system.conf +sed -i "s/%COMPATIBLE%/$(hassos_rauc_compatible)/g" ${TARGET_DIR}/etc/rauc/system.conf sed -i "s/%BOOTLOADER%/${BOOTLOADER}/g" ${TARGET_DIR}/etc/rauc/system.conf # Settup the correct CA diff --git a/scripts/build-all.sh b/scripts/build-all.sh index f8c84efce..f3d075243 100755 --- a/scripts/build-all.sh +++ b/scripts/build-all.sh @@ -8,7 +8,7 @@ for platform in "${all_platforms[@]}"; do make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external \ ${platform}_defconfig make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external - cp -f /build/buildroot/output/images/hassos_* /build/RL/ + cp -f /build/buildroot/output/images/hassos_* /build/release/ make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external \ clean From 42dc9154368760f7b3623c1a2871a20bd85c8371 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 24 Jun 2018 10:41:05 +0200 Subject: [PATCH 14/26] Create deployment.md --- Documentation/deployment.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/deployment.md diff --git a/Documentation/deployment.md b/Documentation/deployment.md new file mode 100644 index 000000000..b88c0d947 --- /dev/null +++ b/Documentation/deployment.md @@ -0,0 +1,23 @@ +# Deployment + +We know 3 types of release builds: +- development (beta/dev) +- staging (rc) +- productive (stable) + +## Versioning +The format of version is *MAJOR.BUILD*. Everytime we create a new release with same userland, we bump the build number. +The development use here own major number they will be bump for the stable version and the development version go to next major number. + +``` +0.x = development +1.x = stable +2.x = development +3.x = stable +``` + +## GIT Branch/Tag +The branch `dev` ist the actual development branch and from there we never make a release. The `master` branch hould the development +version from they we build a beta release. + +If we create a new staging/productive release, we create a new branch `rel-{MAJOR}`. They will be used for the hole cycle of this release. From 3e8499ecbf8e55144c75aa6f35af27d590dd20fe Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 24 Jun 2018 23:41:04 +0200 Subject: [PATCH 15/26] Use correct cert (#35) * Use correct cert * Fix boot partition handling * Cleanup rauc handling * Make a reboot * handling --- Documentation/deployment.md | 2 +- .../patches/rauc/0001-add-i-argument-to.patch | 4 +-- buildroot-external/board/ova/post-image.sh | 9 ++---- .../board/raspberrypi/post-image.sh | 6 +--- buildroot-external/configs/ova_defconfig | 4 +-- buildroot-external/configs/rpi0_w_defconfig | 4 +-- buildroot-external/configs/rpi2_defconfig | 4 +-- buildroot-external/configs/rpi3_64_defconfig | 4 +-- buildroot-external/configs/rpi3_defconfig | 4 +-- buildroot-external/configs/rpi_defconfig | 4 +-- .../etc => misc}/fw_env.config | 0 buildroot-external/misc/rauc-hook | 12 +++++++ .../rootfs-overlay/etc/rauc/system.conf | 4 +++ .../rootfs-overlay/usr/lib/rauc/post-install | 4 +++ .../usr/lib/rauc/post-install-boot | 7 +++++ .../rootfs-overlay/usr/lib/rauc/pre-install | 3 ++ .../usr/lib/rauc/pre-install-boot | 8 +++++ buildroot-external/scripts/hdd-image.sh | 31 +++++++------------ buildroot-external/scripts/ota.sh | 16 ++++++---- buildroot-external/scripts/post-build.sh | 14 +++++++-- 20 files changed, 89 insertions(+), 55 deletions(-) rename buildroot-external/{rootfs-overlay/etc => misc}/fw_env.config (100%) create mode 100644 buildroot-external/misc/rauc-hook create mode 100755 buildroot-external/rootfs-overlay/usr/lib/rauc/post-install create mode 100755 buildroot-external/rootfs-overlay/usr/lib/rauc/post-install-boot create mode 100755 buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install create mode 100755 buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install-boot diff --git a/Documentation/deployment.md b/Documentation/deployment.md index b88c0d947..68e456dcd 100644 --- a/Documentation/deployment.md +++ b/Documentation/deployment.md @@ -3,7 +3,7 @@ We know 3 types of release builds: - development (beta/dev) - staging (rc) -- productive (stable) +- production (stable) ## Versioning The format of version is *MAJOR.BUILD*. Everytime we create a new release with same userland, we bump the build number. diff --git a/buildroot-external/board/ova/patches/rauc/0001-add-i-argument-to.patch b/buildroot-external/board/ova/patches/rauc/0001-add-i-argument-to.patch index 2337970a9..6ab580a7c 100644 --- a/buildroot-external/board/ova/patches/rauc/0001-add-i-argument-to.patch +++ b/buildroot-external/board/ova/patches/rauc/0001-add-i-argument-to.patch @@ -17,7 +17,7 @@ index d5efc0c..c57c2f7 100644 g_ptr_array_add(args, g_strdup_printf(BOOTSTATE_PREFIX ".%s.remaining_attempts", bootname)); + + g_ptr_array_add(args, g_strdup("-i")); -+ g_ptr_array_add(args, g_strdup("/mnt/boot/EFI/barebox/state.dtb")); ++ g_ptr_array_add(args, g_strdup("/etc/barebox-state.dtb")); g_ptr_array_add(args, NULL); sub = g_subprocess_newv((const gchar * const *)args->pdata, @@ -27,7 +27,7 @@ index d5efc0c..c57c2f7 100644 } + + g_ptr_array_add(args, g_strdup("-i")); -+ g_ptr_array_add(args, g_strdup("/mnt/boot/EFI/barebox/state.dtb")); ++ g_ptr_array_add(args, g_strdup("/etc/barebox-state.dtb")); g_ptr_array_add(args, NULL); sub = g_subprocess_newv((const gchar * const *)args->pdata, diff --git a/buildroot-external/board/ova/post-image.sh b/buildroot-external/board/ova/post-image.sh index 9a38c47fa..605719f62 100755 --- a/buildroot-external/board/ova/post-image.sh +++ b/buildroot-external/board/ova/post-image.sh @@ -26,10 +26,5 @@ prepare_disk_image # Create disk images create_disk_image 6 -convert_disk_image_vdmk - -# Generate OTA update file -rm -rf ${BOOT_DATA}/EFI/barebox -rm -f ${BOOT_DATA}/cmdline.txt - -create_ota_update bzImage +convert_disk_image_vmdk +create_ota_update diff --git a/buildroot-external/board/raspberrypi/post-image.sh b/buildroot-external/board/raspberrypi/post-image.sh index 655967f08..7f1e1ef78 100755 --- a/buildroot-external/board/raspberrypi/post-image.sh +++ b/buildroot-external/board/raspberrypi/post-image.sh @@ -44,8 +44,4 @@ prepare_disk_image create_disk_image 2 fix_disk_image_mbr convert_disk_image_gz - -# Generate OTA update file -rm -f ${BOOT_DATA}/*.txt - -create_ota_update ${KERNEL_NAME} +create_ota_update diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index e6582f86b..16bd4447b 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -71,12 +71,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/amd64-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/qemux86-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/amd64-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="3" +BR2_PACKAGE_HASSOS_CLI_VERSION="4" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index 3d8eeb5a0..e9dc0ce2d 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -80,12 +80,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="3" +BR2_PACKAGE_HASSOS_CLI_VERSION="4" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index bb619557b..ed7fdf022 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -79,12 +79,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi2-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="3" +BR2_PACKAGE_HASSOS_CLI_VERSION="4" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index 63da4555c..b144b4153 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -80,12 +80,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/aarch64-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/aarch64-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="3" +BR2_PACKAGE_HASSOS_CLI_VERSION="4" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index 2ccb033e0..2db9cedd6 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -80,12 +80,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="3" +BR2_PACKAGE_HASSOS_CLI_VERSION="4" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index 189abab69..9d0c315a7 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -79,12 +79,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="108" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="3" +BR2_PACKAGE_HASSOS_CLI_VERSION="4" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/rootfs-overlay/etc/fw_env.config b/buildroot-external/misc/fw_env.config similarity index 100% rename from buildroot-external/rootfs-overlay/etc/fw_env.config rename to buildroot-external/misc/fw_env.config diff --git a/buildroot-external/misc/rauc-hook b/buildroot-external/misc/rauc-hook new file mode 100644 index 000000000..815a6c5fb --- /dev/null +++ b/buildroot-external/misc/rauc-hook @@ -0,0 +1,12 @@ +#!/bin/sh + +# Handle boot hocks +if [ "${RAUC_SLOT_CLASS}" = "boot" ]; then + if [ "${1}" = "slot-post-install" ]; then + /usr/lib/rauc/post-install-boot + elif [ "${1}" = "slot-pre-install" ]; then + /usr/lib/rauc/pre-install-boot + fi +fi + +exit 0 diff --git a/buildroot-external/rootfs-overlay/etc/rauc/system.conf b/buildroot-external/rootfs-overlay/etc/rauc/system.conf index 22b483050..7c2d3c2e3 100644 --- a/buildroot-external/rootfs-overlay/etc/rauc/system.conf +++ b/buildroot-external/rootfs-overlay/etc/rauc/system.conf @@ -4,6 +4,10 @@ mountprefix=/run/rauc statusfile=/mnt/data/rauc.db bootloader=%BOOTLOADER% +[handlers] +pre-install=/usr/lib/rauc/pre-install +post-install=/usr/lib/rauc/post-install + [keyring] path=/etc/rauc/keyring.pem diff --git a/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install b/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install new file mode 100755 index 000000000..f07bc2638 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install @@ -0,0 +1,4 @@ +#!/bin/sh + +systemctl start mnt-boot.mount +systemctl reboot diff --git a/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install-boot b/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install-boot new file mode 100755 index 000000000..53bfd2ded --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install-boot @@ -0,0 +1,7 @@ +#!/bin/sh + +BOOT_DATA=/tmp/boot-data + +cp -f ${BOOT_DATA}/*.txt ${RAUC_SLOT_MOUNT_POINT}/ + +rm -rf ${BOOT_DATA} diff --git a/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install b/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install new file mode 100755 index 000000000..71b4b94b3 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install @@ -0,0 +1,3 @@ +#!/bin/sh + +systemctl stop mnt-boot.mount diff --git a/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install-boot b/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install-boot new file mode 100755 index 000000000..f101d548d --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/rauc/pre-install-boot @@ -0,0 +1,8 @@ +#!/bin/sh + +BOOT_DATA=/tmp/boot-data + +rm -rf ${BOOT_DATA} +mkdir -p ${BOOT_DATA} + +cp -f ${RAUC_SLOT_MOUNT_POINT}/*.txt ${BOOT_DATA}/ diff --git a/buildroot-external/scripts/hdd-image.sh b/buildroot-external/scripts/hdd-image.sh index 772988406..41bab4700 100755 --- a/buildroot-external/scripts/hdd-image.sh +++ b/buildroot-external/scripts/hdd-image.sh @@ -37,19 +37,16 @@ function create_overlay_image() { function create_kernel_image() { - local kernel0_img="${BINARIES_DIR}/kernel0.ext4" - local kernel1_img="${BINARIES_DIR}/kernel1.ext4" + local kernel_img="${BINARIES_DIR}/kernel.ext4" local kernel="${BINARIES_DIR}/${KERNEL_FILE}" # Make image - dd if=/dev/zero of=${kernel0_img} bs=${KERNEL_SIZE} count=1 - mkfs.ext4 -L "hassos-kernel0" -E lazy_itable_init=0,lazy_journal_init=0 ${kernel0_img} - dd if=/dev/zero of=${kernel1_img} bs=${KERNEL_SIZE} count=1 - mkfs.ext4 -L "hassos-kernel1" -E lazy_itable_init=0,lazy_journal_init=0 ${kernel1_img} + dd if=/dev/zero of=${kernel_img} bs=${KERNEL_SIZE} count=1 + mkfs.ext4 -L "hassos-kernel" -E lazy_itable_init=0,lazy_journal_init=0 ${kernel_img} # Mount / init file structs mkdir -p /mnt/data/ - mount -o loop ${kernel0_img} /mnt/data + mount -o loop ${kernel_img} /mnt/data cp -f ${kernel} /mnt/data/ umount /mnt/data } @@ -67,16 +64,14 @@ function create_disk_image() { local rootfs_img="${BINARIES_DIR}/rootfs.squashfs" local overlay_img="${BINARIES_DIR}/overlay.ext4" local data_img="${BINARIES_DIR}/data.ext4" - local kernel0_img="${BINARIES_DIR}/kernel0.ext4" - local kernel1_img="${BINARIES_DIR}/kernel1.ext4" + local kernel_img="${BINARIES_DIR}/kernel.ext4" local hdd_img="$(hassos_image_name img)" local hdd_count=${1:-2} local loop_dev="/dev/mapper/$(losetup -f | cut -d'/' -f3)" local boot_offset=0 local rootfs_offset=0 - local kernel0_offset=0 - local kernel1_offset=0 + local kernel_offset=0 local overlay_offset=0 local data_offset=0 @@ -88,13 +83,12 @@ function create_disk_image() { boot_offset="$(sgdisk -F ${hdd_img})" sgdisk -n 1:0:+${BOOT_SIZE} -c 1:"hassos-boot" -t 1:"C12A7328-F81F-11D2-BA4B-00A0C93EC93B" -u 1:${BOOT_UUID} ${hdd_img} - kernel0_offset="$(sgdisk -F ${hdd_img})" + kernel_offset="$(sgdisk -F ${hdd_img})" sgdisk -n 2:0:+${KERNEL_SIZE} -c 2:"hassos-kernel0" -t 2:"0FC63DAF-8483-4772-8E79-3D69D8477DE4" -u 2:${KERNEL0_UUID} ${hdd_img} rootfs_offset="$(sgdisk -F ${hdd_img})" sgdisk -n 3:0:+${SYSTEM_SIZE} -c 3:"hassos-system0" -t 3:"0FC63DAF-8483-4772-8E79-3D69D8477DE4" -u 3:${SYSTEM0_UUID} ${hdd_img} - kernel1_offset="$(sgdisk -F ${hdd_img})" sgdisk -n 4:0:+${KERNEL_SIZE} -c 4:"hassos-kernel1" -t 4:"0FC63DAF-8483-4772-8E79-3D69D8477DE4" -u 4:${KERNEL1_UUID} ${hdd_img} sgdisk -n 5:0:+${SYSTEM_SIZE} -c 5:"hassos-system1" -t 5:"0FC63DAF-8483-4772-8E79-3D69D8477DE4" -u 5:${SYSTEM1_UUID} ${hdd_img} @@ -110,8 +104,7 @@ function create_disk_image() { # Write Images sgdisk -v dd if=${boot_img} of=${hdd_img} conv=notrunc bs=512 obs=512 seek=${boot_offset} - dd if=${kernel0_img} of=${hdd_img} conv=notrunc bs=512 obs=512 seek=${kernel0_offset} - dd if=${kernel1_img} of=${hdd_img} conv=notrunc bs=512 obs=512 seek=${kernel1_offset} + dd if=${kernel_img} of=${hdd_img} conv=notrunc bs=512 obs=512 seek=${kernel_offset} dd if=${rootfs_img} of=${hdd_img} conv=notrunc bs=512 obs=512 seek=${rootfs_offset} dd if=${overlay_img} of=${hdd_img} conv=notrunc bs=512 obs=512 seek=${overlay_offset} dd if=${data_img} of=${hdd_img} conv=notrunc bs=512 obs=512 seek=${data_offset} @@ -126,12 +119,12 @@ function fix_disk_image_mbr() { } -function convert_disk_image_vdmk() { +function convert_disk_image_vmdk() { local hdd_img="$(hassos_image_name img)" - local hdd_vdmk="$(hassos_image_name vdmk)" + local hdd_vmdk="$(hassos_image_name vmdk)" - rm -f ${hdd_vdmk} - qemu-img convert -O vmdk ${hdd_img} ${hdd_vdmk} + rm -f ${hdd_vmdk} + qemu-img convert -O vmdk ${hdd_img} ${hdd_vmdk} rm -f ${hdd_img} } diff --git a/buildroot-external/scripts/ota.sh b/buildroot-external/scripts/ota.sh index b9f3a3f9e..589b3a1a7 100644 --- a/buildroot-external/scripts/ota.sh +++ b/buildroot-external/scripts/ota.sh @@ -3,8 +3,8 @@ function create_ota_update() { local ota_file="$(hassos_image_name raucb)" local rauc_folder="${BINARIES_DIR}/rauc" - local boot_folder="${BINARIES_DIR}/boot" - local kernel="${BINARIES_DIR}/${KERNEL_FILE}" + local boot="${BINARIES_DIR}/boot.vfat" + local kernel="${BINARIES_DIR}/kernel.ext4" local rootfs="${BINARIES_DIR}/rootfs.squashfs" local key="/build/key.pem" local cert="/build/cert.pem" @@ -12,18 +12,22 @@ function create_ota_update() { rm -rf ${rauc_folder} ${ota_file} mkdir -p ${rauc_folder} - tar -P -cf ${rauc_folder}/kernel.tar ${kernel} - tar -P -cf ${rauc_folder}/boot.tar ${boot_folder} + cp -f ${kernel} ${rauc_folder}/kernel.ext4 + cp -f ${boot} ${rauc_folder}/boot.vfat cp -f ${rootfs} ${rauc_folder}/rootfs.img + cp -f ${BR2_EXTERNAL_HASSOS_PATH}/misc/rauc-hook ${rauc_folder}/hook ( echo "[update]" echo "compatible=$(hassos_rauc_compatible)" echo "version=$(hassos_version)" + echo "[hooks]" + echo "filename=hook" echo "[image.boot]" - echo "filename=boot.tar" + echo "filename=boot.vfat" + echo "hooks=pre-install;post-install" echo "[image.kernel]" - echo "filename=kernel.tar" + echo "filename=kernel.ext4" echo "[image.rootfs]" echo "filename=rootfs.img" ) > ${rauc_folder}/manifest.raucm diff --git a/buildroot-external/scripts/post-build.sh b/buildroot-external/scripts/post-build.sh index a0eb5fea2..8ba16f109 100755 --- a/buildroot-external/scripts/post-build.sh +++ b/buildroot-external/scripts/post-build.sh @@ -38,8 +38,16 @@ sed -i "s/%COMPATIBLE%/$(hassos_rauc_compatible)/g" ${TARGET_DIR}/etc/rauc/syste sed -i "s/%BOOTLOADER%/${BOOTLOADER}/g" ${TARGET_DIR}/etc/rauc/system.conf # Settup the correct CA -if [ "${DEPLOYMENT}" == "development" ]; then - cp ${BR2_EXTERNAL_HASSOS_PATH}/misc/provisioning-ca.pem ${TARGET_DIR}/etc/rauc/keyring.pem -else +if [ "${DEPLOYMENT}" == "production" ]; then cp ${BR2_EXTERNAL_HASSOS_PATH}/misc/rel-ca.pem ${TARGET_DIR}/etc/rauc/keyring.pem +else + cp ${BR2_EXTERNAL_HASSOS_PATH}/misc/dev-ca.pem ${TARGET_DIR}/etc/rauc/keyring.pem fi + +# Bootloader options +if [ "${BOOTLOADER}" == "uboot" ]; then + cp ${BR2_EXTERNAL_HASSOS_PATH}/misc/fw_env.config ${TARGET_DIR}/etc/fw_env.config +else + cp ${BR2_EXTERNAL_HASSOS_PATH}/misc/barebox-state-efi.dtb ${TARGET_DIR}/etc/barebox-state.dtb +fi + From ddde16216ce5629e9197eeb6a51e7911c54ec508 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 08:50:39 +0200 Subject: [PATCH 16/26] Rename hassos.conf to docker.conf --- .../systemd/system/getty@.service.d/{hassos.conf => docker.conf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/{hassos.conf => docker.conf} (100%) diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/hassos.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/docker.conf similarity index 100% rename from buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/hassos.conf rename to buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/docker.conf From 8434f3ee55aab06b3d2864e46b4919e16d8027f7 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 08:51:22 +0200 Subject: [PATCH 17/26] Create docker.conf --- .../etc/systemd/system/dropbear.service.d/docker.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/docker.conf diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/docker.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/docker.conf new file mode 100644 index 000000000..53a8d88b0 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/docker.conf @@ -0,0 +1,3 @@ +[Unit] +Requires=docker.service +After=docker.service From cc80265997f973d92541ceb48613a6810c1c39b0 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 08:55:16 +0200 Subject: [PATCH 18/26] Run dropbear only if they have a known_hosts --- buildroot-external/rootfs-overlay/usr/sbin/hassos-config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config index 7b5bdd3ce..f274ad72e 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config @@ -37,6 +37,11 @@ if [ -f /mnt/config/known_hosts ]; then cp -f /mnt/config/known_hosts /root/.ssh/known_hosts chmod 600 /root/.ssh/known_hosts + + systemctl start dropbear +else + rm -f /root/.ssh/known_hosts + systemctl stop dropbear fi ## From 26d7a4cb23488797c4f277b29501f7fe74849152 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 08:58:26 +0200 Subject: [PATCH 19/26] Update hassos.conf --- .../etc/systemd/system/dropbear.service.d/hassos.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf index 98399d164..4967b8871 100644 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf @@ -1,5 +1,6 @@ [Unit] RequiresMountsFor=/etc/dropbear +ConditionFileNotEmpty=/root/.ssh/known_hosts [Service] ExecStartPre= From 5cd03d19dd4a8dfce12ca35576492825fcf9eb01 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 08:59:43 +0200 Subject: [PATCH 20/26] Update README.md --- README.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/README.md b/README.md index d67b9bd63..cecc7115a 100644 --- a/README.md +++ b/README.md @@ -12,20 +12,3 @@ Hass.io OS based on [buildroot](https://buildroot.org/). It's a hypervisor for D - AppArmor protected - ZRAM LZ4 for /tmp, /var, swap - Run every supervisor - -# Building -Running `sudo ./enter.sh` will get you into the build Docker container. -`make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external xy_defconfig` - -## Helpers - -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external xy_defconfig` -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external menuconfig` -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external linux-menuconfig` -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external barebox-menuconfig` -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external busybox-menuconfig` - -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external savedefconfig` -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external linux-update-defconfig` -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external barebox-update-defconfig` -- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external busybox-update-config` From 11b1867c732b530c386b700a114b4784076ed133 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 09:00:31 +0200 Subject: [PATCH 21/26] Create build.md --- Documentation/build.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/build.md diff --git a/Documentation/build.md b/Documentation/build.md new file mode 100644 index 000000000..fc66da92d --- /dev/null +++ b/Documentation/build.md @@ -0,0 +1,21 @@ +# Building + +Running `sudo ./enter.sh` will get you into the build Docker container. +`make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external xy_defconfig` + +## Scripts + + + +## Helpers + +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external xy_defconfig` +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external menuconfig` +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external linux-menuconfig` +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external barebox-menuconfig` +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external busybox-menuconfig` + +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external savedefconfig` +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external linux-update-defconfig` +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external barebox-update-defconfig` +- `make -C /build/buildroot BR2_EXTERNAL=/build/buildroot-external busybox-update-config` From 7675cc61fb1f9c8e8fdf195df7ba1be873615979 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 20:36:30 +0200 Subject: [PATCH 22/26] Update Hass.io CLI to version 5 (#36) --- buildroot-external/configs/ova_defconfig | 2 +- buildroot-external/configs/rpi0_w_defconfig | 2 +- buildroot-external/configs/rpi2_defconfig | 2 +- buildroot-external/configs/rpi3_64_defconfig | 2 +- buildroot-external/configs/rpi3_defconfig | 2 +- buildroot-external/configs/rpi_defconfig | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index 16bd4447b..69ef419b0 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -76,7 +76,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/qe BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/amd64-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="4" +BR2_PACKAGE_HASSOS_CLI_VERSION="5" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index e9dc0ce2d..81ef493ea 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -85,7 +85,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/ra BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="4" +BR2_PACKAGE_HASSOS_CLI_VERSION="5" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index ed7fdf022..239113860 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -84,7 +84,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/ra BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="4" +BR2_PACKAGE_HASSOS_CLI_VERSION="5" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index b144b4153..dfb26752e 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -85,7 +85,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/ra BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/aarch64-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="4" +BR2_PACKAGE_HASSOS_CLI_VERSION="5" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index 2db9cedd6..e495261b3 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -85,7 +85,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/ra BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="4" +BR2_PACKAGE_HASSOS_CLI_VERSION="5" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index 9d0c315a7..347f0e304 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -84,7 +84,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/ra BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="4" +BR2_PACKAGE_HASSOS_CLI_VERSION="5" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y From 4b4e22c355b32ffaa12cca27086c705980dfa88f Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 19:22:15 +0000 Subject: [PATCH 23/26] Fix args --- buildroot-external/configs/ova_defconfig | 1 + buildroot-external/configs/rpi0_w_defconfig | 1 + buildroot-external/configs/rpi2_defconfig | 1 + buildroot-external/configs/rpi3_64_defconfig | 1 + buildroot-external/configs/rpi3_defconfig | 1 + buildroot-external/configs/rpi_defconfig | 1 + 6 files changed, 6 insertions(+) diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index 69ef419b0..ac75fb052 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -77,6 +77,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/amd64-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index 81ef493ea..eb4ef73ae 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -86,6 +86,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index 239113860..614f9bacd 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -85,6 +85,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index dfb26752e..a2f3e9ffa 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -86,6 +86,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/aarch64-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index e495261b3..dcfbb003c 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -86,6 +86,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index 347f0e304..f750aff27 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -85,6 +85,7 @@ BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" BR2_PACKAGE_APPARMOR=y From b3943870dce1a31744efb7f814ea5f6cc8e6bcaa Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 21:11:18 +0000 Subject: [PATCH 24/26] Fix rauc config --- buildroot-external/configs/ova_defconfig | 1 + buildroot-external/configs/rpi0_w_defconfig | 1 + buildroot-external/configs/rpi2_defconfig | 1 + buildroot-external/configs/rpi3_64_defconfig | 1 + buildroot-external/configs/rpi3_defconfig | 1 + buildroot-external/configs/rpi_defconfig | 1 + buildroot-external/misc/rauc-hook | 0 buildroot-external/rootfs-overlay/etc/rauc/system.conf | 2 +- 8 files changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 buildroot-external/misc/rauc-hook diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index ac75fb052..1e65b10a5 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -29,6 +29,7 @@ BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y BR2_PACKAGE_JQ=y BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y +BR2_PACKAGE_SQUASHFS=y BR2_PACKAGE_DT_UTILS=y BR2_PACKAGE_GPTFDISK=y BR2_PACKAGE_GPTFDISK_SGDISK=y diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index eb4ef73ae..b95ac181c 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -34,6 +34,7 @@ BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y BR2_PACKAGE_JQ=y BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y +BR2_PACKAGE_SQUASHFS=y BR2_PACKAGE_RPI_WIFI_FIRMWARE=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_GPTFDISK=y diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index 614f9bacd..511690f9d 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -34,6 +34,7 @@ BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y BR2_PACKAGE_JQ=y BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y +BR2_PACKAGE_SQUASHFS=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_GPTFDISK=y BR2_PACKAGE_GPTFDISK_SGDISK=y diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index a2f3e9ffa..d1f8a04ad 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -34,6 +34,7 @@ BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y BR2_PACKAGE_JQ=y BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y +BR2_PACKAGE_SQUASHFS=y BR2_PACKAGE_RPI_WIFI_FIRMWARE=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_GPTFDISK=y diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index dcfbb003c..f085ecb81 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -34,6 +34,7 @@ BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y BR2_PACKAGE_JQ=y BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y +BR2_PACKAGE_SQUASHFS=y BR2_PACKAGE_RPI_WIFI_FIRMWARE=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_GPTFDISK=y diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index f750aff27..ad2b2824c 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -34,6 +34,7 @@ BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y BR2_PACKAGE_JQ=y BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y +BR2_PACKAGE_SQUASHFS=y BR2_PACKAGE_RPI_FIRMWARE=y BR2_PACKAGE_GPTFDISK=y BR2_PACKAGE_GPTFDISK_SGDISK=y diff --git a/buildroot-external/misc/rauc-hook b/buildroot-external/misc/rauc-hook old mode 100644 new mode 100755 diff --git a/buildroot-external/rootfs-overlay/etc/rauc/system.conf b/buildroot-external/rootfs-overlay/etc/rauc/system.conf index 7c2d3c2e3..2fe51e914 100644 --- a/buildroot-external/rootfs-overlay/etc/rauc/system.conf +++ b/buildroot-external/rootfs-overlay/etc/rauc/system.conf @@ -13,7 +13,7 @@ path=/etc/rauc/keyring.pem [slot.boot.0] device=/dev/disk/by-partlabel/hassos-boot -type=vfs +type=vfat [slot.kernel.0] device=/dev/disk/by-partlabel/hassos-kernel0 From 42f1c4bf010ee54732610fd7b6a099a00ea95c6c Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 25 Jun 2018 22:11:59 +0000 Subject: [PATCH 25/26] cleanup avahi Signed-off-by: Pascal Vizeli --- buildroot-external/configs/ova_defconfig | 1 + buildroot-external/configs/rpi0_w_defconfig | 1 + buildroot-external/configs/rpi2_defconfig | 1 + buildroot-external/configs/rpi3_64_defconfig | 1 + buildroot-external/configs/rpi3_defconfig | 1 + buildroot-external/configs/rpi_defconfig | 1 + 6 files changed, 6 insertions(+) diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index 1e65b10a5..89696c18a 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -37,6 +37,7 @@ BR2_PACKAGE_CA_CERTIFICATES=y BR2_PACKAGE_LIBCGROUP=y BR2_PACKAGE_LIBCGROUP_TOOLS=y BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y BR2_PACKAGE_DROPBEAR=y diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index b95ac181c..af10220b3 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -45,6 +45,7 @@ BR2_PACKAGE_LIBDNET=y BR2_PACKAGE_LIBCGROUP=y BR2_PACKAGE_LIBCGROUP_TOOLS=y BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y BR2_PACKAGE_DROPBEAR=y diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index 511690f9d..5cad57467 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -44,6 +44,7 @@ BR2_PACKAGE_LIBDNET=y BR2_PACKAGE_LIBCGROUP=y BR2_PACKAGE_LIBCGROUP_TOOLS=y BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y BR2_PACKAGE_DROPBEAR=y diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index d1f8a04ad..3cc5f2e69 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -45,6 +45,7 @@ BR2_PACKAGE_LIBDNET=y BR2_PACKAGE_LIBCGROUP=y BR2_PACKAGE_LIBCGROUP_TOOLS=y BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y BR2_PACKAGE_DROPBEAR=y diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index f085ecb81..b4de4194a 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -45,6 +45,7 @@ BR2_PACKAGE_LIBDNET=y BR2_PACKAGE_LIBCGROUP=y BR2_PACKAGE_LIBCGROUP_TOOLS=y BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y BR2_PACKAGE_DROPBEAR=y diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index ad2b2824c..bab699e35 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -44,6 +44,7 @@ BR2_PACKAGE_LIBDNET=y BR2_PACKAGE_LIBCGROUP=y BR2_PACKAGE_LIBCGROUP_TOOLS=y BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y BR2_PACKAGE_DROPBEAR=y From 27cd425f5b82e7a3372984e9374abf8f2939297c Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 26 Jun 2018 10:18:16 +0200 Subject: [PATCH 26/26] Use systemd for config mount (#37) * Create mnt-config.mount * Update hassos-config * Update mnt-config.mount * Update hassos-config --- .../usr/lib/systemd/system/mnt-config.mount | 8 ++++++++ .../rootfs-overlay/usr/sbin/hassos-config | 15 ++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount new file mode 100644 index 000000000..fd886e1b7 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount @@ -0,0 +1,8 @@ +[Unit] +Description=HassOS config partition + +[Mount] +What=LABEL=hassos-config +Where=/mnt/config +Type=auto +Options=ro diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config index f274ad72e..583ce2991 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config @@ -1,15 +1,12 @@ #!/bin/sh -set -e -# Check if hassos-config is present -if ! findfs LABEL="hassos-config" > /dev/null; then - echo "[Warning] No hassos-config partition found!" +# Mount config folder +systemctl start mnt-config.mount +if ! systemctl -q is-active mnt-config.mount; then + echo "[Warning] No config partition found" exit 0 fi -# Mount config partition -mount -o ro LABEL="hassos-config" /mnt/config - ## # NetworkManager if [ -d /mnt/config/network ]; then @@ -18,7 +15,7 @@ if [ -d /mnt/config/network ]; then rm -rf /etc/NetworkManager/system-connections/* cp -f /mnt/config/network/* /etc/NetworkManager/system-connections/ - nmcli con reload || true + nmcli con reload fi ## @@ -54,4 +51,4 @@ if ls /mnt/config/*.raucb > /dev/null; then fi # Cleanup config partition -umount /mnt/config +systemctl stop mnt-config.mount