Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 254 additions and 243 deletions
File deleted
...@@ -8,15 +8,15 @@ if [ \! -f /etc/mox_modules ]; then ...@@ -8,15 +8,15 @@ if [ \! -f /etc/mox_modules ]; then
uci delete network.lan uci delete network.lan
uci delete network.wan uci delete network.wan
lans="$(echo $(cd /sys/class/net/; ls -d lan* 2> /dev/null))" lans="$(cd /sys/class/net/; echo lan* 2> /dev/null)"
wan_if="" wan_if=""
lan_if="" lan_if=""
lan_mac="$(cat /sys/class/net/eth1/address)" lan_mac="$(cat /sys/class/net/eth1/address)"
# If we have SFP, it is definitely WAN # If we have SFP, it is definitely WAN
if expr "$modules" : '.*sfp.*' > /dev/null; then if expr "$modules" : '.*sfp.*' > /dev/null && [ -z "$lans" ]; then
wan_if=eth1 wan_if=sfp
lan_if="eth0 $lans" lan_if="eth0"
# If we have switch, then CPU port is obviously WAN # If we have switch, then CPU port is obviously WAN
elif expr "$modules" : '.*topaz.*' > /dev/null || expr "$modules" : '.*peridot.*' > /dev/null; then elif expr "$modules" : '.*topaz.*' > /dev/null || expr "$modules" : '.*peridot.*' > /dev/null; then
...@@ -30,7 +30,7 @@ if [ \! -f /etc/mox_modules ]; then ...@@ -30,7 +30,7 @@ if [ \! -f /etc/mox_modules ]; then
fi fi
uci set network.wan=interface uci set network.wan=interface
uci set network.wan.ifname=$wan_if uci set network.wan.ifname="$wan_if"
uci set network.wan.proto=none uci set network.wan.proto=none
uci set network.lan=interface uci set network.lan=interface
...@@ -43,7 +43,7 @@ if [ \! -f /etc/mox_modules ]; then ...@@ -43,7 +43,7 @@ if [ \! -f /etc/mox_modules ]; then
# Try dhcpp on LAN after interfaces settle a little bit # Try dhcpp on LAN after interfaces settle a little bit
sleep 5 sleep 5
if udhcpc -fqnR -i br-lan; then if [ -z "$wan_if" ] && udhcpc -fqnR -i br-lan; then
uci set network.lan.proto=dhcp uci set network.lan.proto=dhcp
uci set network.lan._turris_mode=unmanaged uci set network.lan._turris_mode=unmanaged
else else
......
#!/bin/sh #!/bin/sh
exec /sbin/nor-update exec /usr/sbin/nor-update
# #
## Copyright (C) 2018-2020 CZ.NIC z.s.p.o. (https://www.nic.cz/) ## Copyright (C) 2018-2021 CZ.NIC z.s.p.o. (https://www.nic.cz/)
# #
## This is free software, licensed under the GNU General Public License v2. ## This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=mox-uboot PKG_NAME:=mox-uboot
PKG_VERSION:=2020-07-rc1 PKG_VERSION:=2021-04-rc1
PKG_RELEASE:=2 PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.nic.cz/turris/mox-boot-builder.git PKG_SOURCE_URL:=https://gitlab.nic.cz/turris/mox-boot-builder.git
PKG_MIRROR_HASH:=edb7469a6191fec9437dd1d55bcb6261840d1d667fa4c3128680d0c1d33751e1 PKG_MIRROR_HASH:=960e37c522a48d994b4ee99a2f039ccd3dc26fda1e17027929c90bab344844f1
PKG_SOURCE_VERSION:=24de5b79eb0aeecaa611ced7513de8d87f0a1bcc PKG_SOURCE_VERSION:=b8928b294a863f2c698c4b230e598f984828a2ad
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz> PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE:=GPL-2.0-or-later
...@@ -29,12 +29,12 @@ define Package/mox-uboot ...@@ -29,12 +29,12 @@ define Package/mox-uboot
endef endef
define Build/Compile define Build/Compile
cd $(PKG_BUILD_DIR); make CROSS_COMPILE=$(TARGET_CROSS) u-boot.bin cd $(PKG_BUILD_DIR); make CROSS_COMPILE=$(TARGET_CROSS) a53-firmware.bin
endef endef
define Package/mox-uboot/install define Package/mox-uboot/install
$(INSTALL_DIR) $(1)/usr/share/mox $(INSTALL_DIR) $(1)/usr/share/mox
$(INSTALL_DATA) $(PKG_BUILD_DIR)/u-boot.bin $(1)/usr/share/mox/uboot-devel $(INSTALL_DATA) $(PKG_BUILD_DIR)/a53-firmware.bin $(1)/usr/share/mox/uboot-devel
endef endef
$(eval $(call BuildPackage,mox-uboot)) $(eval $(call BuildPackage,mox-uboot))
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=turris-omnia-firmware PKG_NAME:=turris-omnia-firmware
PKG_VERSION:=1.1 PKG_VERSION:=1.2.1
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz> PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
......
...@@ -2,36 +2,7 @@ UBOOT_PART="mtd0" ...@@ -2,36 +2,7 @@ UBOOT_PART="mtd0"
RESCUE_PART="mtd1" RESCUE_PART="mtd1"
UBOOT_DEVEL="/usr/share/omnia/uboot-devel" UBOOT_DEVEL="/usr/share/omnia/uboot-devel"
have_old_uboot() { board_ubootenv_hook() {
if fw_printenv -c /usr/share/nor-update/old-uboot.config 2>&1 | grep -q 'Bad CRC, using default environment'; then sed -i 's|btr\(load[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+\)\([^[:blank:]]\+\)[[:blank:]]\+\([^[:blank:];]\+\)|\1\3/\2|g' \
return 0 "$BACKUP_UBOOT_ENV"
else
return 1
fi
}
board_pre_hook() {
UPDATE_UENV=""
have_old_uboot || return 0
v_echo "Storing old U-boot environment to be preserved"
UPDATE_UENV="/usr/share/nor-update/uenv.backup"
[ \! -e "$UPDATE_UENV" ] || die "You already have a backup of U-Boot environment in $UPDATE_UENV, clean it up first!"
fw_printenv -c /usr/share/nor-update/old-fwenv.config 2>&1 > "$UPDATE_UENV"
# Replace deprecated btrload command with load, see comment bellow
# btrload mmc 0 0x02000000 boot/dtb @ => load mmc 0 0x02000000 @/boot/dtb
sed -i 's|btr\(load[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+\)\([^[:blank:]]\+\)[[:blank:]]\+\([^[:blank:];]\+\)|\1\3/\2|g' "$UPDATE_UENV"
}
board_post_hook() {
if [ "$UPDATE_UENV" ]; then
if fw_setenv -c /usr/share/nor-update/new-fwenv.config -s "$UPDATE_UENV"; then
echo "Your U-Boot environment was migrated to new U-Boot"
echo "You can find it in $UPDATE_UENV"
echo "You can reset it via 'fw_setenv bootcmd \"env default -f -a; saveenv; reset\"'"
else
echo "Migration of your U-Boot environment failed."
echo "You can find it in $UPDATE_UENV"
echo "Set whatever you need manually via 'fw_setenv'"
fi
fi
} }
/dev/mtd0 0xf0000 0x10000 0x10000
/dev/mtd0 0xC0000 0x10000 0x40000
No preview for this file type
...@@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk ...@@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=omnia-support PKG_NAME:=omnia-support
PKG_VERSION:=3.3 PKG_VERSION:=3.4
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz> PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
...@@ -12,17 +12,37 @@ PKG_BUILD_DEPENDS:=linux ...@@ -12,17 +12,37 @@ PKG_BUILD_DEPENDS:=linux
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Package/omnia-generic-support
TITLE:=Turris Omnia essential generic support
VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)
RELEASE:=$(PKG_VERSION)-$(PKG_RELEASE)
DEPENDS:=@TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia
endef
define Package/omnia-generic-support/description
Contains generic supporting files for Turris Omnia.
endef
define Package/omnia-support define Package/omnia-support
TITLE:=Turris Omnia essential support TITLE:=Turris Omnia essential support
VERSION:=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC) DEPENDS:=+omnia-generic-support @TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia
DEPENDS:=@TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia \
+mtd
endef endef
define Package/omnia-support/description define Package/omnia-support/description
Contains supporting files for Turris Omnia. Contains supporting files for Turris Omnia.
endef endef
define Package/omnia-cti-support
TITLE:=Turris Omnia CTI support
DEPENDS:=omnia-generic-support @TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia
PROVIDES:=omnia-support
CONFLICTS:=omnia-support
endef
define Package/omnia-cti-support/description
Contains supporting files for Turris Omnia that is part of CTI project.
endef
define Build/Prepare define Build/Prepare
mkdir -p $(PKG_BUILD_DIR) mkdir -p $(PKG_BUILD_DIR)
endef endef
...@@ -30,18 +50,29 @@ endef ...@@ -30,18 +50,29 @@ endef
Build/Configure:= Build/Configure:=
define Build/Compile define Build/Compile
sed -e 's|@CONTRACT@|cti|' files/contract-boot.txt | cat - files/boot.txt > "$(PKG_BUILD_DIR)"/boot-cti.txt
mkimage -T script -C none -n boot -d "$(PKG_BUILD_DIR)"/boot-cti.txt "$(PKG_BUILD_DIR)"/boot-cti.scr
mkimage -T script -C none -n boot -d files/boot.txt "$(PKG_BUILD_DIR)"/boot.scr
$(KERNEL_MAKE) zImage dtbs $(KERNEL_MAKE) zImage dtbs
endef endef
define Package/omnia-support/install define Package/omnia-generic-support/install
$(INSTALL_DIR) $(1)/boot $(INSTALL_DIR) $(1)/boot
$(INSTALL_DATA) $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts/armada-385-turris-omnia-*.dtb "$(1)"/boot $(INSTALL_DATA) $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts/armada-385-turris-omnia-*.dtb "$(1)"/boot
mkimage -T script -C none -n boot -d files/boot.txt "$(1)"/boot/boot.scr
ln -s boot/boot.scr "$(1)"/boot.scr ln -s boot/boot.scr "$(1)"/boot.scr
$(INSTALL_DIR) $(1)/usr/sbin
endef endef
define Package/omnia-support/postinst define Package/omnia-support/install
$(INSTALL_DIR) $(1)/boot
$(INSTALL_DATA) "$(PKG_BUILD_DIR)"/boot.scr "$(1)"/boot/boot.scr
endef
define Package/omnia-cti-support/install
$(INSTALL_DIR) $(1)/boot
$(INSTALL_DATA) "$(PKG_BUILD_DIR)"/boot-cti.scr "$(1)"/boot/boot.scr
endef
define Package/omnia-generic-support/postinst
#!/bin/sh #!/bin/sh
# Link default Omnia dtb unless there is existing link # Link default Omnia dtb unless there is existing link
DTB="$$IPKG_INSTROOT/boot/dtb" DTB="$$IPKG_INSTROOT/boot/dtb"
...@@ -49,3 +80,5 @@ DTB="$$IPKG_INSTROOT/boot/dtb" ...@@ -49,3 +80,5 @@ DTB="$$IPKG_INSTROOT/boot/dtb"
endef endef
$(eval $(call BuildPackage,omnia-support)) $(eval $(call BuildPackage,omnia-support))
$(eval $(call BuildPackage,omnia-cti-support))
$(eval $(call BuildPackage,omnia-generic-support))
if test "$contract" != "turris_lists=contracts/@CONTRACT@"; then
setenv contract "turris_lists=contracts/@CONTRACT@"
saveenv
fi
# #
## Copyright (C) 2018-2020 CZ.NIC z.s.p.o. (http://www.nic.cz/) ## Copyright (C) 2018-2022 CZ.NIC z.s.p.o. (http://www.nic.cz/)
# #
## This is free software, licensed under the GNU General Public License v2. ## This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=omnia-uboot PKG_NAME:=omnia-uboot
PKG_VERSION:=2019-07.1 PKG_VERSION:=2022.04
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.nic.cz/turris/turris-omnia-uboot.git PKG_SOURCE_URL:=https://source.denx.de/u-boot/u-boot.git
PKG_MIRROR_HASH:=aeab20bcc0f36f57ca95fb4bc093d49e39c04fe50ab88bcd8ee280739acacea7 PKG_MIRROR_HASH:=5a1ca6d5056822b7d1fd9c84ef65f5456278f5ac2eef74025fce66e056301fa8
PKG_SOURCE_DATE:=2020-09-07 PKG_SOURCE_DATE:=2022-04-04
PKG_SOURCE_VERSION:=6dd804d78fdcd775f6eeebe0aa0527d6761a115f PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz> PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE:=GPL-2.0-or-later
...@@ -30,9 +30,8 @@ define Package/omnia-uboot ...@@ -30,9 +30,8 @@ define Package/omnia-uboot
endef endef
define Build/Compile define Build/Compile
sed -i '/DCONFIG_KWB_SECURE/ d' $(PKG_BUILD_DIR)/tools/Makefile
cd $(PKG_BUILD_DIR); make CROSS_COMPILE=$(TARGET_CROSS) turris_omnia_defconfig cd $(PKG_BUILD_DIR); make CROSS_COMPILE=$(TARGET_CROSS) turris_omnia_defconfig
cd $(PKG_BUILD_DIR); make CROSS_COMPILE=$(TARGET_CROSS) u-boot-spl.kwb OMNIA_OLD_SPL=1 cd $(PKG_BUILD_DIR); make CROSS_COMPILE=$(TARGET_CROSS) u-boot-spl.kwb
endef endef
define Package/omnia-uboot/install define Package/omnia-uboot/install
......
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=rescue-image PKG_NAME:=rescue-image
PKG_VERSION:=3.5.1 PKG_VERSION:=3.6.1
PKG_RELEASE:=1 PKG_RELEASE:=1
BB_VERSION:=1.31.1 BB_VERSION:=1.32.1
PKG_SOURCE:=busybox-$(BB_VERSION).tar.bz2 PKG_SOURCE:=busybox-$(BB_VERSION).tar.bz2
PKG_SOURCE_URL:=https://www.busybox.net/downloads \ PKG_SOURCE_URL:=https://www.busybox.net/downloads \
http://sources.buildroot.net http://sources.buildroot.net
PKG_HASH:=d0f940a72f648943c1f2211e0e3117387c31d765137d92bd8284a3fb9752a998 PKG_HASH:=9d57c4bd33974140fd4111260468af22856f12f5b5ef7c70c8d9b75c712a0dee
PKG_MAINTAINER:=Michal Hrusecky <michal.hrusecky@nic.cz> PKG_MAINTAINER:=Michal Hrusecky <michal.hrusecky@nic.cz>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
ROOTFS_INSTALL:=+libgcc +libc +libubox +mtd +libpthread +librt +libattr +libuuid +zlib +libblkid +liblzo +btrfs-progs +schnapps +dropbear +uboot-envtools +usign +cznic-repo-keys +libopenssl +libpcre +wget ROOTFS_INSTALL:=+libgcc +libc +libubox +mtd +libpthread +librt +libattr +libuuid +zlib +libblkid +liblzo +btrfs-progs +schnapps +dropbear +uboot-envtools +usign +cznic-repo-keys +libopenssl +libpcre +wget +libhavege +haveged
PKG_BUILD_DEPENDS:=opkg/host mtd btrfs-progs schnapps wget cznic-repo-keys usign uboot-tools dropbear PKG_BUILD_DEPENDS:=opkg/host mtd btrfs-progs schnapps wget cznic-repo-keys usign uboot-tools dropbear haveged
KERNEL_BUILD_DIR:=$(PKG_BUILD_DIR)/kernel KERNEL_BUILD_DIR:=$(PKG_BUILD_DIR)/kernel
PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD) PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
...@@ -56,6 +56,7 @@ define Build/Prepare ...@@ -56,6 +56,7 @@ define Build/Prepare
mkdir -p "$(PKG_BUILD_DIR)/rootfs/tmp" mkdir -p "$(PKG_BUILD_DIR)/rootfs/tmp"
mkdir -p "$(PKG_BUILD_DIR)/rootfs/var/lock" mkdir -p "$(PKG_BUILD_DIR)/rootfs/var/lock"
mkdir -p "$(PKG_BUILD_DIR)/busybox" mkdir -p "$(PKG_BUILD_DIR)/busybox"
echo "Turris Rescue $(PKG_VERSION)-$(PKG_RELEASE)" > "$(PKG_BUILD_DIR)/rootfs/version"
echo "root::0:0:root:/:/bin/sh" > "$(PKG_BUILD_DIR)/rootfs/etc/passwd" echo "root::0:0:root:/:/bin/sh" > "$(PKG_BUILD_DIR)/rootfs/etc/passwd"
echo "/bin/sh" > "$(PKG_BUILD_DIR)/rootfs/etc/shells" echo "/bin/sh" > "$(PKG_BUILD_DIR)/rootfs/etc/shells"
$(INSTALL_BIN) ./files/helpers.sh "$(PKG_BUILD_DIR)/rootfs/lib/helpers.sh" $(INSTALL_BIN) ./files/helpers.sh "$(PKG_BUILD_DIR)/rootfs/lib/helpers.sh"
...@@ -113,6 +114,7 @@ define Package/rescue-image/install ...@@ -113,6 +114,7 @@ define Package/rescue-image/install
"$(STAGING_DIR_HOST)"/bin/mkimage -f rescue.its $(1)/usr/share/rescue-image/image.fit "$(STAGING_DIR_HOST)"/bin/mkimage -f rescue.its $(1)/usr/share/rescue-image/image.fit
xz -k9 -F lzma $(1)/usr/share/rescue-image/image.fit xz -k9 -F lzma $(1)/usr/share/rescue-image/image.fit
[ "`stat -c '%s' $(1)/usr/share/rescue-image/image.fit.lzma`" -lt 7340032 ] [ "`stat -c '%s' $(1)/usr/share/rescue-image/image.fit.lzma`" -lt 7340032 ]
[ "`stat -c '%s' $(1)/usr/share/rescue-image/image.fit.lzma`" -gt 1000000 ]
endef endef
$(eval $(call BuildPackage,rescue-image)) $(eval $(call BuildPackage,rescue-image))
...@@ -75,6 +75,7 @@ CONFIG_PREFIX="./_install" ...@@ -75,6 +75,7 @@ CONFIG_PREFIX="./_install"
# CONFIG_DEBUG_SANITIZE is not set # CONFIG_DEBUG_SANITIZE is not set
# CONFIG_UNIT_TEST is not set # CONFIG_UNIT_TEST is not set
# CONFIG_WERROR is not set # CONFIG_WERROR is not set
# CONFIG_WARN_SIMPLE_MSG is not set
CONFIG_NO_DEBUG_LIB=y CONFIG_NO_DEBUG_LIB=y
# CONFIG_DMALLOC is not set # CONFIG_DMALLOC is not set
# CONFIG_EFENCE is not set # CONFIG_EFENCE is not set
...@@ -456,6 +457,7 @@ CONFIG_FEATURE_FIND_SIZE=y ...@@ -456,6 +457,7 @@ CONFIG_FEATURE_FIND_SIZE=y
CONFIG_FEATURE_FIND_PRUNE=y CONFIG_FEATURE_FIND_PRUNE=y
# CONFIG_FEATURE_FIND_QUIT is not set # CONFIG_FEATURE_FIND_QUIT is not set
CONFIG_FEATURE_FIND_DELETE=y CONFIG_FEATURE_FIND_DELETE=y
# CONFIG_FEATURE_FIND_EMPTY is not set
CONFIG_FEATURE_FIND_PATH=y CONFIG_FEATURE_FIND_PATH=y
CONFIG_FEATURE_FIND_REGEX=y CONFIG_FEATURE_FIND_REGEX=y
# CONFIG_FEATURE_FIND_CONTEXT is not set # CONFIG_FEATURE_FIND_CONTEXT is not set
...@@ -1088,6 +1090,7 @@ CONFIG_ASH_GETOPTS=y ...@@ -1088,6 +1090,7 @@ CONFIG_ASH_GETOPTS=y
CONFIG_ASH_CMDCMD=y CONFIG_ASH_CMDCMD=y
CONFIG_CTTYHACK=y CONFIG_CTTYHACK=y
# CONFIG_HUSH is not set # CONFIG_HUSH is not set
# CONFIG_SHELL_HUSH is not set
# CONFIG_HUSH_BASH_COMPAT is not set # CONFIG_HUSH_BASH_COMPAT is not set
# CONFIG_HUSH_BRACE_EXPANSION is not set # CONFIG_HUSH_BRACE_EXPANSION is not set
# CONFIG_HUSH_LINENO_VAR is not set # CONFIG_HUSH_LINENO_VAR is not set
......
...@@ -4,19 +4,25 @@ ...@@ -4,19 +4,25 @@
reset_uenv() { reset_uenv() {
local bootcmd="env default -f -a;" local bootcmd="env default -f -a;"
# Carry all important variables accross resets, but remove empty variables # Carry all important variables across resets, but remove empty variables
# to help people who just empty them instead of deleting # to help people who just empty them instead of deleting
# We want to update root_uuid if there was reflash
if [ -n "$(fw_printenv -n root_uuid 2> /dev/null)" ]; then if [ -n "$(fw_printenv -n root_uuid 2> /dev/null)" ]; then
bootcmd="$bootcmd setenv root_uuid $(blkid "$TARGET_PART" | sed 's|.*UUID="\([^"]*\)".*|\1|');" bootcmd="$bootcmd setenv root_uuid $(blkid "$TARGET_PART" | sed 's|.*UUID="\([^"]*\)".*|\1|');"
fi fi
local contract="$(fw_printenv -n contract 2> /dev/null)"
if [ -n "$contract" ]; then # Rest of variable we will just carry over
bootcmd="$bootcmd setenv contract $contract;" #
fi # contract - what contracts is router under
local rescue_mode="$(fw_printenv -n rescue_mode 2> /dev/null)" # rescue_mode - default rescue mode if not specified - differs between MOX and Shield
if [ -n "$rescue_mode" ]; then # boot_targets - to allow prioritize booting from SSD
bootcmd="$bootcmd setenv rescue_mode $rescue_mode;" for var in contract rescue_mode boot_targets; do
fi local value="$(fw_printenv -n $var 2> /dev/null)"
if [ -n "$value" ]; then
bootcmd="$bootcmd setenv $var '$value';"
fi
done
fw_setenv bootcmd "$bootcmd saveenv; reset" fw_setenv bootcmd "$bootcmd saveenv; reset"
} }
...@@ -101,16 +107,13 @@ download_medkit() { ...@@ -101,16 +107,13 @@ download_medkit() {
mkdir -p /mnt/src mkdir -p /mnt/src
# Download medkit and signature # Download medkit and signature
for ext in tar.gz tar.gz.sig; do for ext in tar.gz tar.gz.sig; do
i=0 local i=0
# We are checking signature, so we don't care about https certificate # We are checking signature, so we don't care about https certificate
while ! { \ while ! wget -T 3 --no-check-certificate -O /mnt/src/medkit.$ext https://repo.turris.cz/hbs/medkit/${BOARD}-medkit${MDKT_VARIANT}-latest.$ext; do
wget --no-check-certificate -O /mnt/src/medkit.$ext https://repo.turris.cz/hbs/medkit/medkit-${BOARD}${MDKT_VARIANT}-latest.$ext || \ echo "Can't download $BOARD-medkit-latest.$ext :-("
wget --no-check-certificate -O /mnt/src/medkit.$ext https://repo.turris.cz/hbs/medkit/${BOARD}-medkit${MDKT_VARIANT}-latest.$ext; \ sleep 2
}; do i="$(expr "$i" + 1)"
echo "Can't download $BOARD-medkit-latest.$ext :-(" [ "$i" -lt "$tries" ] || die 2 "Can't get $BOARD-medkit-latest.$ext"
sleep 2
i="$(expr "$i" + 1)"
[ "$i" -lt "$tries" ] || die 2 "Can't get $BOARD-medkit-latest.$ext"
done done
done done
usign -V -m /mnt/src/medkit.tar.gz -P /etc/opkg/keys || die 2 "Can't validate signature" usign -V -m /mnt/src/medkit.tar.gz -P /etc/opkg/keys || die 2 "Can't validate signature"
......
/dts-v1/; /dts-v1/;
/ { / {
description = "Rescue image with single Linux kernel and FDT blob"; description = "Rescue image with single Linux kernel and FDT blob";
#address-cells = <1>; #address-cells = <1>;
images { images {
kernel@1 { kernel-1 {
description = "Linux kernel with initramfs included"; description = "Linux kernel with initramfs included";
data = /incbin/("./Image"); data = /incbin/("./Image");
type = "kernel_noload"; type = "kernel_noload";
arch = "arm64"; arch = "arm64";
os = "linux"; os = "linux";
compression = "none"; compression = "none";
load = <0x5000000>; load = <0x5000000>;
entry = <0x5000000>; entry = <0x5000000>;
hash@1 { hash-1 {
algo = "crc32"; algo = "crc32";
}; };
hash@2 { hash-2 {
algo = "sha1"; algo = "sha1";
}; };
}; };
ramdisk@1 { ramdisk-1 {
description = "Initial Ramdisk"; description = "Initial Ramdisk";
data = /incbin/("./initrd"); data = /incbin/("./initrd");
type = "ramdisk"; type = "ramdisk";
arch = "arm"; arch = "arm";
os = "linux"; os = "linux";
compression = "none"; compression = "none";
hash@1 { hash-1 {
algo = "crc32"; algo = "crc32";
}; };
hash@2 { hash-2 {
algo = "sha1"; algo = "sha1";
}; };
}; };
fdt@1 { fdt-1 {
description = "Flattened Device Tree blob"; description = "Flattened Device Tree blob";
data = /incbin/("./dts/marvell/armada-3720-turris-mox.dtb"); data = /incbin/("./dts/marvell/armada-3720-turris-mox.dtb");
type = "flat_dt"; type = "flat_dt";
arch = "arm64"; arch = "arm64";
compression = "none"; compression = "none";
hash@1 { hash-1 {
algo = "crc32"; algo = "crc32";
}; };
hash@2 { hash-2 {
algo = "sha1"; algo = "sha1";
}; };
}; };
}; };
configurations { configurations {
default = "conf@1"; default = "conf-1";
conf@1 { conf-1 {
description = "Turris MOX rescue image"; description = "Turris MOX rescue image";
kernel = "kernel@1"; kernel = "kernel-1";
ramdisk = "ramdisk@1"; ramdisk = "ramdisk-1";
fdt = "fdt@1"; fdt = "fdt-1";
}; };
}; };
}; };
/dts-v1/; /dts-v1/;
/ { / {
description = "Rescue image with single Linux kernel and FDT blob"; description = "Rescue image with single Linux kernel and FDT blob";
#address-cells = <1>; #address-cells = <1>;
images { images {
kernel { kernel {
description = "Linux kernel"; description = "Linux kernel";
data = /incbin/("./zImage"); data = /incbin/("./zImage");
type = "kernel"; type = "kernel";
arch = "arm"; arch = "arm";
os = "linux"; os = "linux";
compression = "none"; compression = "none";
load = <0x800000>; load = <0x800000>;
entry = <0x800000>; entry = <0x800000>;
hash@1 { hash-1 {
algo = "crc32"; algo = "crc32";
}; };
hash@2 { hash-2 {
algo = "sha1"; algo = "sha1";
}; };
}; };
ramdisk { ramdisk {
description = "Initial Ramdisk"; description = "Initial Ramdisk";
data = /incbin/("./initrd"); data = /incbin/("./initrd");
type = "ramdisk"; type = "ramdisk";
arch = "arm"; arch = "arm";
os = "linux"; os = "linux";
compression = "none"; compression = "none";
hash@1 { hash-1 {
algo = "crc32"; algo = "crc32";
}; };
hash@2 { hash-2 {
algo = "sha1"; algo = "sha1";
}; };
}; };
phy-dtb { phy-dtb {
description = "Flattened Device Tree blob (metalic WAN)"; description = "Flattened Device Tree blob (metalic WAN)";
data = /incbin/("./dts/armada-385-turris-omnia-phy.dtb"); data = /incbin/("./dts/armada-385-turris-omnia-phy.dtb");
type = "flat_dt"; type = "flat_dt";
arch = "arm"; arch = "arm";
compression = "none"; compression = "none";
hash@1 { hash-1 {
algo = "crc32"; algo = "crc32";
}; };
hash@2 { hash-2 {
algo = "sha1"; algo = "sha1";
}; };
}; };
sfp-dtb { sfp-dtb {
description = "Flattened Device Tree blob (SFP WAN)"; description = "Flattened Device Tree blob (SFP WAN)";
data = /incbin/("./dts/armada-385-turris-omnia-sfp.dtb"); data = /incbin/("./dts/armada-385-turris-omnia-sfp.dtb");
type = "flat_dt"; type = "flat_dt";
arch = "arm"; arch = "arm";
compression = "none"; compression = "none";
hash@1 { hash-1 {
algo = "crc32"; algo = "crc32";
}; };
hash@2 { hash-2 {
algo = "sha1"; algo = "sha1";
}; };
}; };
}; };
configurations { configurations {
default = "def"; default = "def";
def { def {
description = "Turris Omnia rescue image"; description = "Turris Omnia rescue image";
kernel = "kernel"; kernel = "kernel";
ramdisk = "ramdisk"; ramdisk = "ramdisk";
fdt = "phy-dtb"; fdt = "phy-dtb";
}; };
sfp { sfp {
description = "Turris Omnia rescue image (SFP)"; description = "Turris Omnia rescue image (SFP)";
kernel = "kernel"; kernel = "kernel";
ramdisk = "ramdisk"; ramdisk = "ramdisk";
fdt = "sfp-dtb"; fdt = "sfp-dtb";
}; };
}; };
}; };
...@@ -25,6 +25,7 @@ wait_for_mode_change ...@@ -25,6 +25,7 @@ wait_for_mode_change
echo "Mode $MODE selected!" echo "Mode $MODE selected!"
busy busy
override_root # Some alternative roots might take a while to initialize override_root # Some alternative roots might take a while to initialize
haveged -F & # Provide some extra entropy
mode_"$MODE" mode_"$MODE"
echo "Everything done, rebooting!" echo "Everything done, rebooting!"
reboot reboot
# #
## Copyright (C) 2018-2019 CZ.NIC z.s.p.o. (http://www.nic.cz/) ## Copyright (C) 2018-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
# #
## This is free software, licensed under the GNU General Public License v2. ## This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=start-indicator PKG_NAME:=start-indicator
PKG_VERSION:=0 PKG_VERSION:=1.0
PKG_RELEASE:=3 PKG_RELEASE:=1
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz> PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE:=GPL-2.0-or-later
...@@ -17,29 +17,17 @@ PKG_LICENSE:=GPL-2.0-or-later ...@@ -17,29 +17,17 @@ PKG_LICENSE:=GPL-2.0-or-later
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Package/start-indicator define Package/start-indicator
TITLE:=start-indicator SECTION:=utils
CATEGORY:=Utilities
TITLE:=Start indicator
DEPENDS:=+busybox
endef endef
define Package/start-indicator/install define Package/start-indicator/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/start-indicator.init $(1)/etc/init.d/start-indicator $(INSTALL_BIN) ./files/start-indicator.init $(1)/etc/init.d/start-indicator
endef endef
define Package/start-indicator/postinst
#!/bin/sh
[ -n "$$IPKG_INSTROOT" ] || {
/etc/init.d/start-indicator enable
}
endef
define Package/start-indicator/prerm
#!/bin/sh
[ -n "$$IPKG_INSTROOT" ] || {
/etc/init.d/start-indicator disable
}
endef
Build/Compile:= Build/Compile:=
$(eval $(call BuildPackage,start-indicator)) $(eval $(call BuildPackage,start-indicator))
...@@ -7,15 +7,24 @@ start() { ...@@ -7,15 +7,24 @@ start() {
msg="Router Turris successfully started." msg="Router Turris successfully started."
logger -p 0 -t turris "$msg" logger -p 0 -t turris "$msg"
echo "$msg" > /dev/console echo "$msg" > /dev/console
[ \! -e /sys/class/leds/red/trigger ] || echo heartbeat > /sys/class/leds/red/trigger
[ \! -x /etc/init.d/rainbow ] || /etc/init.d/rainbow restart [ -e /sys/class/leds/red/trigger ] \
[ \! -x /etc/init.d/led ] || /etc/init.d/led restart && echo heartbeat > /sys/class/leds/red/trigger
[ -x /etc/init.d/rainbow ] \
&& /etc/init.d/rainbow restart
[ -x /etc/init.d/led ] \
&& /etc/init.d/led restart
} }
stop() { stop() {
msg="Stopping router Turris." msg="Stopping router Turris."
logger -p 0 -t turris "$msg" logger -p 0 -t turris "$msg"
echo "$msg" > /dev/console echo "$msg" > /dev/console
[ \! -e /sys/class/leds/red/trigger ] || echo default-on > /sys/class/leds/red/trigger
[ -e /sys/class/leds/red/trigger ] \
&& echo default-on > /sys/class/leds/red/trigger
} }
restart() {
true # Do nothing as we are not service intended for restart
}