From 0ae58c4fb2475345104386bd41eadc1981301a04 Mon Sep 17 00:00:00 2001 From: lindongping Date: Fri, 29 Nov 2024 16:34:32 +0800 Subject: [PATCH 1/8] add hash check for phytium-ota and phytium-ota support rootfs update Signed-off-by: lindongping --- README.md | 2 +- board/phytium/common/debian-package-installer | 4 + board/phytium/common/post-build.sh | 6 - package/phytium-tools/phytium-tools.mk | 3 + package/phytium-tools/src/check-hash | 107 ++++++++++++++ .../fitImage/latest/5.10/fitImage.hash | 1 + .../latest/5.10/linux-headers-5.10.deb.hash | 1 + .../latest/5.10/linux-image-5.10.deb.hash | 1 + .../fitImage/latest/6.6/fitImage.hash | 1 + .../latest/6.6/linux-headers-6.6.deb.hash | 1 + .../latest/6.6/linux-image-6.6.deb.hash | 1 + .../phytium-ota-hash/rootfs/latest/lscpu.hash | 1 + .../latest/phytium-desktop-tools.deb.hash | 1 + .../rootfs/latest/phytium-firstlogin.deb.hash | 1 + .../rootfs/latest/phytium-vpu.deb.hash | 1 + .../rootfs/latest/phytium-zram.deb.hash | 1 + .../rootfs/latest/rootfs-chown.deb.hash | 1 + .../uboot/5g/fip-all-5g-4GB.bin.hash | 2 + .../uboot/latest/fip-all-optee-2GB.bin.hash | 1 + .../uboot/latest/fip-all-optee-4GB.bin.hash | 1 + .../uboot/msata/fip-all-msata-4GB.bin.hash | 1 + .../uboot/v1.5/fip-all-optee-2GB.bin.hash | 1 + .../uboot/v1.5/fip-all-optee-4GB.bin.hash | 1 + package/phytium-tools/src/phytium_ota | 133 ++++++++++++++++-- 24 files changed, 252 insertions(+), 22 deletions(-) create mode 100755 package/phytium-tools/src/check-hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/rootfs/latest/lscpu.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash create mode 100644 package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash diff --git a/README.md b/README.md index 22011c11..b962e82d 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ LINUX_OVERRIDE_SRCDIR指定了一个本地的内核源码目录,这样就不 `$ sudo phytium_ota all latest` `$ sudo phytium_ota uboot latest` `$ sudo phytium_ota fitImage latest` -以上三条命令通过远程分别将uboot+Image+dtb、uboot和Image+dtb升级到最新版本。关于phytium_ota更多信息,可以参考[phytium_ota介绍与使用](https://gitee.com/phytium_embedded/phytium-pi-os/wikis/phytium_ota%E4%BB%8B%E7%BB%8D%E4%B8%8E%E4%BD%BF%E7%94%A8) +以上三条命令通过远程分别将整个系统、uboot和Image+dtb升级到最新版本。关于phytium_ota更多信息,可以参考[phytium_ota介绍与使用](https://gitee.com/phytium_embedded/phytium-pi-os/wikis/phytium_ota%E4%BB%8B%E7%BB%8D%E4%B8%8E%E4%BD%BF%E7%94%A8) # 编译内核模块 关于如何编译内核外部模块,可参考https://www.kernel.org/doc/html/latest/kbuild/modules.html diff --git a/board/phytium/common/debian-package-installer b/board/phytium/common/debian-package-installer index 49d1cde1..a11d012c 100755 --- a/board/phytium/common/debian-package-installer +++ b/board/phytium/common/debian-package-installer @@ -85,6 +85,10 @@ do_distrorfs_second_stage() { if [ -f /etc/cups/cupsd.conf ]; then echo "SSLOptions MinTLS1.2" >> /etc/cups/cupsd.conf fi + + # set the configuration of vim + echo 'set mouse-=a' >> /root/.vimrc + echo 'syntax on' >> /root/.vimrc echo remove packages. DEBIAN_FRONTEND=noninteractive apt-get -y remove --purge parole || exit 1 diff --git a/board/phytium/common/post-build.sh b/board/phytium/common/post-build.sh index 445c0efd..d20f5a30 100755 --- a/board/phytium/common/post-build.sh +++ b/board/phytium/common/post-build.sh @@ -109,12 +109,6 @@ main() ln -sf /lib/systemd/system/phytium-tee-supplicant.service $1/etc/systemd/system/sysinit.target.wants/phytium-tee-supplicant.service fi - # alsa UCM - if grep -Eq "^BR2_PACKAGE_PHYTIUM_DESKTOP_TOOLS=y$" ${BR2_CONFIG}; then - ln -sf ../../Phytium/es8336/es8336.conf $1/usr/share/alsa/ucm2/conf.d/simple-card/phytium,pe220x-i2s-audio.conf - ln -sf ../../Phytium/PMDK-I2S/PMDK-I2S.conf $1/usr/share/alsa/ucm2/conf.d/PMDK-I2S/PMDK-I2S.conf - fi - # zram if grep -Eq "^BR2_PACKAGE_PHYTIUM_ZRAM=y$" ${BR2_CONFIG}; then sudo chroot ${1} systemctl enable phytium-zram-config.service diff --git a/package/phytium-tools/phytium-tools.mk b/package/phytium-tools/phytium-tools.mk index b0c71533..70bcc71b 100644 --- a/package/phytium-tools/phytium-tools.mk +++ b/package/phytium-tools/phytium-tools.mk @@ -16,6 +16,7 @@ define PHYTIUM_TOOLS_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/lib/firmware/rtw88/ mkdir -p $(TARGET_DIR)/lib/firmware/rtl_bt/ mkdir -p $(TARGET_DIR)/etc/modprobe.d/ + mkdir -p $(TARGET_DIR)/usr/lib/phytium/ $(INSTALL) -m 755 -D $(@D)/rtlbt/* $(TARGET_DIR)/lib/firmware/rtlbt/ $(INSTALL) -m 755 -D $(@D)/rtk_hciattach $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 755 -D $(@D)/resize.sh $(TARGET_DIR)/usr/bin/ @@ -28,6 +29,8 @@ define PHYTIUM_TOOLS_INSTALL_TARGET_CMDS $(INSTALL) -m 755 -D $(@D)/rtw88.conf $(TARGET_DIR)/etc/modprobe.d/ $(INSTALL) -m 755 -D $(@D)/phytium_ota $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 755 -D $(@D)/quectel-CM $(TARGET_DIR)/usr/bin/ + $(INSTALL) -m 755 -D $(@D)/check-hash $(TARGET_DIR)/usr/bin/ + cp -rf $(@D)/phytium-ota-hash/ $(TARGET_DIR)/usr/lib/phytium/ endef $(eval $(generic-package)) diff --git a/package/phytium-tools/src/check-hash b/package/phytium-tools/src/check-hash new file mode 100755 index 00000000..5a47f49b --- /dev/null +++ b/package/phytium-tools/src/check-hash @@ -0,0 +1,107 @@ +#!/usr/bin/env bash +set -e + +# Helper to check a file matches its known hash +# Call it with: +# $1: the path of the file containing all the expected hashes +# $2: the full path to the temporary file that was downloaded, and +# that is to be checked +# $3: the final basename of the file, to which it will be ultimately +# saved as, to be able to match it to the corresponding hashes +# in the .hash file +# +# Exit codes: +# 0: the hash file exists and the file to check matches all its hashes, +# or the hash file does not exist +# 1: unknown command-line option +# 2: the hash file exists and the file to check does not match at least +# one of its hashes +# 3: the hash file exists and there was no hash to check the file against +# 4: the hash file exists and at least one hash type is unknown + +while getopts :q OPT; do + case "${OPT}" in + q) exec >/dev/null;; + \?) exit 1;; + esac +done +shift $((OPTIND-1)) + +h_file="${1}" +file="${2}" +base="${3}" + +# Bail early if no hash to check +if [ -z "${h_file}" ]; then + exit 0 +fi +# Does the hash-file exist? +if [ ! -f "${h_file}" ]; then + printf "WARNING: no hash file for %s\n" "${base}" >&2 + exit 0 +fi + +# Check one hash for a file +# $1: algo hash +# $2: known hash +# $3: file (full path) +check_one_hash() { + _h="${1}" + _known="${2}" + _file="${3}" + + # Note: md5 is supported, but undocumented on purpose. + # Note: sha3 is not supported, since there is currently no implementation + # (the NIST has yet to publish the parameters). + case "${_h}" in + md5|sha1) ;; + sha224|sha256|sha384|sha512) ;; + *) # Unknown hash, exit with error + printf "ERROR: unknown hash '%s' for '%s'\n" \ + "${_h}" "${base}" >&2 + exit 4 + ;; + esac + + # Do the hashes match? + _hash=$( ${_h}sum "${_file}" |cut -d ' ' -f 1 ) + if [ "${_hash}" = "${_known}" ]; then + printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}" + return 0 + fi + + printf "ERROR: %s has wrong %s hash:\n" "${base}" "${_h}" >&2 + printf "ERROR: expected: %s\n" "${_known}" >&2 + printf "ERROR: got : %s\n" "${_hash}" >&2 + printf "ERROR: Incomplete download, or man-in-the-middle (MITM) attack\n" >&2 + + exit 2 +} + +# Do we know one or more hashes for that file? +nb_checks=0 +while read t h f; do + case "${t}" in + ''|'#'*) + # Skip comments and empty lines + continue + ;; + *) + if [ "${f}" = "${base}" ]; then + check_one_hash "${t}" "${h}" "${file}" + : $((nb_checks++)) + fi + ;; + esac +done <"${h_file}" + +if [ ${nb_checks} -eq 0 ]; then + case " ${BR_NO_CHECK_HASH_FOR} " in + *" ${base} "*) + # File explicitly has no hash + exit 0 + ;; + esac + printf "ERROR: No hash found for %s\n" "${base}" >&2 + exit 3 +fi diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash new file mode 100644 index 00000000..4c7c7f03 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash @@ -0,0 +1 @@ +sha256 26a9c047d93bc7b30582bca8a226c3cc41c864b2d5a21d07064b4634b654e9cf fitImage diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash new file mode 100644 index 00000000..16668804 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash @@ -0,0 +1 @@ +sha256 a7bd6c50d40e4c827654033496757200c5f3dbfda630c5ae7c0ac43e15e64f9f linux-headers-5.10.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash new file mode 100644 index 00000000..4a640f56 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash @@ -0,0 +1 @@ +sha256 ab0b82ebf36925a7bb389d1f26db2c04f675ddcf9e4276850dde51e05c5e5fd3 linux-image-5.10.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash new file mode 100644 index 00000000..fcd7f715 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash @@ -0,0 +1 @@ +sha256 7227f5d936e30ada647381b6b07010bc837d2167399c35abdf02c24255743fa9 fitImage diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash new file mode 100644 index 00000000..54f25259 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash @@ -0,0 +1 @@ +sha256 a2e62b56a15589ef3952e70b96d9d64056bf0fc16170f92bd22c5fc6f54b0d56 linux-headers-6.6.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash new file mode 100644 index 00000000..4e034910 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash @@ -0,0 +1 @@ +sha256 daaa543f0e58eb7886dc1585874828d5734b5b6e913f870134f53dc0e02e846d linux-image-6.6.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/lscpu.hash b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/lscpu.hash new file mode 100644 index 00000000..72630ae8 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/lscpu.hash @@ -0,0 +1 @@ +sha256 12775525aa3723f5ac1ae045ebecfda74c1b17579293100f5b4ad0599706e18d lscpu diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash new file mode 100644 index 00000000..22c62e74 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash @@ -0,0 +1 @@ +sha256 20ce018fcf8ccd9bfaa086784ccda952ad4692bf892f9b49751f77cecb323f1e phytium-desktop-tools.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash new file mode 100644 index 00000000..b60b6edf --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash @@ -0,0 +1 @@ +sha256 9a832a7b7a88beac69d6bf4e06f55f006343aba66760b3ac799c0930c923775d phytium-firstlogin.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash new file mode 100644 index 00000000..d1652f02 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash @@ -0,0 +1 @@ +sha256 604180b8e915a8fde270511ef51936b67ca01ac766e1da0ced0f06a33c555eff phytium-vpu.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash new file mode 100644 index 00000000..449b22b5 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash @@ -0,0 +1 @@ +sha256 018619e90dd03f06fd7558f5640df9d2e10451bfc3d912178005a4dfc81b279a phytium-zram.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash new file mode 100644 index 00000000..acd79f64 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash @@ -0,0 +1 @@ +sha256 52a42810d478918d0e2b2c1a552f4ecb6088437ddd20eea513c965d06ee35ac2 rootfs-chown.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash b/package/phytium-tools/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash new file mode 100644 index 00000000..ee96c83d --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash @@ -0,0 +1,2 @@ +sha256 1ebc3dc344886ffb2029a33fd3fa4a9f22ff981255cb69835e84f247cfe60f11 fip-all-5g-4GB.bin + diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash b/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash new file mode 100644 index 00000000..8702bafc --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash @@ -0,0 +1 @@ +sha256 5ea39ddf7bcfd8ff1b3448fa0c71847a9c1e653f2cdd2cfc2451f813d8c946e4 fip-all-optee-2GB.bin diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash b/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash new file mode 100644 index 00000000..d2e913ab --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash @@ -0,0 +1 @@ +sha256 7cc1bed898467814362553ace772ece3031819d1f62616ea6a66981014e72567 fip-all-optee-4GB.bin diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash b/package/phytium-tools/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash new file mode 100644 index 00000000..e5519f6a --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash @@ -0,0 +1 @@ +sha256 991d1cacff5a732a153eafb28c8c35d58e4455a82512c70c92e94a489bf02ac8 fip-all-msata-4GB.bin diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash b/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash new file mode 100644 index 00000000..8702bafc --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash @@ -0,0 +1 @@ +sha256 5ea39ddf7bcfd8ff1b3448fa0c71847a9c1e653f2cdd2cfc2451f813d8c946e4 fip-all-optee-2GB.bin diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash b/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash new file mode 100644 index 00000000..e105bdb3 --- /dev/null +++ b/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash @@ -0,0 +1 @@ +sha256 7cc1bed898467814362553ace772ece3031819d1f62616ea6a66981014e72567 fip-all-optee-4GB.bin diff --git a/package/phytium-tools/src/phytium_ota b/package/phytium-tools/src/phytium_ota index 238bd747..c0e1d204 100755 --- a/package/phytium-tools/src/phytium_ota +++ b/package/phytium-tools/src/phytium_ota @@ -11,6 +11,7 @@ download_dir="/usr/local/phytium-libs" download_site="https://gitee.com/phytium_embedded/phytium-rogue-umlibs.git" dest_dir="/usr/local/phytium-ota" +hash_dir="/usr/lib/phytium/phytium-ota-hash" usage() { echo "Usage: sudo $0 {all|fitImage|uboot} {version}" @@ -21,7 +22,7 @@ usage() { Example 2: sudo $0 fitImage latest --update fitImage to the latest Example 3: sudo $0 all latest - --update uboot and fit Image to the latest" + --update uboot,fitImage and rootfs to the latest" } while true; do @@ -48,7 +49,7 @@ check_args() fi if [[ "$2" != "latest" && "$2" != "msata" && "$2" != "5g" && ! "$2" =~ ^v1\.[0-9]+$ ]]; then - echo -e "\033[1;31mError: Second argument must be 'latest', 'msata', '5g' or 'v1.x'.\033[0m" + echo -e "\033[1;31mError: Second argument must be 'latest', "msata", "5g" or 'v1.x'.\033[0m" exit 1 fi } @@ -62,7 +63,17 @@ if [ $memory_total -ge 3221225472 ]; then else mem=2GB fi -#echo $mem + +# uboot +uboot_type=optee +if [ "$2" == "msata" ]; then + uboot_type=msata +elif [ "$2" == "5g" ]; then + uboot_type=5g +fi +uboot_bin="fip-all-$uboot_type-$mem.bin" + +uboot_hash="$uboot_bin.hash" # get kernel version kernel_version=$(uname -r) @@ -121,10 +132,12 @@ get_uboot_and_fitImage() { rm -rf $download_dir mkdir -p $download_dir - + + apt install -y git + git clone -b develop --depth 1 $download_site $download_dir if [ "$?" != "0" ]; then - echo -e "\033[1;33mget uboot and fitImage failed\033[0m" + echo -e "\033[1;31mget uboot and fitImage failed\033[0m" exit 1 fi echo -e "\033[1;32mget uboot and fitImage success\033[0m" @@ -133,22 +146,95 @@ get_uboot_and_fitImage() { } # get_uboot_and_fitImage +install_and_remove_packages() { + apt install -y locales audacity jq network-manager + apt remove -y dhcpcd5 +} # install_and_remove_package + +rootfs_configure() { + # rootfs-chown + systemctl enable systemd-rootfs-chown.service + # phytium-zram + systemctl enable phytium-zram-config.service + # phytium-vpu + systemctl enable phytium-vpu.service + + # disable default sink + sed -i 's/^default-sink = alsa_output.platform-sound.stereo-fallback/#&/' "/etc/pulse/client.conf" + # set kernel loglevel + sed -i 's/#kernel.printk = 3 4 1 3/kernel.printk = 4 4 1 7/' "/etc/sysctl.d/99-sysctl.conf" + # set the name of the sound output devices + sed -i 's/^update-sink-proplist 1 device.description=Headphone/#&/' "/etc/pulse/default.pa" + sed -i 's/^set-default-sink 1/#&/' "/etc/pulse/default.pa" + if ! grep -q '^update-sink-proplist 0 device.description=HDMI' "/etc/pulse/default.pa"; then + echo 'update-sink-proplist 0 device.description=HDMI' >> "/etc/pulse/default.pa" + fi + if ! grep -q '^load-module module-switch-on-connect' "/etc/pulse/default.pa"; then + echo 'load-module module-switch-on-connect' >> "/etc/pulse/default.pa" + fi + # enable ping for user + if [ ! -e "/etc/sysctl.d/10-custom-ping-group.conf" ]; then + echo 'net.ipv4.ping_group_range=1000 1000' >> "/etc/sysctl.d/10-custom-ping-group.conf" + fi + # set release message + echo DISTRIB_ID=Phytium > /etc/lsb-release + echo DISTRIB_RELEASE=1.0 >> /etc/lsb-release + echo DISTRIB_CODENAME=1.0 >> /etc/lsb-release + echo 'DISTRIB_DESCRIPTION="Phytium Pi OS V1.6"' >> /etc/lsb-release + sed -i 's/ID=Phytium/ID=debian/' "/usr/lib/os-release" + echo '#!/bin/sh' > /etc/update-motd.d/10-help-text + echo 'printf "\n"' >> /etc/update-motd.d/10-help-text + echo 'printf " * Support: https://gitee.com/phytium_embedded/phytium-pi-os\n"' >> /etc/update-motd.d/10-help-text + chmod +x /etc/update-motd.d/00-header + chmod +x /etc/update-motd.d/10-help-text + chmod -x /etc/update-motd.d/10-uname + echo -n > $RFSDIR/etc/motd + # cups disable TLSv1.0 and TLSv1.1 + if [ -f /etc/cups/cupsd.conf ]; then + if ! grep -q '^SSLOptions MinTLS1.2' "/etc/cups/cupsd.conf"; then + echo "SSLOptions MinTLS1.2" >> "/etc/cups/cupsd.conf" + fi + fi + + if dpkg -s openssh-server &> /dev/null; then + sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config + #ssh: disable weak MAC algorithm + if ! grep -q '^MACs hmac-sha2-256,hmac-sha2-512' "/etc/ssh/sshd_config"; then + echo "MACs hmac-sha2-256,hmac-sha2-512" >> "/etc/ssh/sshd_config" + fi + fi + # rm display-manager for phytium-firstlogin + rm -f /etc/systemd/system/display-manager.service + # touch .desktop_firstrun for phytium-firstlogin + if [ ! -e "/root/.desktop_firstlogin" ]; then + touch /root/.desktop_firstlogin + fi + # touch for phytium-firstlogin + if [ ! -e "/root/.not_logged_in_yet" ]; then + touch /root/.not_logged_in_yet + fi +} # rootfs_configure + # replace_uboot_and_fitImage # $1: can be all\uboot\fitImage # $2: can be latest\v1.5\msata, etc replace_uboot_and_fitImage() { - uboot_type=optee - if [ "$2" == "msata" ]; then - uboot_type=msata - elif [ "$2" == "5g" ]; then - uboot_type=5g - fi - uboot_bin="fip-all-$uboot_type-$mem.bin" - if [ "$1" == "all" ]; then + echo -e "\033[1;32mdownload phytium-tools...\033[0m" + dpkg -i $dest_dir/rootfs/$2/phytium-tools.deb + echo -e "\033[1;32mcheck hash...\033[0m" + check-hash $hash_dir/uboot/$2/$uboot_hash $dest_dir/uboot/$2/$uboot_bin $uboot_bin + check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb + check-hash $hash_dir/rootfs/$2/phytium-desktop-tools.deb.hash $dest_dir/rootfs/$2/phytium-desktop-tools.deb phytium-desktop-tools.deb + check-hash $hash_dir/rootfs/$2/phytium-firstlogin.deb.hash $dest_dir/rootfs/$2/phytium-firstlogin.deb phytium-firstlogin.deb + check-hash $hash_dir/rootfs/$2/phytium-vpu.deb.hash $dest_dir/rootfs/$2/phytium-vpu.deb phytium-vpu.deb + check-hash $hash_dir/rootfs/$2/phytium-zram.deb.hash $dest_dir/rootfs/$2/phytium-zram.deb phytium-zram.deb + check-hash $hash_dir/rootfs/$2/rootfs-chown.deb.hash $dest_dir/rootfs/$2/rootfs-chown.deb rootfs-chown.deb echo -e "\033[1;32mupdate uboot...\033[0m" - #to preserve the partition table. + # to preserve the partition table. dd if=/dev/mmcblk0 of=start.img bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 dd if=$dest_dir/uboot/$2/$uboot_bin of=/dev/mmcblk0 bs=1M count=4 >> $dest_dir/uboot/$2/replace.log 2>&1 dd if=start.img of=/dev/mmcblk0 bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 @@ -157,14 +243,31 @@ replace_uboot_and_fitImage() { dd if=$dest_dir/fitImage/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/fitImage/$2/$kernel_version/replace.log 2>&1 dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb + echo -e "\033[1;32mupdate rootfs...\033[0m" + install_and_remove_packages + cp -f $dest_dir/rootfs/$2/lscpu /usr/bin/ + dpkg -i $dest_dir/rootfs/$2/phytium-desktop-tools.deb + dpkg -i $dest_dir/rootfs/$2/phytium-firstlogin.deb + dpkg -i $dest_dir/rootfs/$2/phytium-vpu.deb + dpkg -i $dest_dir/rootfs/$2/phytium-zram.deb + dpkg -i $dest_dir/rootfs/$2/rootfs-chown.deb + rootfs_configure elif [ "$1" == "uboot" ]; then + echo -e "\033[1;32mcheck hash...\033[0m" + check-hash $hash_dir/uboot/$2/$uboot_hash $dest_dir/uboot/$2/$uboot_bin $uboot_bin + echo -e "\033[1;32mupdate uboot...\033[0m" - #to preserve the partition table. + # to preserve the partition table. dd if=/dev/mmcblk0 of=start.img bs=512 count=1 >> $dest_dir/$1/$2/replace.log 2>&1 dd if=$dest_dir/$1/$2/$uboot_bin of=/dev/mmcblk0 bs=1M count=4 >> $dest_dir/$1/$2/replace.log 2>&1 dd if=start.img of=/dev/mmcblk0 bs=512 count=1 >> $dest_dir/$1/$2/replace.log 2>&1 rm -f start.img elif [ "$1" == "fitImage" ]; then + echo -e "\033[1;32mcheck hash...\033[0m" + check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb + echo -e "\033[1;32mupdate fitImage...\033[0m" dd if=$dest_dir/$1/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/$1/$2/$kernel_version/replace.log 2>&1 dpkg -i $dest_dir/$1/$2/$kernel_version/linux-headers-$kernel_version.deb -- Gitee From 0776056515412723cedf6a27fc3a28498ee8d2d7 Mon Sep 17 00:00:00 2001 From: lindongping Date: Thu, 5 Dec 2024 14:41:44 +0800 Subject: [PATCH 2/8] add package phytium-ota Signed-off-by: lindongping --- configs/phytiumpi_defconfig | 3 + configs/phytiumpi_desktop_defconfig | 3 + package/Config.in | 1 + package/phytium-ota/Config.in | 2 + package/phytium-ota/phytium-ota.mk | 23 +++ .../src/check-hash | 0 package/phytium-ota/src/check-latest | 48 +++++ .../fitImage/latest/5.10/fitImage.hash | 0 .../latest/5.10/linux-headers-5.10.deb.hash | 0 .../latest/5.10/linux-image-5.10.deb.hash | 0 .../phytium-ota-hash/rootfs/latest/lscpu.hash | 0 .../latest/phytium-desktop-tools.deb.hash | 0 .../rootfs/latest/phytium-firstlogin.deb.hash | 0 .../rootfs/latest/phytium-tools.deb.hash | 2 + .../rootfs/latest/phytium-vpu.deb.hash | 0 .../rootfs/latest/phytium-zram.deb.hash | 0 .../rootfs/latest/rootfs-chown.deb.hash | 0 .../uboot/5g/fip-all-5g-4GB.bin.hash | 0 .../uboot/latest/fip-all-optee-2GB.bin.hash | 0 .../uboot/latest/fip-all-optee-4GB.bin.hash | 0 .../uboot/msata/fip-all-msata-4GB.bin.hash | 0 .../uboot/v1.5/fip-all-optee-2GB.bin.hash | 0 .../uboot/v1.5/fip-all-optee-4GB.bin.hash | 0 .../fitImage/fitImage_latest.hash | 1 + .../rootfs/rootfs_latest.hash | 1 + .../uboot/uboot_latest.hash | 2 + .../src/phytium_ota | 177 +++++++----------- package/phytium-ota/src/rootfs_ota | 81 ++++++++ package/phytium-tools/phytium-tools.mk | 4 - .../fitImage/latest/6.6/fitImage.hash | 1 - .../latest/6.6/linux-headers-6.6.deb.hash | 1 - .../latest/6.6/linux-image-6.6.deb.hash | 1 - 32 files changed, 235 insertions(+), 116 deletions(-) create mode 100644 package/phytium-ota/Config.in create mode 100644 package/phytium-ota/phytium-ota.mk rename package/{phytium-tools => phytium-ota}/src/check-hash (100%) create mode 100755 package/phytium-ota/src/check-latest rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/rootfs/latest/lscpu.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash (100%) create mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash (100%) rename package/{phytium-tools => phytium-ota}/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash (100%) create mode 100644 package/phytium-ota/src/phytium-ota-latest/fitImage/fitImage_latest.hash create mode 100644 package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash create mode 100644 package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash rename package/{phytium-tools => phytium-ota}/src/phytium_ota (45%) create mode 100755 package/phytium-ota/src/rootfs_ota delete mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash delete mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash delete mode 100644 package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash diff --git a/configs/phytiumpi_defconfig b/configs/phytiumpi_defconfig index ecf5d66e..63e7caca 100644 --- a/configs/phytiumpi_defconfig +++ b/configs/phytiumpi_defconfig @@ -73,6 +73,9 @@ BR2_PACKAGE_PHYTIUM_FIRSTLOGIN=y # Phytium_zram BR2_PACKAGE_PHYTIUM_ZRAM=y +# Phytium_ota +BR2_PACKAGE_PHYTIUM_OTA=y + # util-linux BR2_PACKAGE_UTIL_LINUX=y BR2_PACKAGE_UTIL_LINUX_BINARIES=y diff --git a/configs/phytiumpi_desktop_defconfig b/configs/phytiumpi_desktop_defconfig index 8e59894b..59766bc5 100644 --- a/configs/phytiumpi_desktop_defconfig +++ b/configs/phytiumpi_desktop_defconfig @@ -68,6 +68,9 @@ BR2_PACKAGE_PHYTIUM_FIRSTLOGIN=y # Phytium_zram BR2_PACKAGE_PHYTIUM_ZRAM=y +# Phytium_ota +BR2_PACKAGE_PHYTIUM_OTA=y + BR2_PACKAGE_ROOTFS_DESKTOP=y BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt board/phytium/common/desktop_device_table.txt" BR2_PACKAGE_BUSYBOX=n diff --git a/package/Config.in b/package/Config.in index b7545544..e3ac7afa 100644 --- a/package/Config.in +++ b/package/Config.in @@ -244,6 +244,7 @@ menu "Filesystem and flash utilities" source "package/phytium-desktop-tools/Config.in" source "package/phytium-firstlogin/Config.in" source "package/phytium-zram/Config.in" + source "package/phytium-ota/Config.in" endmenu menu "Fonts, cursors, icons, sounds and themes" diff --git a/package/phytium-ota/Config.in b/package/phytium-ota/Config.in new file mode 100644 index 00000000..85c7dabd --- /dev/null +++ b/package/phytium-ota/Config.in @@ -0,0 +1,2 @@ +config BR2_PACKAGE_PHYTIUM_OTA + bool "phytium_ota" diff --git a/package/phytium-ota/phytium-ota.mk b/package/phytium-ota/phytium-ota.mk new file mode 100644 index 00000000..46384ffd --- /dev/null +++ b/package/phytium-ota/phytium-ota.mk @@ -0,0 +1,23 @@ +################################################################################ +# +# phytium-ota +# +################################################################################ + +PHYTIUM_OTA_VERSION = 0.1 +PHYTIUM_OTA_SITE = package/phytium-ota/src +PHYTIUM_OTA_SITE_METHOD = local +PHYTIUM_OTA_INSTALL_TARGET = YES + +define PHYTIUM_OTA_INSTALL_TARGET_CMDS + mkdir -p $(TARGET_DIR)/usr/bin + mkdir -p $(TARGET_DIR)/usr/lib/phytium/ + $(INSTALL) -m 755 -D $(@D)/phytium_ota $(TARGET_DIR)/usr/bin/ + $(INSTALL) -m 755 -D $(@D)/check-hash $(TARGET_DIR)/usr/bin/ + $(INSTALL) -m 755 -D $(@D)/check-latest $(TARGET_DIR)/usr/bin/ + $(INSTALL) -m 755 -D $(@D)/rootfs_ota $(TARGET_DIR)/usr/bin/ + cp -rf $(@D)/phytium-ota-hash/ $(TARGET_DIR)/usr/lib/phytium/ + cp -rf $(@D)/phytium-ota-latest/ $(TARGET_DIR)/usr/lib/phytium/ +endef + +$(eval $(generic-package)) diff --git a/package/phytium-tools/src/check-hash b/package/phytium-ota/src/check-hash similarity index 100% rename from package/phytium-tools/src/check-hash rename to package/phytium-ota/src/check-hash diff --git a/package/phytium-ota/src/check-latest b/package/phytium-ota/src/check-latest new file mode 100755 index 00000000..0aea00b6 --- /dev/null +++ b/package/phytium-ota/src/check-latest @@ -0,0 +1,48 @@ +#!/bin/bash +set -e + +latest_dir="/usr/lib/phytium/phytium-ota-latest" + +mem_info=$(LC_ALL=C free -w 2>/dev/null | grep "^Mem" || LC_ALL=C free | grep "^Mem") +mem_info=$(echo $mem_info | awk '{print $2}') +memory_total=$(( mem_info * 1024 )) +# compare to 3GB +if [ $memory_total -ge 3221225472 ]; then + mem=4GB +else + mem=2GB +fi + +if [ $2 = "uboot" ]; then + _hash=$( sha256sum "$1/$2/latest/fip-all-optee-$mem.bin" |cut -d ' ' -f 1 ) +elif [ $2 = "fitImage" ]; then + _hash=$( sha256sum "$1/$2/latest/5.10/$2.tar" |cut -d ' ' -f 1 ) +elif [ $2 = "rootfs" ]; then + _hash=$( sha256sum "$1/$2/latest/$2.tar" |cut -d ' ' -f 1 ) +fi + +if [ ! -e "$latest_dir/$2/$2_latest.hash" ]; then + mkdir -p $latest_dir/$2 + if [ $2 = "uboot" ]; then + echo "sha256 ${_hash} fip-all-optee-$mem.bin" > $latest_dir/$2/$2_latest.hash + else + echo "sha256 ${_hash} $2.tar" > $latest_dir/$2/$2_latest.hash + fi + echo "no_latest" + exit +else + _known=$(cat $latest_dir/$2/$2_latest.hash | cut -d ' ' -f 3) +fi + +# Do the hashes match? +if [ "${_hash}" = "${_known}" ]; then + echo "latest" +else + mkdir -p $latest_dir/$2 + if [ $2 = "uboot" ]; then + echo "sha256 ${_hash} fip-all-optee-$mem.bin" > $latest_dir/$2/$2_latest.hash + else + echo "sha256 ${_hash} $2.tar" > $latest_dir/$2/$2_latest.hash + fi + echo "no_latest" +fi diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash b/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash rename to package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash b/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash rename to package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash b/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash rename to package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/lscpu.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/lscpu.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/rootfs/latest/lscpu.hash rename to package/phytium-ota/src/phytium-ota-hash/rootfs/latest/lscpu.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash rename to package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash rename to package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash new file mode 100644 index 00000000..dc6d3f41 --- /dev/null +++ b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash @@ -0,0 +1,2 @@ +sha256 51365d89cde46b7e9397675c9d90540a90ff38d4ba9b78e2d035a2b7c0113de3 phytium-tools.deb + diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash rename to package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash rename to package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash rename to package/phytium-ota/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash rename to package/phytium-ota/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash rename to package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash rename to package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash rename to package/phytium-ota/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash rename to package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash diff --git a/package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash similarity index 100% rename from package/phytium-tools/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash rename to package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash diff --git a/package/phytium-ota/src/phytium-ota-latest/fitImage/fitImage_latest.hash b/package/phytium-ota/src/phytium-ota-latest/fitImage/fitImage_latest.hash new file mode 100644 index 00000000..f386af46 --- /dev/null +++ b/package/phytium-ota/src/phytium-ota-latest/fitImage/fitImage_latest.hash @@ -0,0 +1 @@ +sha256 f668e6a510588b93e13514a090c24c84395ca51cf53787185c8e625ddea37175 fitImage.tar diff --git a/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash b/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash new file mode 100644 index 00000000..db4f0b1e --- /dev/null +++ b/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash @@ -0,0 +1 @@ +sha256 f4cf68c7804912a56c81e4c02ef7b78d50a64ce9bb0984d278b45c3cc6404f5c rootfs.tar diff --git a/package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash b/package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash new file mode 100644 index 00000000..80d83247 --- /dev/null +++ b/package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash @@ -0,0 +1,2 @@ +sha256 7cc1bed898467814362553ace772ece3031819d1f62616ea6a66981014e72567 fip-all-optee-4GB.bin + diff --git a/package/phytium-tools/src/phytium_ota b/package/phytium-ota/src/phytium_ota similarity index 45% rename from package/phytium-tools/src/phytium_ota rename to package/phytium-ota/src/phytium_ota index c0e1d204..9e3f815a 100755 --- a/package/phytium-tools/src/phytium_ota +++ b/package/phytium-ota/src/phytium_ota @@ -146,112 +146,65 @@ get_uboot_and_fitImage() { } # get_uboot_and_fitImage -install_and_remove_packages() { - apt install -y locales audacity jq network-manager - apt remove -y dhcpcd5 -} # install_and_remove_package - -rootfs_configure() { - # rootfs-chown - systemctl enable systemd-rootfs-chown.service - # phytium-zram - systemctl enable phytium-zram-config.service - # phytium-vpu - systemctl enable phytium-vpu.service - - # disable default sink - sed -i 's/^default-sink = alsa_output.platform-sound.stereo-fallback/#&/' "/etc/pulse/client.conf" - # set kernel loglevel - sed -i 's/#kernel.printk = 3 4 1 3/kernel.printk = 4 4 1 7/' "/etc/sysctl.d/99-sysctl.conf" - # set the name of the sound output devices - sed -i 's/^update-sink-proplist 1 device.description=Headphone/#&/' "/etc/pulse/default.pa" - sed -i 's/^set-default-sink 1/#&/' "/etc/pulse/default.pa" - if ! grep -q '^update-sink-proplist 0 device.description=HDMI' "/etc/pulse/default.pa"; then - echo 'update-sink-proplist 0 device.description=HDMI' >> "/etc/pulse/default.pa" - fi - if ! grep -q '^load-module module-switch-on-connect' "/etc/pulse/default.pa"; then - echo 'load-module module-switch-on-connect' >> "/etc/pulse/default.pa" - fi - # enable ping for user - if [ ! -e "/etc/sysctl.d/10-custom-ping-group.conf" ]; then - echo 'net.ipv4.ping_group_range=1000 1000' >> "/etc/sysctl.d/10-custom-ping-group.conf" - fi - # set release message - echo DISTRIB_ID=Phytium > /etc/lsb-release - echo DISTRIB_RELEASE=1.0 >> /etc/lsb-release - echo DISTRIB_CODENAME=1.0 >> /etc/lsb-release - echo 'DISTRIB_DESCRIPTION="Phytium Pi OS V1.6"' >> /etc/lsb-release - sed -i 's/ID=Phytium/ID=debian/' "/usr/lib/os-release" - echo '#!/bin/sh' > /etc/update-motd.d/10-help-text - echo 'printf "\n"' >> /etc/update-motd.d/10-help-text - echo 'printf " * Support: https://gitee.com/phytium_embedded/phytium-pi-os\n"' >> /etc/update-motd.d/10-help-text - chmod +x /etc/update-motd.d/00-header - chmod +x /etc/update-motd.d/10-help-text - chmod -x /etc/update-motd.d/10-uname - echo -n > $RFSDIR/etc/motd - # cups disable TLSv1.0 and TLSv1.1 - if [ -f /etc/cups/cupsd.conf ]; then - if ! grep -q '^SSLOptions MinTLS1.2' "/etc/cups/cupsd.conf"; then - echo "SSLOptions MinTLS1.2" >> "/etc/cups/cupsd.conf" - fi - fi - - if dpkg -s openssh-server &> /dev/null; then - sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config - #ssh: disable weak MAC algorithm - if ! grep -q '^MACs hmac-sha2-256,hmac-sha2-512' "/etc/ssh/sshd_config"; then - echo "MACs hmac-sha2-256,hmac-sha2-512" >> "/etc/ssh/sshd_config" - fi - fi - # rm display-manager for phytium-firstlogin - rm -f /etc/systemd/system/display-manager.service - # touch .desktop_firstrun for phytium-firstlogin - if [ ! -e "/root/.desktop_firstlogin" ]; then - touch /root/.desktop_firstlogin - fi - # touch for phytium-firstlogin - if [ ! -e "/root/.not_logged_in_yet" ]; then - touch /root/.not_logged_in_yet - fi -} # rootfs_configure - # replace_uboot_and_fitImage # $1: can be all\uboot\fitImage # $2: can be latest\v1.5\msata, etc replace_uboot_and_fitImage() { + + echo -e "\033[1;32minstalling phytium-ota...\033[0m" + dpkg -i $dest_dir/rootfs/$2/phytium-ota.deb if [ "$1" == "all" ]; then - echo -e "\033[1;32mdownload phytium-tools...\033[0m" - dpkg -i $dest_dir/rootfs/$2/phytium-tools.deb - echo -e "\033[1;32mcheck hash...\033[0m" - check-hash $hash_dir/uboot/$2/$uboot_hash $dest_dir/uboot/$2/$uboot_bin $uboot_bin - check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb - check-hash $hash_dir/rootfs/$2/phytium-desktop-tools.deb.hash $dest_dir/rootfs/$2/phytium-desktop-tools.deb phytium-desktop-tools.deb - check-hash $hash_dir/rootfs/$2/phytium-firstlogin.deb.hash $dest_dir/rootfs/$2/phytium-firstlogin.deb phytium-firstlogin.deb - check-hash $hash_dir/rootfs/$2/phytium-vpu.deb.hash $dest_dir/rootfs/$2/phytium-vpu.deb phytium-vpu.deb - check-hash $hash_dir/rootfs/$2/phytium-zram.deb.hash $dest_dir/rootfs/$2/phytium-zram.deb phytium-zram.deb - check-hash $hash_dir/rootfs/$2/rootfs-chown.deb.hash $dest_dir/rootfs/$2/rootfs-chown.deb rootfs-chown.deb - echo -e "\033[1;32mupdate uboot...\033[0m" - # to preserve the partition table. - dd if=/dev/mmcblk0 of=start.img bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 - dd if=$dest_dir/uboot/$2/$uboot_bin of=/dev/mmcblk0 bs=1M count=4 >> $dest_dir/uboot/$2/replace.log 2>&1 - dd if=start.img of=/dev/mmcblk0 bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 - rm -f start.img - echo -e "\033[1;32mupdate fitImage...\033[0m" - dd if=$dest_dir/fitImage/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/fitImage/$2/$kernel_version/replace.log 2>&1 - dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb - dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb - echo -e "\033[1;32mupdate rootfs...\033[0m" - install_and_remove_packages - cp -f $dest_dir/rootfs/$2/lscpu /usr/bin/ - dpkg -i $dest_dir/rootfs/$2/phytium-desktop-tools.deb - dpkg -i $dest_dir/rootfs/$2/phytium-firstlogin.deb - dpkg -i $dest_dir/rootfs/$2/phytium-vpu.deb - dpkg -i $dest_dir/rootfs/$2/phytium-zram.deb - dpkg -i $dest_dir/rootfs/$2/rootfs-chown.deb - rootfs_configure + uboot_latest=$(check-latest $dest_dir uboot) + if [ "${uboot_latest}" = "latest" ]; then + echo -e "\033[1;32muboot is already latest, nothing to do...\033[0m" + else + echo -e "\033[1;32mcheck hash...\033[0m" + check-hash $hash_dir/uboot/$2/$uboot_hash $dest_dir/uboot/$2/$uboot_bin $uboot_bin + echo -e "\033[1;32mupdate uboot...\033[0m" + # to preserve the partition table. + dd if=/dev/mmcblk0 of=start.img bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 + dd if=$dest_dir/uboot/$2/$uboot_bin of=/dev/mmcblk0 bs=1M count=4 >> $dest_dir/uboot/$2/replace.log 2>&1 + dd if=start.img of=/dev/mmcblk0 bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 + rm -f start.img + fi + fitImage_latest=$(check-latest $dest_dir fitImage) + if [ "${fitImage_latest}" = "latest" ]; then + echo -e "\033[1;32mkernel is already latest, nothing to do...\033[0m" + else + tar -xvf $dest_dir/fitImage/$2/$kernel_version/fitImage.tar -C $dest_dir/fitImage/$2/$kernel_version/ + echo -e "\033[1;32mcheck hash...\033[0m" + check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb + echo -e "\033[1;32mupdate fitImage...\033[0m" + dd if=$dest_dir/fitImage/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/fitImage/$2/$kernel_version/replace.log 2>&1 + dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb + dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb + fi + rootfs_latest=$(check-latest $dest_dir rootfs) + if [ "${rootfs_latest}" = "latest" ]; then + echo -e "\033[1;32mrootfs is already latest, nothing to do...\033[0m" + else + tar -xvf $dest_dir/rootfs/$2/rootfs.tar -C $dest_dir/rootfs/$2/ + echo -e "\033[1;32mcheck hash...\033[0m" + check-hash $hash_dir/rootfs/$2/phytium-desktop-tools.deb.hash $dest_dir/rootfs/$2/phytium-desktop-tools.deb phytium-desktop-tools.deb + check-hash $hash_dir/rootfs/$2/phytium-firstlogin.deb.hash $dest_dir/rootfs/$2/phytium-firstlogin.deb phytium-firstlogin.deb + check-hash $hash_dir/rootfs/$2/phytium-vpu.deb.hash $dest_dir/rootfs/$2/phytium-vpu.deb phytium-vpu.deb + check-hash $hash_dir/rootfs/$2/phytium-zram.deb.hash $dest_dir/rootfs/$2/phytium-zram.deb phytium-zram.deb + check-hash $hash_dir/rootfs/$2/rootfs-chown.deb.hash $dest_dir/rootfs/$2/rootfs-chown.deb rootfs-chown.deb + check-hash $hash_dir/rootfs/$2/phytium-tools.deb.hash $dest_dir/rootfs/$2/phytium-tools.deb phytium-tools.deb + check-hash $hash_dir/rootfs/$2/lscpu.hash $dest_dir/rootfs/$2/lscpu lscpu + echo -e "\033[1;32mupdate rootfs...\033[0m" + cp -f $dest_dir/rootfs/$2/lscpu /usr/bin/ + dpkg -i $dest_dir/rootfs/$2/phytium-desktop-tools.deb + dpkg -i $dest_dir/rootfs/$2/phytium-firstlogin.deb + dpkg -i $dest_dir/rootfs/$2/phytium-vpu.deb + dpkg -i $dest_dir/rootfs/$2/phytium-zram.deb + dpkg -i $dest_dir/rootfs/$2/rootfs-chown.deb + dpkg -i $dest_dir/rootfs/$2/phytium-tools.deb + rootfs_ota + fi elif [ "$1" == "uboot" ]; then echo -e "\033[1;32mcheck hash...\033[0m" check-hash $hash_dir/uboot/$2/$uboot_hash $dest_dir/uboot/$2/$uboot_bin $uboot_bin @@ -263,15 +216,21 @@ replace_uboot_and_fitImage() { dd if=start.img of=/dev/mmcblk0 bs=512 count=1 >> $dest_dir/$1/$2/replace.log 2>&1 rm -f start.img elif [ "$1" == "fitImage" ]; then - echo -e "\033[1;32mcheck hash...\033[0m" - check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb - - echo -e "\033[1;32mupdate fitImage...\033[0m" - dd if=$dest_dir/$1/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/$1/$2/$kernel_version/replace.log 2>&1 - dpkg -i $dest_dir/$1/$2/$kernel_version/linux-headers-$kernel_version.deb - dpkg -i $dest_dir/$1/$2/$kernel_version/linux-image-$kernel_version.deb + tar -xvf $dest_dir/fitImage/$2/$kernel_version/fitImage.tar -C $dest_dir/fitImage/$2/$kernel_version/ + fitImage_latest=$(check-latest $dest_dir fitImage) + if [ "${fitImage_latest}" = "latest" ]; then + echo -e "\033[1;32mkernel is already latest, nothing to do...\033[0m" + else + tar -xvf $dest_dir/fitImage/$2/$kernel_version/fitImage.tar -C $dest_dir/fitImage/$2/$kernel_version/ + echo -e "\033[1;32mcheck hash...\033[0m" + check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb + check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb + echo -e "\033[1;32mupdate fitImage...\033[0m" + dd if=$dest_dir/fitImage/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/fitImage/$2/$kernel_version/replace.log 2>&1 + dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb + dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb + fi else echo -e "\033[1;31margs error, exit\033[0m" fi diff --git a/package/phytium-ota/src/rootfs_ota b/package/phytium-ota/src/rootfs_ota new file mode 100755 index 00000000..86f234ca --- /dev/null +++ b/package/phytium-ota/src/rootfs_ota @@ -0,0 +1,81 @@ +#!/bin/bash + +# Phytium phytiumpi rootfs_ota script +# +# Copyright (c) 2024 Phytium Technology Co., Ltd. +# +# rootfs_ota - To update rootfs to the latest for phytiumpi development board. +# + + +install_and_remove_packages() { + apt install -y locales audacity jq network-manager + apt remove -y dhcpcd5 +} # install_and_remove_package + +rootfs_configure() { + # rootfs-chown + systemctl enable systemd-rootfs-chown.service + # phytium-zram + systemctl enable phytium-zram-config.service + # phytium-vpu + systemctl enable phytium-vpu.service + + # disable default sink + sed -i 's/^default-sink = alsa_output.platform-sound.stereo-fallback/#&/' "/etc/pulse/client.conf" + # set kernel loglevel + sed -i 's/#kernel.printk = 3 4 1 3/kernel.printk = 4 4 1 7/' "/etc/sysctl.d/99-sysctl.conf" + # set the name of the sound output devices + sed -i 's/^update-sink-proplist 1 device.description=Headphone/#&/' "/etc/pulse/default.pa" + sed -i 's/^set-default-sink 1/#&/' "/etc/pulse/default.pa" + if ! grep -q '^update-sink-proplist 0 device.description=HDMI' "/etc/pulse/default.pa"; then + echo 'update-sink-proplist 0 device.description=HDMI' >> "/etc/pulse/default.pa" + fi + if ! grep -q '^load-module module-switch-on-connect' "/etc/pulse/default.pa"; then + echo 'load-module module-switch-on-connect' >> "/etc/pulse/default.pa" + fi + # enable ping for user + if [ ! -e "/etc/sysctl.d/10-custom-ping-group.conf" ]; then + echo 'net.ipv4.ping_group_range=1000 1000' >> "/etc/sysctl.d/10-custom-ping-group.conf" + fi + # set release message + echo DISTRIB_ID=Phytium > /etc/lsb-release + echo DISTRIB_RELEASE=1.0 >> /etc/lsb-release + echo DISTRIB_CODENAME=1.0 >> /etc/lsb-release + echo 'DISTRIB_DESCRIPTION="Phytium Pi OS V1.6"' >> /etc/lsb-release + sed -i 's/ID=Phytium/ID=debian/' "/usr/lib/os-release" + echo '#!/bin/sh' > /etc/update-motd.d/10-help-text + echo 'printf "\n"' >> /etc/update-motd.d/10-help-text + echo 'printf " * Support: https://gitee.com/phytium_embedded/phytium-pi-os\n"' >> /etc/update-motd.d/10-help-text + chmod +x /etc/update-motd.d/00-header + chmod +x /etc/update-motd.d/10-help-text + chmod -x /etc/update-motd.d/10-uname + echo -n > $RFSDIR/etc/motd + # cups disable TLSv1.0 and TLSv1.1 + if [ -f /etc/cups/cupsd.conf ]; then + if ! grep -q '^SSLOptions MinTLS1.2' "/etc/cups/cupsd.conf"; then + echo "SSLOptions MinTLS1.2" >> "/etc/cups/cupsd.conf" + fi + fi + + if dpkg -s openssh-server &> /dev/null; then + sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config + #ssh: disable weak MAC algorithm + if ! grep -q '^MACs hmac-sha2-256,hmac-sha2-512' "/etc/ssh/sshd_config"; then + echo "MACs hmac-sha2-256,hmac-sha2-512" >> "/etc/ssh/sshd_config" + fi + fi + # rm display-manager for phytium-firstlogin + rm -f /etc/systemd/system/display-manager.service + # touch .desktop_firstrun for phytium-firstlogin + if [ ! -e "/root/.desktop_firstlogin" ]; then + touch /root/.desktop_firstlogin + fi + # touch for phytium-firstlogin + if [ ! -e "/root/.not_logged_in_yet" ]; then + touch /root/.not_logged_in_yet + fi +} # rootfs_configure + +install_and_remove_packages +rootfs_configure diff --git a/package/phytium-tools/phytium-tools.mk b/package/phytium-tools/phytium-tools.mk index 70bcc71b..9037d724 100644 --- a/package/phytium-tools/phytium-tools.mk +++ b/package/phytium-tools/phytium-tools.mk @@ -16,7 +16,6 @@ define PHYTIUM_TOOLS_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/lib/firmware/rtw88/ mkdir -p $(TARGET_DIR)/lib/firmware/rtl_bt/ mkdir -p $(TARGET_DIR)/etc/modprobe.d/ - mkdir -p $(TARGET_DIR)/usr/lib/phytium/ $(INSTALL) -m 755 -D $(@D)/rtlbt/* $(TARGET_DIR)/lib/firmware/rtlbt/ $(INSTALL) -m 755 -D $(@D)/rtk_hciattach $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 755 -D $(@D)/resize.sh $(TARGET_DIR)/usr/bin/ @@ -27,10 +26,7 @@ define PHYTIUM_TOOLS_INSTALL_TARGET_CMDS $(INSTALL) -m 755 -D $(@D)/rtlbt/rtl8821c_config $(TARGET_DIR)/lib/firmware/rtl_bt/rtl8821c_config.bin $(INSTALL) -m 755 -D $(@D)/rtlbt/rtl8821c_fw $(TARGET_DIR)/lib/firmware/rtl_bt/rtl8821c_fw.bin $(INSTALL) -m 755 -D $(@D)/rtw88.conf $(TARGET_DIR)/etc/modprobe.d/ - $(INSTALL) -m 755 -D $(@D)/phytium_ota $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 755 -D $(@D)/quectel-CM $(TARGET_DIR)/usr/bin/ - $(INSTALL) -m 755 -D $(@D)/check-hash $(TARGET_DIR)/usr/bin/ - cp -rf $(@D)/phytium-ota-hash/ $(TARGET_DIR)/usr/lib/phytium/ endef $(eval $(generic-package)) diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash deleted file mode 100644 index fcd7f715..00000000 --- a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/fitImage.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 7227f5d936e30ada647381b6b07010bc837d2167399c35abdf02c24255743fa9 fitImage diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash deleted file mode 100644 index 54f25259..00000000 --- a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-headers-6.6.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 a2e62b56a15589ef3952e70b96d9d64056bf0fc16170f92bd22c5fc6f54b0d56 linux-headers-6.6.deb diff --git a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash b/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash deleted file mode 100644 index 4e034910..00000000 --- a/package/phytium-tools/src/phytium-ota-hash/fitImage/latest/6.6/linux-image-6.6.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 daaa543f0e58eb7886dc1585874828d5734b5b6e913f870134f53dc0e02e846d linux-image-6.6.deb -- Gitee From 41a5106c10d344b8380d6dccdc30ceafb57bd7aa Mon Sep 17 00:00:00 2001 From: lindongping Date: Tue, 4 Mar 2025 10:25:29 +0800 Subject: [PATCH 3/8] add udev script for monitor hotplug Signed-off-by: lindongping --- board/phytium/common/debian-package-installer | 6 +--- .../phytium-desktop-tools.mk | 4 +++ .../src/99-monitor-hotplug.rules | 1 + .../src/auto_resolution.sh | 28 +++++++++++++++++++ 4 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 package/phytium-desktop-tools/src/99-monitor-hotplug.rules create mode 100755 package/phytium-desktop-tools/src/auto_resolution.sh diff --git a/board/phytium/common/debian-package-installer b/board/phytium/common/debian-package-installer index a11d012c..c4e7d62d 100755 --- a/board/phytium/common/debian-package-installer +++ b/board/phytium/common/debian-package-installer @@ -53,15 +53,11 @@ do_distrorfs_second_stage() { echo installed additional packages. if [ $6 = desktop ]; then - for pkg in task-xfce-desktop ukui-greeter; do + for pkg in task-xfce-desktop; do DEBIAN_FRONTEND=noninteractive apt -y install $pkg || true done rm -f /etc/systemd/system/display-manager.service - sed -i "s/gdm3/lightdm/" /etc/X11/default-display-manager - echo '[SeatDefaults]' >> /etc/lightdm/lightdm.conf - echo 'greeter-session=ukui-greeter' >> /etc/lightdm/lightdm.conf - echo 'user-session=xfce' >> /etc/lightdm/lightdm.conf echo installing desktop packages list packages: $pkglist for pkg in $additional_desktop_packages_list; do diff --git a/package/phytium-desktop-tools/phytium-desktop-tools.mk b/package/phytium-desktop-tools/phytium-desktop-tools.mk index 01bfa5d2..fec296f0 100644 --- a/package/phytium-desktop-tools/phytium-desktop-tools.mk +++ b/package/phytium-desktop-tools/phytium-desktop-tools.mk @@ -16,6 +16,8 @@ define PHYTIUM_DESKTOP_TOOLS_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/usr/share/desktop-base/profiles/xdg-config/xfce4/xfconf/xfce-perchannel-xml/ mkdir -p $(TARGET_DIR)/var/lib/alsa/ mkdir -p $(TARGET_DIR)/usr/share/alsa/ucm2/ + mkdir -p $(TARGET_DIR)/usr/local/bin/ + mkdir -p $(TARGET_DIR)/etc/udev/rules.d/ $(INSTALL) -m 777 -D $(@D)/dark.jpg $(TARGET_DIR)/usr/share/images/desktop-base/ $(INSTALL) -m 755 -D $(@D)/01_debian.conf $(TARGET_DIR)/usr/share/lightdm/lightdm-gtk-greeter.conf.d/ $(INSTALL) -m 755 -D $(@D)/xfce4-desktop.xml $(TARGET_DIR)/usr/share/desktop-base/profiles/xdg-config/xfce4/xfconf/xfce-perchannel-xml/ @@ -24,6 +26,8 @@ define PHYTIUM_DESKTOP_TOOLS_INSTALL_TARGET_CMDS cp -rf $(@D)/phytium_pe220x-/ $(TARGET_DIR)/usr/share/alsa/ucm2/ $(INSTALL) -m 755 -D $(@D)/switch_to_headphone.sh $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 644 -D $(@D)/sound_output_device_switching.desktop $(TARGET_DIR)/usr/share/alsa/ucm2/ + $(INSTALL) -m 755 -D $(@D)/auto_resolution.sh $(TARGET_DIR)/usr/local/bin/ + $(INSTALL) -m 644 -D $(@D)/99-monitor-hotplug.rules $(TARGET_DIR)/etc/udev/rules.d/ endef $(eval $(generic-package)) diff --git a/package/phytium-desktop-tools/src/99-monitor-hotplug.rules b/package/phytium-desktop-tools/src/99-monitor-hotplug.rules new file mode 100644 index 00000000..bdfa70d3 --- /dev/null +++ b/package/phytium-desktop-tools/src/99-monitor-hotplug.rules @@ -0,0 +1 @@ +SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/auto_resolution.sh" diff --git a/package/phytium-desktop-tools/src/auto_resolution.sh b/package/phytium-desktop-tools/src/auto_resolution.sh new file mode 100755 index 00000000..38dd6ef9 --- /dev/null +++ b/package/phytium-desktop-tools/src/auto_resolution.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# check if on the greeter interface +IS_GREETER=$(loginctl show-session $(loginctl | grep 'lightdm' | awk '{print $1}') --property=State | grep -q "active" && echo "yes" || echo "no") +if [[ "$IS_GREETER" != "yes" ]]; then + exit 0 +fi + +export DISPLAY=:0 +export XAUTHORITY=$HOME/.Xauthority + +if [[ ! -e "$XAUTHORITY" ]]; then + touch "$XAUTHORITY" +fi + +xauth add $(xauth -f /var/run/lightdm/root/:0 list) + +# check the connection status of the screen +connected_output=$(xrandr --query | grep " connected" | awk '{print $1}') +for output in $connected_output; do + # set the optimal resolution + preferred_mode=$(xrandr --query | grep -A 1 "^$output" | tail -n 1 | awk '{print $1}') + if [ -n "$preferred_mode" ]; then + echo "Setting $output to $preferred_mode" + xrandr --output "$output" --mode "$preferred_mode" + fi +done + -- Gitee From 421254078ef6d3b426170596f34f5d0a14a86174 Mon Sep 17 00:00:00 2001 From: lindongping Date: Tue, 18 Feb 2025 15:17:53 +0800 Subject: [PATCH 4/8] phytium-firstlogin: fix error when hdmi is not connected Signed-off-by: lindongping --- package/phytium-firstlogin/src/phytium-firstlogin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/phytium-firstlogin/src/phytium-firstlogin b/package/phytium-firstlogin/src/phytium-firstlogin index 1e7ea471..b44b9183 100755 --- a/package/phytium-firstlogin/src/phytium-firstlogin +++ b/package/phytium-firstlogin/src/phytium-firstlogin @@ -502,7 +502,7 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then systemctl is-system-running --wait > /dev/null # enable hiDPI support - if [[ "$(cut -d, -f1 < /sys/class/graphics/fb0/virtual_size 2> /dev/null)" -gt 1920 ]]; then + if [[ "$( (cut -d, -f1 < /sys/class/graphics/fb0/virtual_size) 2> /dev/null)" -gt 1920 ]]; then # lightdm [[ -f /etc/lightdm/slick-greeter.conf ]] && echo "enable-hidpi = on" >> /etc/lightdm/slick-greeter.conf # xfce -- Gitee From 0c564f270c97ed22262dce84e98bba68d3601ffe Mon Sep 17 00:00:00 2001 From: lindongping Date: Fri, 28 Feb 2025 15:02:24 +0800 Subject: [PATCH 5/8] add firmware config scripts and set uboot default to hw v3, mem 4g and pcie usb3. Signed-off-by: lindongping --- board/phytium/common/post-build.sh | 2 + configs/phytiumpi_5g.config | 1 - .../phytium-firstlogin/src/phytium-firstlogin | 58 +++++++ package/phytium-tools/phytium-tools.mk | 8 + .../pad_set_v2.x.bin.hash | 1 + .../pad_set_v3.bin.hash | 1 + .../para_5g_usb3.bin.hash | 1 + .../para_msata.bin.hash | 1 + .../para_nvme_usb2.bin.hash | 1 + .../src/firmware-configure/pad_set_v2.x.bin | Bin 0 -> 1088 bytes .../src/firmware-configure/pad_set_v3.bin | Bin 0 -> 1088 bytes .../src/firmware-configure/para_5g_usb3.bin | Bin 0 -> 1568 bytes .../src/firmware-configure/para_msata.bin | Bin 0 -> 1568 bytes .../src/firmware-configure/para_nvme_usb2.bin | Bin 0 -> 1568 bytes package/phytium-tools/src/ft-config | 161 ++++++++++++++++++ package/phytium-tools/src/init_pwm_fan.sh | 10 ++ package/phytium-tools/src/pwm-fan.service | 9 + package/phytium-tools/src/pwm_fan.sh | 16 ++ package/phyuboot/phyuboot.mk | 1 - 19 files changed, 269 insertions(+), 2 deletions(-) create mode 100644 package/phytium-tools/src/firmware-configure-hash/pad_set_v2.x.bin.hash create mode 100644 package/phytium-tools/src/firmware-configure-hash/pad_set_v3.bin.hash create mode 100644 package/phytium-tools/src/firmware-configure-hash/para_5g_usb3.bin.hash create mode 100644 package/phytium-tools/src/firmware-configure-hash/para_msata.bin.hash create mode 100644 package/phytium-tools/src/firmware-configure-hash/para_nvme_usb2.bin.hash create mode 100644 package/phytium-tools/src/firmware-configure/pad_set_v2.x.bin create mode 100644 package/phytium-tools/src/firmware-configure/pad_set_v3.bin create mode 100644 package/phytium-tools/src/firmware-configure/para_5g_usb3.bin create mode 100644 package/phytium-tools/src/firmware-configure/para_msata.bin create mode 100644 package/phytium-tools/src/firmware-configure/para_nvme_usb2.bin create mode 100755 package/phytium-tools/src/ft-config create mode 100755 package/phytium-tools/src/init_pwm_fan.sh create mode 100644 package/phytium-tools/src/pwm-fan.service create mode 100755 package/phytium-tools/src/pwm_fan.sh diff --git a/board/phytium/common/post-build.sh b/board/phytium/common/post-build.sh index d20f5a30..165dcbcf 100755 --- a/board/phytium/common/post-build.sh +++ b/board/phytium/common/post-build.sh @@ -113,6 +113,8 @@ main() if grep -Eq "^BR2_PACKAGE_PHYTIUM_ZRAM=y$" ${BR2_CONFIG}; then sudo chroot ${1} systemctl enable phytium-zram-config.service fi + # pwm-fan.service + sudo chroot ${1} systemctl enable pwm-fan.service exit $? } diff --git a/configs/phytiumpi_5g.config b/configs/phytiumpi_5g.config index 4c437959..1345041e 100644 --- a/configs/phytiumpi_5g.config +++ b/configs/phytiumpi_5g.config @@ -1,3 +1,2 @@ # kernel patch for linux-5.10 BR2_LINUX_KERNEL_PATCH="$(LINUX_PKGDIR)/kernel-patches/5g/0001-port-Quectel-usb-serial-option-driver.patch" -BR2_PACKAGE_PHYUBOOT_5G=y diff --git a/package/phytium-firstlogin/src/phytium-firstlogin b/package/phytium-firstlogin/src/phytium-firstlogin index b44b9183..8a78adf6 100755 --- a/package/phytium-firstlogin/src/phytium-firstlogin +++ b/package/phytium-firstlogin/src/phytium-firstlogin @@ -475,6 +475,59 @@ add_user() { } +fm_patch_dir="/lib/firmware/uboot-patch" +fm_patch_hash_dir="/lib/firmware/uboot-patch-hash" +fm_patch_check_dd_dir="/lib/firmware/uboot-patch-check-dd" +# check if the dd command was successful. +# $1: the file to be checked. +# $2: the starting position of the file to be checked in the firmware. +# $3: the size of the file to be checked. +check-if-dd-success() { + mkdir -p $fm_patch_check_dd_dir + file=$(basename $1 .bin) + dd if=/dev/mmcblk0 of=$fm_patch_check_dd_dir/recovered_$file.bin bs=$2 skip=1 count=1 + dd if=$fm_patch_check_dd_dir/recovered_$file.bin of=$fm_patch_check_dd_dir/final_$file.bin bs=1 count=$3 + _hash=$(sha256sum $fm_patch_check_dd_dir/final_$file.bin | cut -d ' ' -f 1 ) + _known=$(cat $fm_patch_hash_dir/$1.hash | cut -d ' ' -f 3 ) + # Do the hashes match? + if [ "${_hash}" = "${_known}" ]; then + echo -e "\033[1;32mHash verification succeeded, configuration has been updated.\033[0m" + else + echo -e "\033[1;31mHash verification failed, configuration update encountered an error. You may need to manually update the firmware. See https://gitee.com/phytium_embedded/phytium-pi-os/wikis/phytium_ota%E4%BB%8B%E7%BB%8D%E4%B8%8E%E4%BD%BF%E7%94%A8的启动异常补救措施小节\033[0m" + exit 1 + fi +} +firmware_configure(){ + echo "" + echo -e "Configure firmware." + flag=0 + unset response + while [[ ! "${response}" =~ ^(Y|y|N|n)$ ]]; do + read -r -p "Is the phytiumpi hardware version v2? [Y/n] " response + echo "$response" + done + if [[ "${response}" =~ ^(Y|y)$ ]]; then + check-hash $fm_patch_hash_dir/pad_set_v2.x.bin.hash $fm_patch_dir/pad_set_v2.x.bin pad_set_v2.x.bin + dd if=$fm_patch_dir/pad_set_v2.x.bin of=/dev/mmcblk0 bs=1000k seek=1 && sync + check-if-dd-success pad_set_v2.x.bin 1000k 1088 + flag=1 + systemctl disable pwm-fan.service + fi + echo "" + unset response + while [[ ! "${response}" =~ ^(Y|y|N|n)$ ]]; do + read -r -p "Is the memory size 8GB? [Y/n] " response + echo "$response" + done + if [[ "${response}" =~ ^(Y|y)$ ]]; then + printf "\x11" | dd of=/dev/mmcblk0 bs=1 count=1 conv=notrunc bs=1 count=1 seek=1004390 && sync + flag=1 + fi + if [[ flag == 1 ]]; then + echo "the firmware has change, please power reset after desktop started." + fi + echo "" +} if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then do_firstrun_automated_network_configuration @@ -609,6 +662,11 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then rm /root/.desktop_firstlogin fi + # ask user to configure firmware + trap '' 2 + firmware_configure + trap - INT TERM EXIT + if [[ ${USER_SHELL} == zsh ]]; then printf "\nYou selected \e[0;91mZSH\x1B[0m as your default shell. If you want to use it right away, please logout and login! \n\n" fi diff --git a/package/phytium-tools/phytium-tools.mk b/package/phytium-tools/phytium-tools.mk index 9037d724..42209dac 100644 --- a/package/phytium-tools/phytium-tools.mk +++ b/package/phytium-tools/phytium-tools.mk @@ -16,6 +16,8 @@ define PHYTIUM_TOOLS_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/lib/firmware/rtw88/ mkdir -p $(TARGET_DIR)/lib/firmware/rtl_bt/ mkdir -p $(TARGET_DIR)/etc/modprobe.d/ + mkdir -p $(TARGET_DIR)/lib/firmware/uboot-patch + mkdir -p $(TARGET_DIR)/lib/firmware/uboot-patch-hash $(INSTALL) -m 755 -D $(@D)/rtlbt/* $(TARGET_DIR)/lib/firmware/rtlbt/ $(INSTALL) -m 755 -D $(@D)/rtk_hciattach $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 755 -D $(@D)/resize.sh $(TARGET_DIR)/usr/bin/ @@ -27,6 +29,12 @@ define PHYTIUM_TOOLS_INSTALL_TARGET_CMDS $(INSTALL) -m 755 -D $(@D)/rtlbt/rtl8821c_fw $(TARGET_DIR)/lib/firmware/rtl_bt/rtl8821c_fw.bin $(INSTALL) -m 755 -D $(@D)/rtw88.conf $(TARGET_DIR)/etc/modprobe.d/ $(INSTALL) -m 755 -D $(@D)/quectel-CM $(TARGET_DIR)/usr/bin/ + $(INSTALL) -D -m 644 $(@D)/firmware-configure/* $(TARGET_DIR)/lib/firmware/uboot-patch/ + $(INSTALL) -D -m 644 $(@D)/firmware-configure-hash/* $(TARGET_DIR)/lib/firmware/uboot-patch-hash/ + $(INSTALL) -D -m 755 $(@D)/ft-config $(TARGET_DIR)/usr/bin + $(INSTALL) -m 644 -D $(@D)/pwm-fan.service $(TARGET_DIR)/lib/systemd/system/ + $(INSTALL) -m 755 -D $(@D)/init_pwm_fan.sh $(TARGET_DIR)/usr/bin + $(INSTALL) -m 755 -D $(@D)/pwm_fan.sh $(TARGET_DIR)/usr/bin endef $(eval $(generic-package)) diff --git a/package/phytium-tools/src/firmware-configure-hash/pad_set_v2.x.bin.hash b/package/phytium-tools/src/firmware-configure-hash/pad_set_v2.x.bin.hash new file mode 100644 index 00000000..1f5bae73 --- /dev/null +++ b/package/phytium-tools/src/firmware-configure-hash/pad_set_v2.x.bin.hash @@ -0,0 +1 @@ +sha256 63201c49e7197a7501af239965be221a161ea89634039a76d76e1cee787da23f pad_set_v2.x.bin diff --git a/package/phytium-tools/src/firmware-configure-hash/pad_set_v3.bin.hash b/package/phytium-tools/src/firmware-configure-hash/pad_set_v3.bin.hash new file mode 100644 index 00000000..2ea5f1a0 --- /dev/null +++ b/package/phytium-tools/src/firmware-configure-hash/pad_set_v3.bin.hash @@ -0,0 +1 @@ +sha256 1165c42d19fe8d9dfcb8836ddbacbbd5e6da1b488bd6c024a9701c8ae0ed7737 pad_set_v3.bin diff --git a/package/phytium-tools/src/firmware-configure-hash/para_5g_usb3.bin.hash b/package/phytium-tools/src/firmware-configure-hash/para_5g_usb3.bin.hash new file mode 100644 index 00000000..57f4c876 --- /dev/null +++ b/package/phytium-tools/src/firmware-configure-hash/para_5g_usb3.bin.hash @@ -0,0 +1 @@ +sha256 912b81b648134348999087da1cf45a5c482d8f7f3f1107598eef5cfec40b82e7 para_5g_usb3.bin diff --git a/package/phytium-tools/src/firmware-configure-hash/para_msata.bin.hash b/package/phytium-tools/src/firmware-configure-hash/para_msata.bin.hash new file mode 100644 index 00000000..f56c5878 --- /dev/null +++ b/package/phytium-tools/src/firmware-configure-hash/para_msata.bin.hash @@ -0,0 +1 @@ +sha256 9a0ef620ae19a0d4ccff0e23442939e81c52130a81b16eb0306c7ff639511953 para_msata.bin diff --git a/package/phytium-tools/src/firmware-configure-hash/para_nvme_usb2.bin.hash b/package/phytium-tools/src/firmware-configure-hash/para_nvme_usb2.bin.hash new file mode 100644 index 00000000..c15fbad4 --- /dev/null +++ b/package/phytium-tools/src/firmware-configure-hash/para_nvme_usb2.bin.hash @@ -0,0 +1 @@ +sha256 1e5e9a5b9f900343cd5d8242d90fc949e231f68e6c939fa0e6f133a5824664d7 para_nvme_usb2.bin diff --git a/package/phytium-tools/src/firmware-configure/pad_set_v2.x.bin b/package/phytium-tools/src/firmware-configure/pad_set_v2.x.bin new file mode 100644 index 0000000000000000000000000000000000000000..caf33a75f98557fadde5da396a965fe0188a625b GIT binary patch literal 1088 zcmXxiFEDIz7{>9#+^|8|uwyoC5ClQEbLR$O!`Zdgh7H07K@bE%5R4H7!3;qV1VIo4 zK`?V~6a+yK1VIo4K@fx+1i|;Y`?ck>&-=c=Kj-X@7u~^LG5nO@j^@jsUvpT&62~Id zDyCaA*X=iS#(Gmr?PyQ?I5$!h3)sRzGUqH>Uy7WwY=6c2YGiIr*R5}0oB1u>#@u^H zcXc1L{y-10#k!;P@mNpvRL>&o&auPXgwGmm$~a?p6kYZn@s&q?=kmy&`0Y} zk$s*q`@HC@{WpErfBJ#5oc9@7SBwnvk4UcI|KCxoTGP5VbRx3NB(_*TrPKOTe`A}u znaEsIOYLY6^E`cB&;jOsE=KxGx~wahd#~!6uIq+wMfTaooU^05k@vE%2YRSSk@;iu z32u^4t)J<+{R_R+E6o4&T5t4L?=a7IuMhgDPx`Dc`l@d@%ldcyz%KbSa?fIPXa(EE gF|A_$*EOwcLnm|+=b4)_Ph&}LYKb|oqdo2G7tKl8dH?_b literal 0 HcmV?d00001 diff --git a/package/phytium-tools/src/firmware-configure/pad_set_v3.bin b/package/phytium-tools/src/firmware-configure/pad_set_v3.bin new file mode 100644 index 0000000000000000000000000000000000000000..831422ce0b043daf68059c1ba9dc9ea9b9fc80e4 GIT binary patch literal 1088 zcmXxiElfgT7{&3cGY|{}<_H9Xfk1H1Kpv5DWwZfnXpQ z+%y^t1OkCTAQ%V)f`MQ#5IjfzQhuE0dG7nZ_v0WaR_}xDFZ_4ce_l@tG9p8{Z&i&- zcVpx@{RF0|XE4M(mar@fJ3&y9Sy^?~J{QjN(pme|=+~V!cV*RYV3YbaxrJ@%bKl|} zcIbEUL1wj2&wcrbeH`GE)p|pj*W5F{P=B+kzssWLKAd&l5qa#a`UI!a_c6mc^-rsH z7Sii1aYg?N*Z7S;@=W_}tgZ`owt3GgN95mo#3;rvjtM-pTINXleIzl3$9O7pnoC>F zWiZ4%mZa~ej1{a(KhF!R{w3D1E`9DRY+w_wv1PSRTY8^cyt8^P9qi%*_N?X~$$fdF zJfQxBL;BD7g74Db=?9K*j1%emo8k=T_=yW#;tIdynXX^sk1Q&0tj-ziZjH#C;yy;D dzv~#rF@cA8B+oUMB&TGkoWW3fzdV+(jKAcd*?|B6 literal 0 HcmV?d00001 diff --git a/package/phytium-tools/src/firmware-configure/para_5g_usb3.bin b/package/phytium-tools/src/firmware-configure/para_5g_usb3.bin new file mode 100644 index 0000000000000000000000000000000000000000..1876b998ba0e6656a75e3711c01189baedabc71c GIT binary patch literal 1568 zcmY#ja0_8#00Kr3!N9=54#9U=85lOOFfc@bB_VRdkyHfwALvcE|3OS(5MTgiCPoGj zh5?WoZ0cb0LxmOw`XB5osMiFUhlUXoIbJ)g-i?^)-p0oh=UXoIbJ)g-i?^)-p0oh= /sys/class/pwm/pwmchip0/export +cd /sys/class/pwm/pwmchip0/pwm1/ +echo 25000 > period +# echo 15000 > duty_cycle #fan slow +echo 24000 > duty_cycle #fan fast +echo normal > polarity +echo 1 > enable +. /usr/bin/pwm_fan.sh & diff --git a/package/phytium-tools/src/pwm-fan.service b/package/phytium-tools/src/pwm-fan.service new file mode 100644 index 00000000..d5c0f79d --- /dev/null +++ b/package/phytium-tools/src/pwm-fan.service @@ -0,0 +1,9 @@ +[Unit] +Description=pwm fan process +After=network.target +[Service] +Type=forking +ExecStart=/usr/bin/init_pwm_fan.sh +User=root +[Install] +WantedBy=multi-user.target diff --git a/package/phytium-tools/src/pwm_fan.sh b/package/phytium-tools/src/pwm_fan.sh new file mode 100755 index 00000000..cb188629 --- /dev/null +++ b/package/phytium-tools/src/pwm_fan.sh @@ -0,0 +1,16 @@ +#!/bin/bash +THRESHOLD_TEMP=50 +while true; +do + sleep 30s + CPU_TEMP=$(cat /sys/class/thermal/thermal_zone0/temp) + CPU_TEMP_C=$((CPU_TEMP / 1000)) + #echo "$CPU_TEMP_C" + if [ "$CPU_TEMP_C" -gt "$THRESHOLD_TEMP" ]; then + #echo "pwm fast" + echo 24000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle + else + #echo "pwm slow" + echo 12000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle + fi +done diff --git a/package/phyuboot/phyuboot.mk b/package/phyuboot/phyuboot.mk index 5780c674..648b82e0 100644 --- a/package/phyuboot/phyuboot.mk +++ b/package/phyuboot/phyuboot.mk @@ -18,7 +18,6 @@ PHYUBOOT_RAMSIZE = $(BR2_PACKAGE_PHYUBOOT_RAMSIZE) define PHYUBOOT_INSTALL_IMAGES_CMDS $(INSTALL) -D -m 0777 $(@D)/phyuboot/fip-all-optee-$(BR2_PACKAGE_PHYUBOOT_RAMSIZE).bin $(BINARIES_DIR)/fip-all.bin - $(if $(BR2_PACKAGE_PHYUBOOT_5G),$(INSTALL) -D -m 0777 $(@D)/phytium-ota/uboot/5g/fip-all-5g-$(BR2_PACKAGE_PHYUBOOT_RAMSIZE).bin $(BINARIES_DIR)/fip-all.bin) $(INSTALL) -D -m 0777 $(PHYUBOOT_PKGDIR)/src/kernel.its $(BINARIES_DIR)/kernel.its $(INSTALL) -D -m 755 $(PHYUBOOT_PKGDIR)/src/mkimage $(HOST_DIR)/bin/mkimage_phypi PATH=$(BR_PATH) $(MKIMAGE_PI) -f $(BINARIES_DIR)/kernel.its $(BINARIES_DIR)/fitImage -- Gitee From 0b6bbe75709f40340839f1af27dbce5ec6448fa6 Mon Sep 17 00:00:00 2001 From: lindongping Date: Fri, 28 Feb 2025 17:01:39 +0800 Subject: [PATCH 6/8] phytium-ota: place the upgrade scripts on remote gitee Signed-off-by: lindongping --- package/phytium-ota/phytium-ota.mk | 6 +- package/phytium-ota/src/check-latest | 20 +- package/phytium-ota/src/get_phytium_ota | 138 ++++++++++ .../fitImage/latest/5.10/fitImage.hash | 1 - .../latest/5.10/linux-headers-5.10.deb.hash | 1 - .../latest/5.10/linux-image-5.10.deb.hash | 1 - .../phytium-ota-hash/rootfs/latest/lscpu.hash | 1 - .../latest/phytium-desktop-tools.deb.hash | 1 - .../rootfs/latest/phytium-firstlogin.deb.hash | 1 - .../rootfs/latest/phytium-tools.deb.hash | 2 - .../rootfs/latest/phytium-vpu.deb.hash | 1 - .../rootfs/latest/phytium-zram.deb.hash | 1 - .../rootfs/latest/rootfs-chown.deb.hash | 1 - .../uboot/5g/fip-all-5g-4GB.bin.hash | 2 - .../uboot/latest/fip-all-optee-2GB.bin.hash | 1 - .../uboot/latest/fip-all-optee-4GB.bin.hash | 1 - .../uboot/msata/fip-all-msata-4GB.bin.hash | 1 - .../uboot/v1.5/fip-all-optee-2GB.bin.hash | 1 - .../uboot/v1.5/fip-all-optee-4GB.bin.hash | 1 - .../rootfs/rootfs_latest.hash | 2 +- .../uboot/uboot_latest.hash | 2 +- package/phytium-ota/src/phytium_ota | 254 ------------------ package/phytium-ota/src/rootfs_ota | 81 ------ 23 files changed, 147 insertions(+), 374 deletions(-) create mode 100755 package/phytium-ota/src/get_phytium_ota delete mode 100644 package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/lscpu.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash delete mode 100644 package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash delete mode 100755 package/phytium-ota/src/phytium_ota delete mode 100755 package/phytium-ota/src/rootfs_ota diff --git a/package/phytium-ota/phytium-ota.mk b/package/phytium-ota/phytium-ota.mk index 46384ffd..26a6eb7f 100644 --- a/package/phytium-ota/phytium-ota.mk +++ b/package/phytium-ota/phytium-ota.mk @@ -12,12 +12,10 @@ PHYTIUM_OTA_INSTALL_TARGET = YES define PHYTIUM_OTA_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/usr/bin mkdir -p $(TARGET_DIR)/usr/lib/phytium/ - $(INSTALL) -m 755 -D $(@D)/phytium_ota $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 755 -D $(@D)/check-hash $(TARGET_DIR)/usr/bin/ $(INSTALL) -m 755 -D $(@D)/check-latest $(TARGET_DIR)/usr/bin/ - $(INSTALL) -m 755 -D $(@D)/rootfs_ota $(TARGET_DIR)/usr/bin/ - cp -rf $(@D)/phytium-ota-hash/ $(TARGET_DIR)/usr/lib/phytium/ - cp -rf $(@D)/phytium-ota-latest/ $(TARGET_DIR)/usr/lib/phytium/ + $(INSTALL) -m 755 -D $(@D)/get_phytium_ota $(TARGET_DIR)/usr/bin/ + cp -rf $(@D)/phytium-ota-latest/ $(TARGET_DIR)/usr/lib/phytium/ endef $(eval $(generic-package)) diff --git a/package/phytium-ota/src/check-latest b/package/phytium-ota/src/check-latest index 0aea00b6..9709bab7 100755 --- a/package/phytium-ota/src/check-latest +++ b/package/phytium-ota/src/check-latest @@ -3,28 +3,18 @@ set -e latest_dir="/usr/lib/phytium/phytium-ota-latest" -mem_info=$(LC_ALL=C free -w 2>/dev/null | grep "^Mem" || LC_ALL=C free | grep "^Mem") -mem_info=$(echo $mem_info | awk '{print $2}') -memory_total=$(( mem_info * 1024 )) -# compare to 3GB -if [ $memory_total -ge 3221225472 ]; then - mem=4GB -else - mem=2GB -fi - if [ $2 = "uboot" ]; then - _hash=$( sha256sum "$1/$2/latest/fip-all-optee-$mem.bin" |cut -d ' ' -f 1 ) + _hash=$( sha256sum "$1/$2/fip-all-optee-4GB.bin" |cut -d ' ' -f 1 ) elif [ $2 = "fitImage" ]; then - _hash=$( sha256sum "$1/$2/latest/5.10/$2.tar" |cut -d ' ' -f 1 ) + _hash=$( sha256sum "$1/$2/5.10/$2.tar" |cut -d ' ' -f 1 ) elif [ $2 = "rootfs" ]; then - _hash=$( sha256sum "$1/$2/latest/$2.tar" |cut -d ' ' -f 1 ) + _hash=$( sha256sum "$1/$2/$2.tar" |cut -d ' ' -f 1 ) fi if [ ! -e "$latest_dir/$2/$2_latest.hash" ]; then mkdir -p $latest_dir/$2 if [ $2 = "uboot" ]; then - echo "sha256 ${_hash} fip-all-optee-$mem.bin" > $latest_dir/$2/$2_latest.hash + echo "sha256 ${_hash} fip-all-optee-4GB.bin" > $latest_dir/$2/$2_latest.hash else echo "sha256 ${_hash} $2.tar" > $latest_dir/$2/$2_latest.hash fi @@ -40,7 +30,7 @@ if [ "${_hash}" = "${_known}" ]; then else mkdir -p $latest_dir/$2 if [ $2 = "uboot" ]; then - echo "sha256 ${_hash} fip-all-optee-$mem.bin" > $latest_dir/$2/$2_latest.hash + echo "sha256 ${_hash} fip-all-optee-4GB.bin" > $latest_dir/$2/$2_latest.hash else echo "sha256 ${_hash} $2.tar" > $latest_dir/$2/$2_latest.hash fi diff --git a/package/phytium-ota/src/get_phytium_ota b/package/phytium-ota/src/get_phytium_ota new file mode 100755 index 00000000..42d14bf0 --- /dev/null +++ b/package/phytium-ota/src/get_phytium_ota @@ -0,0 +1,138 @@ +#!/bin/bash + +# Get remote update files. +# +# Copyright (c) 2024-2025 Phytium Technology Co., Ltd. +# +# # This file is licensed under the terms of the GNU General Public +# License version 2. +# +# For the specific function 'detect_and_set_network', the following copyright applies: +# Copyright (c) Authors: https://www.armbian.com/authors +# +# get_phytium_ota - To get remote update files through the network. +# + +download_dir="/usr/local/phytium-libs" +download_site="https://gitee.com/phytium_embedded/phytium-rogue-umlibs.git" +dest_dir="/usr/local/phytium-ota" + +usage() { + echo "Usage: sudo $0 {all|rootfs|fitImage|uboot}" + echo " Example 1: sudo $0 uboot + --update uboot to the latest version" + echo " Example 2: sudo $0 fitImage + --update fitImage to the latest version" + echo " Example 3: sudo $0 rootfs + --update rootfs to the latest version" + echo " Example 4: sudo $0 all + --update uboot,fitImage and rootfs to the latest version" +} + +# check if parameters are provided. +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +check_args() +{ + if [ "$#" -ne 1 ]; then + echo -e "\033[1;31mArgs number error! usage: sudo $0 {all|fitImage|uboot} {latest|v1.x}\033[0m" + exit 1 + fi + if [[ "$1" != "all" ]] && [[ "$1" != "uboot" ]] && [[ "$1" != "fitImage" ]] && [[ "$1" != "rootfs" ]]; then + echo -e "\033[1;31mError: First argument must be 'all', 'uboot', 'fitImage', or 'rootfs'.\033[0m" + exit 1 + fi +} + +while true; do + case $1 in + "-h" | "-help") + usage + exit + ;; + *) + check_args $1 $2 + break + ;; + esac +done + +# get kernel version +kernel_version=$(uname -r) + +# unsupport rt kernel and 4.19 +if [[ $kernel_version =~ ^((5\.10\.[0-9]+))-phytium.* ]]; then + kernel_version="5.10" +elif [[ $kernel_version =~ ^((6\.6\.[0-9]+))-phytium.* ]]; then + kernel_version="6.6" +else + echo -e "\033[31munsupport kernel version: $kernel_version\033[0m" + exit 1 +fi + +detect_and_set_network() { + # Grab this machine's public IP address + PUBLIC_IP=$(curl --max-time 5 -s https://ipinfo.io/ip) + + # Check if we have wireless adaptor + WIFI_DEVICE=$(LC_ALL=C nmcli dev status | grep " wifi " 2> /dev/null) + + if [ -z "$PUBLIC_IP" ]; then + # ask for connecting to wireless if wifi device is found + if [[ -n "$WIFI_DEVICE" ]]; then + echo -e "Internet connection was \x1B[91mnot detected\x1B[0m." + echo "" + unset response + while [[ ! "${response}" =~ ^(Y|y|N|n)$ ]]; do + if [ -z $PRESET_CONNECT_WIRELESS ];then + read -r -p "Connect via wireless? [Y/n] " response + response=${response:-Y} + else + response=n + fi + echo "$response" + done + if [[ "${response}" =~ ^(Y|y)$ ]]; then + nmtui-connect + fi + echo "" + fi + fi + # Grab IP once again if not found + [[ -z "$PUBLIC_IP" && -n "$WIFI_DEVICE" ]] && PUBLIC_IP=$(curl --max-time 5 -s https://ipinfo.io/ip) + + if [ -z "$PUBLIC_IP" ]; then + echo -e "Internet connection was \x1B[91mnot detected\x1B[0m." + echo "exit" + exit 1; + fi +} # detect_and_set_network + +# get remote update files from gitee. +get_update_files() { + rm -rf $download_dir + mkdir -p $download_dir + + apt install -y git + + git clone -b develop --depth 1 $download_site $download_dir + if [ "$?" != "0" ]; then + echo -e "\033[1;31mget remote update files failed\033[0m" + exit 1 + fi + echo -e "\033[1;32mget remote update files success\033[0m" + rm -rf $dest_dir + cp -rf $download_dir/phytium-ota /usr/local +} # get_update_files + +main() { + detect_and_set_network + get_update_files + $dest_dir/scripts/run_phytium_ota $1 +} + +main $@ + diff --git a/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash b/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash deleted file mode 100644 index 4c7c7f03..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/fitImage.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 26a9c047d93bc7b30582bca8a226c3cc41c864b2d5a21d07064b4634b654e9cf fitImage diff --git a/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash b/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash deleted file mode 100644 index 16668804..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-headers-5.10.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 a7bd6c50d40e4c827654033496757200c5f3dbfda630c5ae7c0ac43e15e64f9f linux-headers-5.10.deb diff --git a/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash b/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash deleted file mode 100644 index 4a640f56..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/fitImage/latest/5.10/linux-image-5.10.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 ab0b82ebf36925a7bb389d1f26db2c04f675ddcf9e4276850dde51e05c5e5fd3 linux-image-5.10.deb diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/lscpu.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/lscpu.hash deleted file mode 100644 index 72630ae8..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/lscpu.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 12775525aa3723f5ac1ae045ebecfda74c1b17579293100f5b4ad0599706e18d lscpu diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash deleted file mode 100644 index 22c62e74..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-desktop-tools.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 20ce018fcf8ccd9bfaa086784ccda952ad4692bf892f9b49751f77cecb323f1e phytium-desktop-tools.deb diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash deleted file mode 100644 index b60b6edf..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-firstlogin.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 9a832a7b7a88beac69d6bf4e06f55f006343aba66760b3ac799c0930c923775d phytium-firstlogin.deb diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash deleted file mode 100644 index dc6d3f41..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-tools.deb.hash +++ /dev/null @@ -1,2 +0,0 @@ -sha256 51365d89cde46b7e9397675c9d90540a90ff38d4ba9b78e2d035a2b7c0113de3 phytium-tools.deb - diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash deleted file mode 100644 index d1652f02..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-vpu.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 604180b8e915a8fde270511ef51936b67ca01ac766e1da0ced0f06a33c555eff phytium-vpu.deb diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash deleted file mode 100644 index 449b22b5..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/phytium-zram.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 018619e90dd03f06fd7558f5640df9d2e10451bfc3d912178005a4dfc81b279a phytium-zram.deb diff --git a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash b/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash deleted file mode 100644 index acd79f64..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/rootfs/latest/rootfs-chown.deb.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 52a42810d478918d0e2b2c1a552f4ecb6088437ddd20eea513c965d06ee35ac2 rootfs-chown.deb diff --git a/package/phytium-ota/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash deleted file mode 100644 index ee96c83d..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/uboot/5g/fip-all-5g-4GB.bin.hash +++ /dev/null @@ -1,2 +0,0 @@ -sha256 1ebc3dc344886ffb2029a33fd3fa4a9f22ff981255cb69835e84f247cfe60f11 fip-all-5g-4GB.bin - diff --git a/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash deleted file mode 100644 index 8702bafc..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-2GB.bin.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 5ea39ddf7bcfd8ff1b3448fa0c71847a9c1e653f2cdd2cfc2451f813d8c946e4 fip-all-optee-2GB.bin diff --git a/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash deleted file mode 100644 index d2e913ab..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/uboot/latest/fip-all-optee-4GB.bin.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 7cc1bed898467814362553ace772ece3031819d1f62616ea6a66981014e72567 fip-all-optee-4GB.bin diff --git a/package/phytium-ota/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash deleted file mode 100644 index e5519f6a..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/uboot/msata/fip-all-msata-4GB.bin.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 991d1cacff5a732a153eafb28c8c35d58e4455a82512c70c92e94a489bf02ac8 fip-all-msata-4GB.bin diff --git a/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash deleted file mode 100644 index 8702bafc..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-2GB.bin.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 5ea39ddf7bcfd8ff1b3448fa0c71847a9c1e653f2cdd2cfc2451f813d8c946e4 fip-all-optee-2GB.bin diff --git a/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash b/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash deleted file mode 100644 index e105bdb3..00000000 --- a/package/phytium-ota/src/phytium-ota-hash/uboot/v1.5/fip-all-optee-4GB.bin.hash +++ /dev/null @@ -1 +0,0 @@ -sha256 7cc1bed898467814362553ace772ece3031819d1f62616ea6a66981014e72567 fip-all-optee-4GB.bin diff --git a/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash b/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash index db4f0b1e..4e235929 100644 --- a/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash +++ b/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash @@ -1 +1 @@ -sha256 f4cf68c7804912a56c81e4c02ef7b78d50a64ce9bb0984d278b45c3cc6404f5c rootfs.tar +sha256 9b01d2a93885a3f523dce6c83b8783ffb1494702e506f637f5ebb648c8173b63 rootfs.tar diff --git a/package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash b/package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash index 80d83247..1b47edc4 100644 --- a/package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash +++ b/package/phytium-ota/src/phytium-ota-latest/uboot/uboot_latest.hash @@ -1,2 +1,2 @@ -sha256 7cc1bed898467814362553ace772ece3031819d1f62616ea6a66981014e72567 fip-all-optee-4GB.bin +sha256 07e42417ca8ab699223f321a9dd24ff5b3dbcf5bba8a344ef63bbb2ff0d59e93 fip-all-optee-4GB.bin diff --git a/package/phytium-ota/src/phytium_ota b/package/phytium-ota/src/phytium_ota deleted file mode 100755 index 9e3f815a..00000000 --- a/package/phytium-ota/src/phytium_ota +++ /dev/null @@ -1,254 +0,0 @@ -#!/bin/bash - -# Phytium phytiumpi ota script -# -# Copyright (c) 2024 Phytium Technology Co., Ltd. -# -# phytium_ota.sh - To replace fip-all.bin and fitImage through the -# network on the phytiumpi development board. -# - -download_dir="/usr/local/phytium-libs" -download_site="https://gitee.com/phytium_embedded/phytium-rogue-umlibs.git" -dest_dir="/usr/local/phytium-ota" -hash_dir="/usr/lib/phytium/phytium-ota-hash" - -usage() { - echo "Usage: sudo $0 {all|fitImage|uboot} {version}" - echo -e " for \033[32muboot\033[0m, {version} can be v1.x or latest, etc - for \033[32mfitImage\033[0m and \033[32mall\033[0m, {version} only be latest" - echo " Example 1: sudo $0 uboot v1.x - --update uboot to version v1.x - Example 2: sudo $0 fitImage latest - --update fitImage to the latest - Example 3: sudo $0 all latest - --update uboot,fitImage and rootfs to the latest" -} - -while true; do - case $1 in - "-h" | "-help") - usage - exit - ;; - *) - break - ;; - esac -done - -check_args() -{ - if [ "$#" -ne 2 ]; then - echo -e "\033[1;31mUsage: sudo $0 {all|fitImage|uboot} {latest|v1.x}\033[0m" - exit 1 - fi - if [ "$1" != "all" ] && [ "$1" != "fitImage" ] && [ "$1" != "uboot" ]; then - echo -e "\033[1;31mError: First argument must be 'all', 'fitImage', or 'uboot'.\033[0m" - exit 1 - fi - - if [[ "$2" != "latest" && "$2" != "msata" && "$2" != "5g" && ! "$2" =~ ^v1\.[0-9]+$ ]]; then - echo -e "\033[1;31mError: Second argument must be 'latest', "msata", "5g" or 'v1.x'.\033[0m" - exit 1 - fi -} - -mem_info=$(LC_ALL=C free -w 2>/dev/null | grep "^Mem" || LC_ALL=C free | grep "^Mem") -mem_info=$(echo $mem_info | awk '{print $2}') -memory_total=$(( mem_info * 1024 )) -# compare to 3GB -if [ $memory_total -ge 3221225472 ]; then - mem=4GB -else - mem=2GB -fi - -# uboot -uboot_type=optee -if [ "$2" == "msata" ]; then - uboot_type=msata -elif [ "$2" == "5g" ]; then - uboot_type=5g -fi -uboot_bin="fip-all-$uboot_type-$mem.bin" - -uboot_hash="$uboot_bin.hash" - -# get kernel version -kernel_version=$(uname -r) - -# unsupport rt kernel and 4.19 -if [[ $kernel_version =~ ^((5\.10\.[0-9]+))-phytium.* ]]; then - kernel_version="5.10" -elif [[ $kernel_version =~ ^((6\.6\.[0-9]+))-phytium.* ]]; then - kernel_version="6.6" -else - echo -e "\033[31munsupport kernel version: $kernel_version\033[0m" - exit 1 -fi - -detect_and_set_network() { - # Grab this machine's public IP address - PUBLIC_IP=$(curl --max-time 5 -s https://ipinfo.io/ip) - - # Check if we have wireless adaptor - WIFI_DEVICE=$(LC_ALL=C nmcli dev status | grep " wifi " 2> /dev/null) - - if [ -z "$PUBLIC_IP" ]; then - - # ask for connecting to wireless if wifi device is found - if [[ -n "$WIFI_DEVICE" ]]; then - echo -e "Internet connection was \x1B[91mnot detected\x1B[0m." - echo "" - unset response - while [[ ! "${response}" =~ ^(Y|y|N|n)$ ]]; do - if [ -z $PRESET_CONNECT_WIRELESS ];then - read -r -p "Connect via wireless? [Y/n] " response - response=${response:-Y} - else - response=n - fi - echo "$response" - done - if [[ "${response}" =~ ^(Y|y)$ ]]; then - nmtui-connect - fi - echo "" - fi - fi - # Grab IP once again if not found - [[ -z "$PUBLIC_IP" && -n "$WIFI_DEVICE" ]] && PUBLIC_IP=$(curl --max-time 5 -s https://ipinfo.io/ip) - - if [ -z "$PUBLIC_IP" ]; then - echo -e "Internet connection was \x1B[91mnot detected\x1B[0m." - echo "exit" - exit 1; - fi -} # detect_and_set_network - -# get fip-all.bin and fitImage from gitee. -get_uboot_and_fitImage() { - - rm -rf $download_dir - mkdir -p $download_dir - - apt install -y git - - git clone -b develop --depth 1 $download_site $download_dir - if [ "$?" != "0" ]; then - echo -e "\033[1;31mget uboot and fitImage failed\033[0m" - exit 1 - fi - echo -e "\033[1;32mget uboot and fitImage success\033[0m" - rm -rf $dest_dir - cp -rf $download_dir/phytium-ota /usr/local - -} # get_uboot_and_fitImage - -# replace_uboot_and_fitImage -# $1: can be all\uboot\fitImage -# $2: can be latest\v1.5\msata, etc -replace_uboot_and_fitImage() { - - echo -e "\033[1;32minstalling phytium-ota...\033[0m" - dpkg -i $dest_dir/rootfs/$2/phytium-ota.deb - - if [ "$1" == "all" ]; then - uboot_latest=$(check-latest $dest_dir uboot) - if [ "${uboot_latest}" = "latest" ]; then - echo -e "\033[1;32muboot is already latest, nothing to do...\033[0m" - else - echo -e "\033[1;32mcheck hash...\033[0m" - check-hash $hash_dir/uboot/$2/$uboot_hash $dest_dir/uboot/$2/$uboot_bin $uboot_bin - echo -e "\033[1;32mupdate uboot...\033[0m" - # to preserve the partition table. - dd if=/dev/mmcblk0 of=start.img bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 - dd if=$dest_dir/uboot/$2/$uboot_bin of=/dev/mmcblk0 bs=1M count=4 >> $dest_dir/uboot/$2/replace.log 2>&1 - dd if=start.img of=/dev/mmcblk0 bs=512 count=1 >> $dest_dir/uboot/$2/replace.log 2>&1 - rm -f start.img - fi - fitImage_latest=$(check-latest $dest_dir fitImage) - if [ "${fitImage_latest}" = "latest" ]; then - echo -e "\033[1;32mkernel is already latest, nothing to do...\033[0m" - else - tar -xvf $dest_dir/fitImage/$2/$kernel_version/fitImage.tar -C $dest_dir/fitImage/$2/$kernel_version/ - echo -e "\033[1;32mcheck hash...\033[0m" - check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb - echo -e "\033[1;32mupdate fitImage...\033[0m" - dd if=$dest_dir/fitImage/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/fitImage/$2/$kernel_version/replace.log 2>&1 - dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb - dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb - fi - rootfs_latest=$(check-latest $dest_dir rootfs) - if [ "${rootfs_latest}" = "latest" ]; then - echo -e "\033[1;32mrootfs is already latest, nothing to do...\033[0m" - else - tar -xvf $dest_dir/rootfs/$2/rootfs.tar -C $dest_dir/rootfs/$2/ - echo -e "\033[1;32mcheck hash...\033[0m" - check-hash $hash_dir/rootfs/$2/phytium-desktop-tools.deb.hash $dest_dir/rootfs/$2/phytium-desktop-tools.deb phytium-desktop-tools.deb - check-hash $hash_dir/rootfs/$2/phytium-firstlogin.deb.hash $dest_dir/rootfs/$2/phytium-firstlogin.deb phytium-firstlogin.deb - check-hash $hash_dir/rootfs/$2/phytium-vpu.deb.hash $dest_dir/rootfs/$2/phytium-vpu.deb phytium-vpu.deb - check-hash $hash_dir/rootfs/$2/phytium-zram.deb.hash $dest_dir/rootfs/$2/phytium-zram.deb phytium-zram.deb - check-hash $hash_dir/rootfs/$2/rootfs-chown.deb.hash $dest_dir/rootfs/$2/rootfs-chown.deb rootfs-chown.deb - check-hash $hash_dir/rootfs/$2/phytium-tools.deb.hash $dest_dir/rootfs/$2/phytium-tools.deb phytium-tools.deb - check-hash $hash_dir/rootfs/$2/lscpu.hash $dest_dir/rootfs/$2/lscpu lscpu - echo -e "\033[1;32mupdate rootfs...\033[0m" - cp -f $dest_dir/rootfs/$2/lscpu /usr/bin/ - dpkg -i $dest_dir/rootfs/$2/phytium-desktop-tools.deb - dpkg -i $dest_dir/rootfs/$2/phytium-firstlogin.deb - dpkg -i $dest_dir/rootfs/$2/phytium-vpu.deb - dpkg -i $dest_dir/rootfs/$2/phytium-zram.deb - dpkg -i $dest_dir/rootfs/$2/rootfs-chown.deb - dpkg -i $dest_dir/rootfs/$2/phytium-tools.deb - rootfs_ota - fi - elif [ "$1" == "uboot" ]; then - echo -e "\033[1;32mcheck hash...\033[0m" - check-hash $hash_dir/uboot/$2/$uboot_hash $dest_dir/uboot/$2/$uboot_bin $uboot_bin - - echo -e "\033[1;32mupdate uboot...\033[0m" - # to preserve the partition table. - dd if=/dev/mmcblk0 of=start.img bs=512 count=1 >> $dest_dir/$1/$2/replace.log 2>&1 - dd if=$dest_dir/$1/$2/$uboot_bin of=/dev/mmcblk0 bs=1M count=4 >> $dest_dir/$1/$2/replace.log 2>&1 - dd if=start.img of=/dev/mmcblk0 bs=512 count=1 >> $dest_dir/$1/$2/replace.log 2>&1 - rm -f start.img - elif [ "$1" == "fitImage" ]; then - tar -xvf $dest_dir/fitImage/$2/$kernel_version/fitImage.tar -C $dest_dir/fitImage/$2/$kernel_version/ - fitImage_latest=$(check-latest $dest_dir fitImage) - if [ "${fitImage_latest}" = "latest" ]; then - echo -e "\033[1;32mkernel is already latest, nothing to do...\033[0m" - else - tar -xvf $dest_dir/fitImage/$2/$kernel_version/fitImage.tar -C $dest_dir/fitImage/$2/$kernel_version/ - echo -e "\033[1;32mcheck hash...\033[0m" - check-hash $hash_dir/fitImage/$2/$kernel_version/fitImage.hash $dest_dir/fitImage/$2/$kernel_version/fitImage fitImage - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb linux-headers-$kernel_version.deb - check-hash $hash_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb.hash $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb linux-image-$kernel_version.deb - echo -e "\033[1;32mupdate fitImage...\033[0m" - dd if=$dest_dir/fitImage/$2/$kernel_version/fitImage of=/dev/mmcblk0 bs=1M seek=4 count=60 >> $dest_dir/fitImage/$2/$kernel_version/replace.log 2>&1 - dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-headers-$kernel_version.deb - dpkg -i $dest_dir/fitImage/$2/$kernel_version/linux-image-$kernel_version.deb - fi - else - echo -e "\033[1;31margs error, exit\033[0m" - fi - - if [ "$?" != "0" ]; then - echo -e "\033[1;31mreplace_uboot_and_fitImage failed\033[0m" - exit 1 - fi - - echo -e "\033[1;32mupdate success, please reboot now\033[0m" -} # replace_uboot_and_fitImage - - -main() { - check_args $1 $2 - detect_and_set_network - get_uboot_and_fitImage $1 $2 - replace_uboot_and_fitImage $1 $2 -} - -main $@ diff --git a/package/phytium-ota/src/rootfs_ota b/package/phytium-ota/src/rootfs_ota deleted file mode 100755 index 86f234ca..00000000 --- a/package/phytium-ota/src/rootfs_ota +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -# Phytium phytiumpi rootfs_ota script -# -# Copyright (c) 2024 Phytium Technology Co., Ltd. -# -# rootfs_ota - To update rootfs to the latest for phytiumpi development board. -# - - -install_and_remove_packages() { - apt install -y locales audacity jq network-manager - apt remove -y dhcpcd5 -} # install_and_remove_package - -rootfs_configure() { - # rootfs-chown - systemctl enable systemd-rootfs-chown.service - # phytium-zram - systemctl enable phytium-zram-config.service - # phytium-vpu - systemctl enable phytium-vpu.service - - # disable default sink - sed -i 's/^default-sink = alsa_output.platform-sound.stereo-fallback/#&/' "/etc/pulse/client.conf" - # set kernel loglevel - sed -i 's/#kernel.printk = 3 4 1 3/kernel.printk = 4 4 1 7/' "/etc/sysctl.d/99-sysctl.conf" - # set the name of the sound output devices - sed -i 's/^update-sink-proplist 1 device.description=Headphone/#&/' "/etc/pulse/default.pa" - sed -i 's/^set-default-sink 1/#&/' "/etc/pulse/default.pa" - if ! grep -q '^update-sink-proplist 0 device.description=HDMI' "/etc/pulse/default.pa"; then - echo 'update-sink-proplist 0 device.description=HDMI' >> "/etc/pulse/default.pa" - fi - if ! grep -q '^load-module module-switch-on-connect' "/etc/pulse/default.pa"; then - echo 'load-module module-switch-on-connect' >> "/etc/pulse/default.pa" - fi - # enable ping for user - if [ ! -e "/etc/sysctl.d/10-custom-ping-group.conf" ]; then - echo 'net.ipv4.ping_group_range=1000 1000' >> "/etc/sysctl.d/10-custom-ping-group.conf" - fi - # set release message - echo DISTRIB_ID=Phytium > /etc/lsb-release - echo DISTRIB_RELEASE=1.0 >> /etc/lsb-release - echo DISTRIB_CODENAME=1.0 >> /etc/lsb-release - echo 'DISTRIB_DESCRIPTION="Phytium Pi OS V1.6"' >> /etc/lsb-release - sed -i 's/ID=Phytium/ID=debian/' "/usr/lib/os-release" - echo '#!/bin/sh' > /etc/update-motd.d/10-help-text - echo 'printf "\n"' >> /etc/update-motd.d/10-help-text - echo 'printf " * Support: https://gitee.com/phytium_embedded/phytium-pi-os\n"' >> /etc/update-motd.d/10-help-text - chmod +x /etc/update-motd.d/00-header - chmod +x /etc/update-motd.d/10-help-text - chmod -x /etc/update-motd.d/10-uname - echo -n > $RFSDIR/etc/motd - # cups disable TLSv1.0 and TLSv1.1 - if [ -f /etc/cups/cupsd.conf ]; then - if ! grep -q '^SSLOptions MinTLS1.2' "/etc/cups/cupsd.conf"; then - echo "SSLOptions MinTLS1.2" >> "/etc/cups/cupsd.conf" - fi - fi - - if dpkg -s openssh-server &> /dev/null; then - sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config - #ssh: disable weak MAC algorithm - if ! grep -q '^MACs hmac-sha2-256,hmac-sha2-512' "/etc/ssh/sshd_config"; then - echo "MACs hmac-sha2-256,hmac-sha2-512" >> "/etc/ssh/sshd_config" - fi - fi - # rm display-manager for phytium-firstlogin - rm -f /etc/systemd/system/display-manager.service - # touch .desktop_firstrun for phytium-firstlogin - if [ ! -e "/root/.desktop_firstlogin" ]; then - touch /root/.desktop_firstlogin - fi - # touch for phytium-firstlogin - if [ ! -e "/root/.not_logged_in_yet" ]; then - touch /root/.not_logged_in_yet - fi -} # rootfs_configure - -install_and_remove_packages -rootfs_configure -- Gitee From 11600a8805f7e7af5f7941b69b717f70854eceda Mon Sep 17 00:00:00 2001 From: lindongping Date: Tue, 4 Mar 2025 16:09:57 +0800 Subject: [PATCH 7/8] update rootfs_latest.hash and phytium-firstlogin Signed-off-by: lindongping --- package/phytium-firstlogin/src/phytium-firstlogin | 2 +- .../src/phytium-ota-latest/rootfs/rootfs_latest.hash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/phytium-firstlogin/src/phytium-firstlogin b/package/phytium-firstlogin/src/phytium-firstlogin index 8a78adf6..afa25754 100755 --- a/package/phytium-firstlogin/src/phytium-firstlogin +++ b/package/phytium-firstlogin/src/phytium-firstlogin @@ -523,7 +523,7 @@ firmware_configure(){ printf "\x11" | dd of=/dev/mmcblk0 bs=1 count=1 conv=notrunc bs=1 count=1 seek=1004390 && sync flag=1 fi - if [[ flag == 1 ]]; then + if [[ "$flag" == 1 ]]; then echo "the firmware has change, please power reset after desktop started." fi echo "" diff --git a/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash b/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash index 4e235929..4ea19ba1 100644 --- a/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash +++ b/package/phytium-ota/src/phytium-ota-latest/rootfs/rootfs_latest.hash @@ -1 +1 @@ -sha256 9b01d2a93885a3f523dce6c83b8783ffb1494702e506f637f5ebb648c8173b63 rootfs.tar +sha256 55d86f2b17bf36d4f622891a256fb72db1532314137479af1b6aa87227b811e2 rootfs.tar -- Gitee From c48772e65e1243edc7ade181fd55ada425bce723 Mon Sep 17 00:00:00 2001 From: lindongping Date: Tue, 4 Mar 2025 19:13:06 +0800 Subject: [PATCH 8/8] README: update phytium-ota and ft-config Signed-off-by: lindongping --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b962e82d..8c28e358 100644 --- a/README.md +++ b/README.md @@ -223,11 +223,18 @@ LINUX_OVERRIDE_SRCDIR指定了一个本地的内核源码目录,这样就不 `$ sudo runtime_replace_bootloader.sh uboot` `$ sudo runtime_replace_bootloader.sh fitImage` 以上三条命令分别实现了更换uboot+Image+dtb、更换uboot和更换Image+dtb的功能,要求当前目录下有fip-all.bin和fitImage文件。 -(5)开发板运行时,如果需要远程升级uboot、Image和dtb,可以在飞腾派上执行对应脚本,用法如下: -`$ sudo phytium_ota all latest` -`$ sudo phytium_ota uboot latest` -`$ sudo phytium_ota fitImage latest` -以上三条命令通过远程分别将整个系统、uboot和Image+dtb升级到最新版本。关于phytium_ota更多信息,可以参考[phytium_ota介绍与使用](https://gitee.com/phytium_embedded/phytium-pi-os/wikis/phytium_ota%E4%BB%8B%E7%BB%8D%E4%B8%8E%E4%BD%BF%E7%94%A8) +(5)开发板运行时,如果需要远程升级uboot、Image和dtb、rootfs,可以在飞腾派上执行对应脚本,用法如下: +`$ sudo get_phytium_ota all` +`$ sudo get_phytium_ota uboot` +`$ sudo get_phytium_ota fitImage` +`$ sudo get_phytium_ota rootfs` +以上四条命令通过远程分别将整个系统、uboot、Image+dtb和根文件系统升级到最新版本。关于phytium_ota更多信息,可以参考[phytium_ota介绍与使用](https://gitee.com/phytium_embedded/phytium-pi-os/wikis/phytium_ota%E4%BB%8B%E7%BB%8D%E4%B8%8E%E4%BD%BF%E7%94%A8) +(6)由于不同的开发板的硬件配置有所不同,对应的固件也有变化。开发板运行时,如果需要更新固件uboot的配置,可以在飞腾派上执行ft-config脚本,用法如下: +`$ sudo ft-config {hw|mem|pcie} {type}` +`$ sudo ft-config hw v3` +`$ sudo ft-config mem 8g` +`$ sudo ft-config pcie usb3` +上面三个例子,分别是配置固件支持硬件v3版本、设置内存为8g和设置pcie为usb3。关于phytium_ota更多信息,可以参考[飞腾派固件配置工具ft-config的介绍与使用](https://gitee.com/phytium_embedded/phytium-pi-os/wikis/%E9%A3%9E%E8%85%BE%E6%B4%BE%E5%9B%BA%E4%BB%B6%E9%85%8D%E7%BD%AE%E5%B7%A5%E5%85%B7ft-config%E7%9A%84%E4%BB%8B%E7%BB%8D%E4%B8%8E%E4%BD%BF%E7%94%A8) # 编译内核模块 关于如何编译内核外部模块,可参考https://www.kernel.org/doc/html/latest/kbuild/modules.html -- Gitee