From dcaa14b45e0a940f40de76c7f5f1560d0252137a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Oct 2024 20:22:22 +0000 Subject: [PATCH 01/30] First upgrade for Orange Pi 3B --- build/build.sh | 237 ++++++++++++++++++++++++++++++++--------------- build/config | 7 +- build/release.sh | 20 +++- 3 files changed, 182 insertions(+), 82 deletions(-) diff --git a/build/build.sh b/build/build.sh index 691f2e8..777dc58 100755 --- a/build/build.sh +++ b/build/build.sh @@ -2,6 +2,8 @@ # Must using Ubuntu 22.04,24.04 had issue with qemu-aarch64-static # script running in target debian arm64 OS +# From EgorNiKO: the script has a problem with missing packages when running on Ubuntu images + set -e set -x @@ -9,6 +11,9 @@ export LANGUAGE=POSIX export LC_ALL=POSIX export LANG=POSIX +BOARD=$(cat /etc/hostname) +echo "BORAD: $BOARD" + # add dns server echo "nameserver 8.8.8.8" >> /etc/resolv.conf @@ -25,92 +30,169 @@ fi # Update system to date apt update -apt dist-upgrade -y --allow-downgrades -apt install -y git cmake dkms build-essential - -# Remove old kernel in radxa-zero3_debian_bullseye_xfce_b6.img -dpkg -l | grep -q "linux-image-5.10.160-26-rk356x" && apt purge -y linux-image-5.10.160-26-rk356x linux-headers-5.10.160-26-rk356x +DEBIAN_FRONTEND=noninteractive apt dist-upgrade -y --allow-downgrades +apt install -y git cmake dkms build-essential meson ## [ -d /home/radxa/SourceCode ] || mkdir -p /home/radxa/SourceCode cd /home/radxa/SourceCode +if false; then +# Installing/Remove the required package depending on the board +case $BOARD in + radxa-zero3) + # Remove old kernel in radxa-zero3_debian_bullseye_xfce_b6.img + dpkg -l | grep -q "linux-image-5.10.160-26-rk356x" && apt purge -y linux-image-5.10.160-26-rk356x linux-headers-5.10.160-26-rk356x + ;; + orangepi3b) + dpkg -i /opt/linux-headers-legacy-rockchip-rk356x_1.0.6_arm64.deb + ;; +esac # 8812au -git clone -b v5.2.20 --depth=1 https://github.com/svpcom/rtl8812au.git -pushd rtl8812au -sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -./dkms-install.sh -popd +# The check is needed to speed up the process of creating a new image without updating drivers +DRIVE_NAME="88XXau_wfb" +if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then + git clone -b v5.2.20 --depth=1 https://github.com/svpcom/rtl8812au.git + pushd rtl8812au + sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + ./dkms-install.sh + popd +else + echo "${DRIVE_NAME} is already installed" +fi # 8812bu # make -j16 KSRC=/lib/modules/$(ls /lib/modules | tail -n 1)/build # make install -git clone --depth=1 https://github.com/OpenHD/rtl88x2bu.git -cp -r rtl88x2bu /usr/src/rtl88x2bu-git -sed -i 's/PACKAGE_VERSION="@PKGVER@"/PACKAGE_VERSION="git"/g' /usr/src/rtl88x2bu-git/dkms.conf -dkms add -m rtl88x2bu -v git -dkms build -m rtl88x2bu -v git -k $(ls /lib/modules | tail -n 1) -dkms install -m rtl88x2bu -v git -k $(ls /lib/modules | tail -n 1) +DRIVE_NAME="88x2bu" +if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then + git clone --depth=1 https://github.com/OpenHD/rtl88x2bu.git + cp -r rtl88x2bu /usr/src/rtl88x2bu-git + sed -i 's/PACKAGE_VERSION="@PKGVER@"/PACKAGE_VERSION="git"/g' /usr/src/rtl88x2bu-git/dkms.conf + dkms add -m rtl88x2bu -v git + dkms build -m rtl88x2bu -v git -k $(ls /lib/modules | tail -n 1) + dkms install -m rtl88x2bu -v git -k $(ls /lib/modules | tail -n 1) +else + echo "${DRIVE_NAME} is already installed" +fi # 8812cu -git clone --depth=1 https://github.com/libc0607/rtl88x2cu-20230728.git -pushd rtl88x2cu-20230728 -sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile -sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile -sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -./dkms-install.sh -popd +DRIVE_NAME="88x2cu" +if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then + git clone --depth=1 https://github.com/libc0607/rtl88x2cu-20230728.git + pushd rtl88x2cu-20230728 + sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile + sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile + sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + popd +else + echo "${DRIVE_NAME} is already installed" +fi # 8812eu -git clone --depth=1 https://github.com/libc0607/rtl88x2eu-20230815.git -pushd rtl88x2eu-20230815 -sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile -sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile -sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -./dkms-install.sh -popd +DRIVE_NAME="8812eu" +if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then + git clone --depth=1 https://github.com/libc0607/rtl88x2eu-20230815.git + pushd rtl88x2eu-20230815 + sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile + sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile + sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + ./dkms-install.sh + popd +else + echo "${DRIVE_NAME} is already installed" +fi # 8731bu -git clone --depth=1 https://github.com/libc0607/rtl8733bu-20230626.git -pushd rtl8733bu-20230626 -sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile -sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile -sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh -./dkms-install.sh -popd +DRIVE_NAME="8731bu" +if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then + git clone --depth=1 https://github.com/libc0607/rtl8733bu-20230626.git + pushd rtl8733bu-20230626 + sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile + sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile + sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + popd +else + echo "${DRIVE_NAME} is already installed" +fi # 8814au -git clone --depth=1 https://github.com/morrownr/8814au.git rtl8814au -DRV_NAME_8814AU="rtl8814au" -DRV_VERSION_8814AU="5.8.5.1" -sed -i "/MODULE_VERSION(DRIVERVERSION);/a MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);" rtl8814au/os_dep/linux/os_intfs.c -sed -i "s^kernelver=\$kernelver ./dkms-make.sh^'make' -j\$(nproc) KVER=\${kernelver} KSRC=/lib/modules/\${kernelver}/build^" rtl8814au/dkms.conf -cp -rf rtl8814au /usr/src/${DRV_NAME_8814AU}-${DRV_VERSION_8814AU} -dkms add -m ${DRV_NAME_8814AU} -v ${DRV_VERSION_8814AU} -dkms build -m ${DRV_NAME_8814AU} -v ${DRV_VERSION_8814AU} -k $(ls /lib/modules | tail -n 1) -dkms install -m ${DRV_NAME_8814AU} -v ${DRV_VERSION_8814AU} -k $(ls /lib/modules | tail -n 1) +DRIVE_NAME="8814au" +if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then + git clone --depth=1 https://github.com/morrownr/8814au.git rtl8814au + DRV_NAME_8814AU="rtl8814au" + DRV_VERSION_8814AU="5.8.5.1" + sed -i "/MODULE_VERSION(DRIVERVERSION);/a MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);" rtl8814au/os_dep/linux/os_intfs.c + sed -i "s^kernelver=\$kernelver ./dkms-make.sh^'make' -j\$(nproc) KVER=\${kernelver} KSRC=/lib/modules/\${kernelver}/build^" rtl8814au/dkms.conf + cp -rf rtl8814au /usr/src/${DRV_NAME_8814AU}-${DRV_VERSION_8814AU} + dkms add -m ${DRV_NAME_8814AU} -v ${DRV_VERSION_8814AU} + dkms build -m ${DRV_NAME_8814AU} -v ${DRV_VERSION_8814AU} -k $(ls /lib/modules | tail -n 1) + dkms install -m ${DRV_NAME_8814AU} -v ${DRV_VERSION_8814AU} -k $(ls /lib/modules | tail -n 1) +else + echo "${DRIVE_NAME} is already installed" +fi # AR9271 -apt install firmware-atheros +DRIVE_NAME="atk9" +if [ $(find /lib -name ${DRIVE_NAME}* | wc -l) == 0 ];then + if $(apt-cache search firmware-atheros | grep -q "firmware-atheros"); then + apt install -y firmware-atheros + else + git clone --depth=1 -b master --single-branch https://github.com/qca/open-ath9k-htc-firmware.git ${DRIVE_NAME} + pushd ${DRIVE_NAME} + make toolchain + make -C target_firmware + cp -f target_firmware/*.fw /lib/firmware/ + popd + fi +else + echo "${DRIVE_NAME} is already installed" +fi # MT7612u # wfb-ng -git clone -b master --depth=1 https://github.com/svpcom/wfb-ng.git +git clone -b master --depth=1 --single-branch https://github.com/svpcom/wfb-ng.git pushd wfb-ng ./scripts/install_gs.sh wlanx popd # PixelPilot_rk / fpvue -# From JohnDGodwin -apt -y install librockchip-mpp-dev libdrm-dev libcairo-dev gstreamer1.0-rockchip1 librga-dev librga2 librockchip-mpp1 librockchip-vpu0 libv4l-rkmpp libgl4es libgl4es-dev libspdlog-dev -apt --no-install-recommends -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools - -git clone --depth=1 https://github.com/OpenIPC/PixelPilot_rk.git +apt install -y libcairo-dev libdrm-dev +apt --no-install-recommends -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools + +case $BOARD in + radxa-zero3) + apt install -y libgl4es libgl4es-dev librga2 librga-dev librockchip-mpp1 librockchip-mpp-dev librockchip-vpu0 libv4l-rkmpp gstreamer1.0-rockchip1 + ;; + orangepi3b) + # Installing dependencies + git clone --depth 1 --single-branch https://github.com/rockchip-linux/mpp.git + pushd mpp + cmake -B build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib + cmake --build build --target install -j$(($(grep -c "^processor" /proc/cpuinfo) - 1)) + popd + + git clone --depth 1 --single-branch https://github.com/tsukumijima/librga-rockchip.git + pushd librga-rockchip + meson builddir --prefix=/usr --libdir=lib + ninja -C builddir install + popd + + # Installing gstreamer plugins mpp for Rockchip + git clone --depth 1 -b gstreamer-rockchip --single-branch https://github.com/JeffyCN/rockchip_mirrors.git + pushd rockchip_mirrors + meson builddir --prefix=/usr --libdir=lib/aarch64-linux-gnu + ninja -C builddir install + popd + ;; +esac + +git clone --depth=1 https://github.com/OpenIPC/PixelPilot_rk.git pushd PixelPilot_rk cmake -B build cmake --build build --target install @@ -122,26 +204,27 @@ pushd SBC-GS/gs popd # install useful packages -DEBIAN_FRONTEND=noninteractive apt -y install lrzsz net-tools socat netcat exfatprogs ifstat fbi minicom bridge-utils console-setup psmisc ethtool drm-info libdrm-tests proxychains4 - -# disable services -sed -i '/disable_service systemd-networkd/a disable_service dnsmasq' /config/before.txt - -# enable services -sed -i "s/disable_service systemd-networkd/# disable_service systemd-networkd/" /config/before.txt -sed -i "s/disable_service ssh/# disable_service ssh/" /config/before.txt -sed -i "s/disable_service nmbd/# disable_service smbd/" /config/before.txt -sed -i "s/disable_service smbd/# disable_service nmbd/" /config/before.txt - -# disable auto extend root partition and rootfs -apt purge -y cloud-initramfs-growroot -sed -i "s/resize_root/# resize_root/" /config/before.txt - -# umanage NICs from NetwrkManager -cat > /etc/NetworkManager/conf.d/00-gs-unmanaged.conf << EOF -[keyfile] -unmanaged-devices=interface-name:eth0;interface-name:br0;interface-name:usb0;interface-name:dummy0;interface-name:radxa0;interface-name:wlx* -EOF +apt -y install lrzsz net-tools socat netcat exfatprogs ifstat fbi minicom bridge-utils +fi +case $BOARD in + radxa-zero3) + # enable services + sed -i "s/disable_service ssh/# disable_service ssh/" /config/before.txt + sed -i "s/disable_service nmbd/# disable_service smbd/" /config/before.txt + sed -i "s/disable_service smbd/# disable_service nmbd/" /config/before.txt + + # disable auto extend root partition and rootfs + apt purge -y cloud-initramfs-growroot + sed -i "s/resize_root/# resize_root/" /config/before.txt + + # disable services + sed -i '/disable_service systemd-networkd/a disable_service dnsmasq' /config/before.txt + ;; + orangepi3b) + # Added for compatibility with RadxaZero3 + echo "" > /config/before.txt + ;; +esac rm -rf /home/radxa/SourceCode rm /etc/resolv.conf diff --git a/build/config b/build/config index 5898687..4616b12 100644 --- a/build/config +++ b/build/config @@ -1,4 +1,9 @@ # The IMAGE_URL must be a local absolute path or a network download URL and iamge muse be .xz file +# !!! USE DEBIAN DISTRIBUTIONS !!! IMAGE_URL="https://github.com/radxa-build/radxa-zero3/releases/download/b6/radxa-zero3_debian_bullseye_xfce_b6.img.xz" -IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zero3_debian_bullseye_cli.img.xz" +IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zero-3_debian_bullseye_cli.img.xz" + +# Example file +#IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" + ROOTFS="rootfs" diff --git a/build/release.sh b/build/release.sh index 308be52..59d5e0c 100755 --- a/build/release.sh +++ b/build/release.sh @@ -1,7 +1,6 @@ #!/bin/bash set -e -set -x echo_red() { printf "\033[1;31m$*\033[m\n"; } echo_green() { printf "\033[1;32m$*\033[m\n"; } echo_blue() { printf "\033[1;34m$*\033[m\n"; } @@ -89,6 +88,7 @@ truncate -s ${diskNewSize}G $IMAGE LOOPDEV=$(losetup -P --show -f $IMAGE) ROOT_PART=$(sgdisk -p $LOOPDEV | grep "rootfs" | tail -n 1 | tr -s ' ' | cut -d ' ' -f 2) ROOT_DEV=${LOOPDEV}p${ROOT_PART} +echo_blue $LOOPDEV # move second/backup GPT header to end of disk sgdisk -ge $LOOPDEV @@ -104,8 +104,10 @@ e2fsck -yf $ROOT_DEV resize2fs $ROOT_DEV # mount rootfs and config +echo_blue "Mount rootfs and config" [ -d $ROOTFS ] || mkdir $ROOTFS mount $ROOT_DEV $ROOTFS +[ -d $ROOTFS/config ] || mkdir $ROOTFS/config mount ${LOOPDEV}p1 $ROOTFS/config mount -t proc /proc $ROOTFS/proc mount -t sysfs /sys $ROOTFS/sys @@ -113,17 +115,22 @@ mount -o bind /dev $ROOTFS/dev mount -o bind /run $ROOTFS/run mount -t devpts devpts $ROOTFS/dev/pts +BOARD=$(cat $ROOTFS/etc/hostname) +exit # copy gs code to target rootfs +echo_blue "Сopy gs code to target rootfs" mkdir -p $ROOTFS/home/radxa/SourceCode/SBC-GS cp -r ../gs ../pics $ROOTFS/home/radxa/SourceCode/SBC-GS # run build script # chroot $ROOTFS /bin/bash +echo_blue "Run build script\nchroot $ROOTFS /bin/bash" cp build.sh $ROOTFS/root/build.sh chroot $ROOTFS /root/build.sh rm $ROOTFS/root/build.sh # add release info +echo_blue "Add release info" BUILD_DATE=$(date "+%Y-%m-%d") BUILD_DATETIME=$(date "+%Y-%m-%d %H:%M:%S") echo "BUILD_DATETIME=\"${BUILD_DATETIME}\"" >> $ROOTFS/etc/gs-release @@ -145,6 +152,7 @@ umount -R $ROOTFS rm -r $ROOTFS # shrink image +echo_blue "Shrink image" SECTOR_SIZE=$(sgdisk -p $ROOT_DEV | grep -oP "(?<=: )\d+(?=/)") START_SECTOR=$(sgdisk -i $ROOT_PART $LOOPDEV | grep "First sector:" | cut -d ' ' -f 3) TOTAL_BLOCKS=$(tune2fs -l $ROOT_DEV | grep '^Block count:' | tr -s ' ' | cut -d ' ' -f 3) @@ -168,10 +176,14 @@ truncate --size=$FINAL_SIZE $IMAGE > /dev/null sgdisk -ge $IMAGE > /dev/null sgdisk -v $IMAGE > /dev/null -echo "Image shrunked from ${TOTAL_BLOCKS} to ${TOTAL_BLOCKS_SHRINKED}." +echo "Image shrunked from ${TOTAL_BLOCKS} to ${TOTAL_BLOCKS_SHRINKED}." # compression image and rename xz file -xz -v -T0 $IMAGE -mv *.xz Radxa-Zero-3_GroundStation_${BUILD_DATE}_${VERSION}.img.xz +NEW_NAME="openipc_sbcgc_${BOARD}_${BUILD_DATE}_${VERSION}.img" +echo_blue "Compression image and rename xz file $NEW_NAME" +mv $IMAGE $NEW_NAME +xz -T0 $NEW_NAME + +echo_green "Finish" exit 0 From da72e1f965ca723230eef5e3b4f886159e631ca4 Mon Sep 17 00:00:00 2001 From: EgorNiKO <тшniko_egor@mail.ru> Date: Sat, 26 Oct 2024 23:55:20 +0000 Subject: [PATCH 02/30] Adaptation for Orange Pi 3B and other images. Stage 1 --- build/add_config_disk.sh | 101 +++++++++++++++++++++++++++++++++++++++ build/config | 2 +- build/release.sh | 9 ++-- 3 files changed, 108 insertions(+), 4 deletions(-) create mode 100755 build/add_config_disk.sh diff --git a/build/add_config_disk.sh b/build/add_config_disk.sh new file mode 100755 index 0000000..5ca44be --- /dev/null +++ b/build/add_config_disk.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +set -e -x + +# Size, MB +SIZE_DISK=16 +SIZE_SECTORS="$(($SIZE_DISK*2048))" +TMP_DISK="newImage.img" +FIRST_SECTOR=32768 # The number must be a multiple of 2048. Minimum=2048 + +# Protection against duplicate creation +if $(sgdisk -p $1 | grep -q config);then + echo "Error: The config section already exists" + exit 0 +fi + +# Checking free space +diskFreeSpace=$(df -PhB1 . | tail -1 | awk '{print $4}') +fileSize=$(du -B1 "$1" | awk '{print $1}') +if [ $diskFreeSpace -lt $(($fileSize*2)) ];then + echo "Error: not enough free space" + exit 1 +fi + + +# Getting the current disk layout +sfdisk_output=$(sfdisk -d $1) +label=$(echo "$sfdisk_output" | grep 'label:' | tr -d ' ' | cut -d ':' -f 2) +label_id=$(echo "$sfdisk_output" | grep 'label-id:' | tr -d ' ' | cut -d ':' -f 2) +device=$(echo "$sfdisk_output" | grep 'device:' | tr -d ' ' | cut -d ':' -f 2) +unit=$(echo "$sfdisk_output" | grep 'unit:' | tr -d ' ' | cut -d ':' -f 2) +first_lba=34 #$(echo "$sfdisk_output" | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) +last_lba=$(echo "$sfdisk_output" | grep 'last-lba:' | tr -d ' ' | cut -d ':' -f 2) +sector_size=$(echo "$sfdisk_output" | grep 'sector-size:' | tr -d ' ' | cut -d ':' -f 2) +partedList="$(echo "$sfdisk_output" | grep $device.)" +start_sector=$(echo $partedList | gawk '{if ( match ( $0, /start=\W*([0-9]*)(.*)/, a ) ) print a[1] }') +SEEK_SECTOR=$(($start_sector-($FIRST_SECTOR+$SIZE_SECTORS))) +FULL_LBA=$(($last_lba-($SEEK_SECTOR))) + +# Create a new disk with an indent of SIZE_DISK +if [ -f ${TMP_DISK} ];then + echo "Deleting a $TMP_DISK" + rm ${TMP_DISK} +fi + +echo "Create a new disk" + +SKIP=$(($start_sector/2048)) # We do not read empty blocks at the beginning of the img image +SEEK=$((FIRST_SECTOR/2048+$SIZE_DISK)) # Skip a FIRST_SECTOR+$SIZE_DISK +dd if=$1 of=$TMP_DISK bs=1M seek=$SEEK skip=$SKIP status=progress +dd if=/dev/zero of=$TMP_DISK bs=512 count=$(($first_lba-34)) seek=$(($(du -b "$TMP_DISK" | awk '{print $1}')/512)) # Increases the end of the disk to the size of first-lba +SIZE_IMG=$(($(du -b "$TMP_DISK" | awk '{print $1}')/512)) + +r34=$(($SIZE_IMG - $FULL_LBA)) +if [ $r34 -ne $first_lba ];then + echo "Error: The size of the new img image is out of bounds by $(($r34-$first_lba)) bytes" + exit 1 +fi + +if [ ! -f $TMP_DISK ];then + echo "Error: failed to create file '${TMP_DISK}'" + exit 1 +fi + +# Recalculates indents of existing volumes +i=2 +new_partition="" +while IFS= read -r line +do + new_partition="${new_partition}NewPartition${i} $(echo $line | gawk '{if ( match ( $0, /(.*)(:.*start=)\W*([0-9]*)(.*)/, a ) ) print a[2]a[3]-('$SEEK_SECTOR')a[4]}' )"$'\n' + i=$(($i+1)) +done < <(printf '%s\n' "$partedList") + +# Create a new markup +cat < Date: Tue, 29 Oct 2024 17:37:33 +0000 Subject: [PATCH 03/30] Fix Uboot loaded and rootfs --- build/add_config_disk.sh | 84 +++++++++++++++++++++++++++++----------- build/build.sh | 6 +-- build/release.sh | 3 +- 3 files changed, 67 insertions(+), 26 deletions(-) diff --git a/build/add_config_disk.sh b/build/add_config_disk.sh index 5ca44be..3475622 100755 --- a/build/add_config_disk.sh +++ b/build/add_config_disk.sh @@ -1,12 +1,10 @@ #!/bin/bash -set -e -x +set -e # Size, MB SIZE_DISK=16 -SIZE_SECTORS="$(($SIZE_DISK*2048))" TMP_DISK="newImage.img" -FIRST_SECTOR=32768 # The number must be a multiple of 2048. Minimum=2048 # Protection against duplicate creation if $(sgdisk -p $1 | grep -q config);then @@ -22,20 +20,21 @@ if [ $diskFreeSpace -lt $(($fileSize*2)) ];then exit 1 fi - # Getting the current disk layout sfdisk_output=$(sfdisk -d $1) label=$(echo "$sfdisk_output" | grep 'label:' | tr -d ' ' | cut -d ':' -f 2) label_id=$(echo "$sfdisk_output" | grep 'label-id:' | tr -d ' ' | cut -d ':' -f 2) device=$(echo "$sfdisk_output" | grep 'device:' | tr -d ' ' | cut -d ':' -f 2) unit=$(echo "$sfdisk_output" | grep 'unit:' | tr -d ' ' | cut -d ':' -f 2) -first_lba=34 #$(echo "$sfdisk_output" | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) +first_lba=$(echo "$sfdisk_output" | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) last_lba=$(echo "$sfdisk_output" | grep 'last-lba:' | tr -d ' ' | cut -d ':' -f 2) sector_size=$(echo "$sfdisk_output" | grep 'sector-size:' | tr -d ' ' | cut -d ':' -f 2) partedList="$(echo "$sfdisk_output" | grep $device.)" -start_sector=$(echo $partedList | gawk '{if ( match ( $0, /start=\W*([0-9]*)(.*)/, a ) ) print a[1] }') -SEEK_SECTOR=$(($start_sector-($FIRST_SECTOR+$SIZE_SECTORS))) -FULL_LBA=$(($last_lba-($SEEK_SECTOR))) +start_sector=$(echo $partedList | gawk '{if ( match ( $0, /start=\W*([0-9]*)(.*)/, a ) ) print a[1] }') +gptReserveSizeSector=$((($(du -b "$1" | awk '{print $1}')/$sector_size - $last_lba))) +mbToSector=$((1024*1024/$sector_size)) # How many sectors in a megabyte +size_disk_sectors="$(($SIZE_DISK*$mbToSector))" +full_lba=$(($last_lba+$size_disk_sectors)) # Create a new disk with an indent of SIZE_DISK if [ -f ${TMP_DISK} ];then @@ -45,15 +44,31 @@ fi echo "Create a new disk" -SKIP=$(($start_sector/2048)) # We do not read empty blocks at the beginning of the img image -SEEK=$((FIRST_SECTOR/2048+$SIZE_DISK)) # Skip a FIRST_SECTOR+$SIZE_DISK -dd if=$1 of=$TMP_DISK bs=1M seek=$SEEK skip=$SKIP status=progress -dd if=/dev/zero of=$TMP_DISK bs=512 count=$(($first_lba-34)) seek=$(($(du -b "$TMP_DISK" | awk '{print $1}')/512)) # Increases the end of the disk to the size of first-lba -SIZE_IMG=$(($(du -b "$TMP_DISK" | awk '{print $1}')/512)) +# Копируем сектора с загрузчиками +skip_mb=$(($start_sector/$mbToSector)) # We do not read empty blocks at the beginning of the img image, in MB +dd if=$1 of=$TMP_DISK bs=1M count=$skip_mb + +# Добавить 16М + образ +seek_mb=$(($skip_mb + $SIZE_DISK)) # Seek +16М +dd if=$1 of=$TMP_DISK bs=1M skip=$skip_mb seek=$seek_mb status=progress + +# Добавить в конец длинну, равную first_lba (нужно для sgdisk -ge) +size_img=$(($(du -b "$TMP_DISK" | awk '{print $1}')/$sector_size)) +r34=$(($size_img - $full_lba)) +if [ $r34 -ne $gptReserveSizeSector ];then + echo "Error: The size of the new image is out of bounds by $(($r34-$gptReserveSizeSector)) bytes" + exit 1 +fi + +if [ $gptReserveSizeSector -le $first_lba ];then + # Increases the end of the disk to the size of first-lba + dd if=/dev/zero of=$TMP_DISK bs=$sector_size count=$(($first_lba-$gptReserveSizeSector)) seek=$(($(du -b "$TMP_DISK" | awk '{print $1}')/512)) +fi -r34=$(($SIZE_IMG - $FULL_LBA)) -if [ $r34 -ne $first_lba ];then - echo "Error: The size of the new img image is out of bounds by $(($r34-$first_lba)) bytes" +size_img=$(($(du -b "$TMP_DISK" | awk '{print $1}')/$sector_size)) +r34=$(($size_img - $full_lba)) +if [ $r34 -gt $first_lba ];then + echo "Error: GPT backup partition extends beyond first-lba by $(($r34-$first_lba)) bytes" exit 1 fi @@ -65,9 +80,10 @@ fi # Recalculates indents of existing volumes i=2 new_partition="" +seek_sector=$(($seek_mb*$mbToSector)) # Seek sector while IFS= read -r line do - new_partition="${new_partition}NewPartition${i} $(echo $line | gawk '{if ( match ( $0, /(.*)(:.*start=)\W*([0-9]*)(.*)/, a ) ) print a[2]a[3]-('$SEEK_SECTOR')a[4]}' )"$'\n' + new_partition="${new_partition}NewPartition${i} $(echo $line | gawk '{if ( match ( $0, /(.*)(:.*start=)\W*([0-9]*)(.*)/, a ) ) print a[2]a[3]+('$size_disk_sectors')a[4]}' )"$'\n' i=$(($i+1)) done < <(printf '%s\n' "$partedList") @@ -78,20 +94,44 @@ label-id: ${label_id} device: NewPartition unit: ${unit} first-lba: ${first_lba} -last-lba: ${FULL_LBA} +last-lba: ${full_lba} sector-size: ${sector_size} -NewPartition1 : start=$FIRST_SECTOR, size=$SIZE_SECTORS, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, name="config" +NewPartition1 : start=$start_sector, size=$size_disk_sectors, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, name="config" ${new_partition} EOF +# bootdisk flag +sgdisk -A 2:set:2 $TMP_DISK + sgdisk -ge $TMP_DISK sgdisk -v $TMP_DISK -# Formatting LOOPDEV=$(losetup -P --show -f $TMP_DISK) -CONFIG_PART=$(sgdisk -p $LOOPDEV | grep "config" | tail -n 1 | tr -s ' ' | cut -d ' ' -f 2) -mkfs.fat ${LOOPDEV}p${CONFIG_PART} + CONFIG_PART=$(sgdisk -p $LOOPDEV | grep "config" | tail -n 1 | tr -s ' ' | cut -d ' ' -f 2) + BOOT_PART=$(sgdisk -p $LOOPDEV | grep "boot" | tail -n 1 | tr -s ' ' | cut -d ' ' -f 2) + ROOT_PART=$(sgdisk -p $LOOPDEV | grep "rootfs" | tail -n 1 | tr -s ' ' | cut -d ' ' -f 2) + + # Formatting + mkfs.fat ${LOOPDEV}p${CONFIG_PART} + + # Определяем название одноплатнка + mount ${LOOPDEV}p${ROOT_PART} /mnt + BOARD=$(cat /mnt/etc/hostname) + echo $BOARD + umount /mnt + + # Изменяем раздел загрузик в U-Boot + case $BOARD in + orangepi3b) + mount ${LOOPDEV}p${BOOT_PART} /mnt + sed -i "s/rootdev=UUID=.*/rootdev=\/dev\/disk\/by-partuuid\/$(blkid -s PARTUUID -o value ${LOOPDEV}p${ROOT_PART})/" /mnt/orangepiEnv.txt + sed -i "s/if test \"\${devtype}\".*/setenv partuuid \"$(blkid -s PARTUUID -o value ${LOOPDEV}p${BOOT_PART})\"/" /mnt/boot.cmd + sed -i "/# default values/a setenv devnum \"0:2\"" /mnt/boot.cmd + mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d /mnt/boot.cmd /mnt/boot.scr + umount /mnt + ;; + esac losetup -d $LOOPDEV # Replace the original img image diff --git a/build/build.sh b/build/build.sh index 777dc58..fd04c95 100755 --- a/build/build.sh +++ b/build/build.sh @@ -36,7 +36,7 @@ apt install -y git cmake dkms build-essential meson ## [ -d /home/radxa/SourceCode ] || mkdir -p /home/radxa/SourceCode cd /home/radxa/SourceCode -if false; then + # Installing/Remove the required package depending on the board case $BOARD in radxa-zero3) @@ -204,8 +204,8 @@ pushd SBC-GS/gs popd # install useful packages -apt -y install lrzsz net-tools socat netcat exfatprogs ifstat fbi minicom bridge-utils -fi +apt -y install lrzsz net-tools socat netcat exfatprogs ifstat fbi minicom bridge-utils console-setup psmisc ethtool drm-info libdrm-tests proxychains4 + case $BOARD in radxa-zero3) # enable services diff --git a/build/release.sh b/build/release.sh index 90a230e..5587ea6 100755 --- a/build/release.sh +++ b/build/release.sh @@ -171,8 +171,9 @@ resizepart $ROOT_PART ${NEW_SIZE}B yes EOF +FIRST_LBA=$(sfdisk -d $LOOPDEV | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) END_SECTOR=$(sgdisk -i $ROOT_PART $LOOPDEV | grep "Last sector:" | cut -d ' ' -f 3) -FINAL_SIZE=$(( ($END_SECTOR + 34) * $SECTOR_SIZE )) +FINAL_SIZE=$(( ($END_SECTOR + $FIRST_LBA) * $SECTOR_SIZE )) losetup -d $LOOPDEV truncate --size=$FINAL_SIZE $IMAGE > /dev/null From 49368c6b564433b154bed697bf61fae3ea81017c Mon Sep 17 00:00:00 2001 From: EgorNiKO <тшniko_egor@mail.ru> Date: Wed, 30 Oct 2024 00:57:28 +0000 Subject: [PATCH 04/30] Error message changed --- build/add_config_disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/add_config_disk.sh b/build/add_config_disk.sh index 3475622..cd11e73 100755 --- a/build/add_config_disk.sh +++ b/build/add_config_disk.sh @@ -8,7 +8,7 @@ TMP_DISK="newImage.img" # Protection against duplicate creation if $(sgdisk -p $1 | grep -q config);then - echo "Error: The config section already exists" + echo "Warning: The config section already exists" exit 0 fi From b394ce36a2648a3e70bbc8fff8e42eb7a962c890 Mon Sep 17 00:00:00 2001 From: EgorNiKO <тшniko_egor@mail.ru> Date: Wed, 30 Oct 2024 00:58:49 +0000 Subject: [PATCH 05/30] Fix DRIVE_NAME=8733bu, checked if linux-headers is installed --- build/build.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build/build.sh b/build/build.sh index fd04c95..9da2e42 100755 --- a/build/build.sh +++ b/build/build.sh @@ -44,7 +44,9 @@ case $BOARD in dpkg -l | grep -q "linux-image-5.10.160-26-rk356x" && apt purge -y linux-image-5.10.160-26-rk356x linux-headers-5.10.160-26-rk356x ;; orangepi3b) - dpkg -i /opt/linux-headers-legacy-rockchip-rk356x_1.0.6_arm64.deb + if [ -z $(dpkg -l | grep 'linux-headers-legacy-rockchip-rk356x') ];then + dpkg -i /opt/linux-headers-legacy-rockchip-rk356x_1.0.6_arm64.deb + fi ;; esac @@ -107,7 +109,7 @@ else fi # 8731bu -DRIVE_NAME="8731bu" +DRIVE_NAME="8733bu" if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then git clone --depth=1 https://github.com/libc0607/rtl8733bu-20230626.git pushd rtl8733bu-20230626 @@ -204,8 +206,9 @@ pushd SBC-GS/gs popd # install useful packages -apt -y install lrzsz net-tools socat netcat exfatprogs ifstat fbi minicom bridge-utils console-setup psmisc ethtool drm-info libdrm-tests proxychains4 +DEBIAN_FRONTEND=noninteractive apt -y install lrzsz net-tools socat netcat exfatprogs ifstat fbi minicom bridge-utils console-setup psmisc ethtool drm-info libdrm-tests proxychains4 +# disable services case $BOARD in radxa-zero3) # enable services From c9a62defa75a787da0a396e279a9468972f1f17e Mon Sep 17 00:00:00 2001 From: EgorNiKO <тшniko_egor@mail.ru> Date: Wed, 30 Oct 2024 02:29:08 +0000 Subject: [PATCH 06/30] Fix GPT, if first-lba > 34 --- build/release.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build/release.sh b/build/release.sh index 5587ea6..0f1bf1a 100755 --- a/build/release.sh +++ b/build/release.sh @@ -166,17 +166,15 @@ resize2fs -M $ROOT_DEV TOTAL_BLOCKS_SHRINKED=$(sudo tune2fs -l "$ROOT_DEV" | grep '^Block count:' | tr -s ' ' | cut -d ' ' -f 3) sync $ROOT_DEV NEW_SIZE=$(( $START_SECTOR * $SECTOR_SIZE + $TARGET_BLOCKS * $BLOCK_SIZE )) -cat << EOF | parted ---pretend-input-tty $LOOPDEV > /dev/null 2>&1 -resizepart $ROOT_PART -${NEW_SIZE}B -yes -EOF -FIRST_LBA=$(sfdisk -d $LOOPDEV | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) END_SECTOR=$(sgdisk -i $ROOT_PART $LOOPDEV | grep "Last sector:" | cut -d ' ' -f 3) +FIRST_LBA=$(sfdisk -d $LOOPDEV | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) FINAL_SIZE=$(( ($END_SECTOR + $FIRST_LBA) * $SECTOR_SIZE )) +parted -s -a minimal "$LOOPDEV" rm $ROOT_PART >/dev/null +parted -s "$LOOPDEV" unit B mkpart primary $(($START_SECTOR*$SECTOR_SIZE)) $NEW_SIZE >/dev/null losetup -d $LOOPDEV truncate --size=$FINAL_SIZE $IMAGE > /dev/null +echo "last-lba: $END_SECTOR" | sfdisk $IMAGE >/dev/null sgdisk -ge $IMAGE > /dev/null sgdisk -v $IMAGE > /dev/null From 9d0f66f4fb922082c0dac971ee1e623a1b3de5c1 Mon Sep 17 00:00:00 2001 From: EgorNiKO <тшniko_egor@mail.ru> Date: Wed, 30 Oct 2024 02:37:17 +0000 Subject: [PATCH 07/30] Changed output file name --- build/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/release.sh b/build/release.sh index 0f1bf1a..c74fbef 100755 --- a/build/release.sh +++ b/build/release.sh @@ -181,7 +181,7 @@ sgdisk -v $IMAGE > /dev/null echo "Image shrunked from ${TOTAL_BLOCKS} to ${TOTAL_BLOCKS_SHRINKED}." # compression image and rename xz file -NEW_NAME="openipc_sbcgc_${BOARD}_${BUILD_DATE}_${VERSION}.img" +NEW_NAME="openipc_sbcgs_${BOARD}_${BUILD_DATE}_${VERSION}.img" echo_blue "Compression image and rename xz file $NEW_NAME" mv $IMAGE $NEW_NAME xz -T0 $NEW_NAME From 9b73adb466a45c0f61b016429ebd0394e324ce33 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Wed, 30 Oct 2024 12:19:20 +0000 Subject: [PATCH 08/30] Fix problem truncate --- build/release.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/release.sh b/build/release.sh index c74fbef..639762a 100755 --- a/build/release.sh +++ b/build/release.sh @@ -166,15 +166,14 @@ resize2fs -M $ROOT_DEV TOTAL_BLOCKS_SHRINKED=$(sudo tune2fs -l "$ROOT_DEV" | grep '^Block count:' | tr -s ' ' | cut -d ' ' -f 3) sync $ROOT_DEV NEW_SIZE=$(( $START_SECTOR * $SECTOR_SIZE + $TARGET_BLOCKS * $BLOCK_SIZE )) +parted -s -a minimal "$LOOPDEV" rm $ROOT_PART >/dev/null +parted -s "$LOOPDEV" unit B mkpart primary $(($START_SECTOR*$SECTOR_SIZE)) $NEW_SIZE >/dev/null END_SECTOR=$(sgdisk -i $ROOT_PART $LOOPDEV | grep "Last sector:" | cut -d ' ' -f 3) FIRST_LBA=$(sfdisk -d $LOOPDEV | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) FINAL_SIZE=$(( ($END_SECTOR + $FIRST_LBA) * $SECTOR_SIZE )) -parted -s -a minimal "$LOOPDEV" rm $ROOT_PART >/dev/null -parted -s "$LOOPDEV" unit B mkpart primary $(($START_SECTOR*$SECTOR_SIZE)) $NEW_SIZE >/dev/null losetup -d $LOOPDEV truncate --size=$FINAL_SIZE $IMAGE > /dev/null -echo "last-lba: $END_SECTOR" | sfdisk $IMAGE >/dev/null sgdisk -ge $IMAGE > /dev/null sgdisk -v $IMAGE > /dev/null From 8bc3b92a9fbcd590a31754899bb80d954596c3e3 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Wed, 30 Oct 2024 21:18:28 +0000 Subject: [PATCH 09/30] Fix: modificate uuid on resize rootfs --- build/release.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build/release.sh b/build/release.sh index 639762a..ce29d01 100755 --- a/build/release.sh +++ b/build/release.sh @@ -165,9 +165,11 @@ BLOCK_SIZE=$(tune2fs -l $ROOT_DEV | grep '^Block size:' | tr -s ' ' | cut -d ' ' resize2fs -M $ROOT_DEV TOTAL_BLOCKS_SHRINKED=$(sudo tune2fs -l "$ROOT_DEV" | grep '^Block count:' | tr -s ' ' | cut -d ' ' -f 3) sync $ROOT_DEV -NEW_SIZE=$(( $START_SECTOR * $SECTOR_SIZE + $TARGET_BLOCKS * $BLOCK_SIZE )) -parted -s -a minimal "$LOOPDEV" rm $ROOT_PART >/dev/null -parted -s "$LOOPDEV" unit B mkpart primary $(($START_SECTOR*$SECTOR_SIZE)) $NEW_SIZE >/dev/null +NEW_SIZE=$(( ($START_SECTOR * $SECTOR_SIZE + $TARGET_BLOCKS * $BLOCK_SIZE) / $SECTOR_SIZE)) + +newGPT=$(echo "$(sfdisk -d $LOOPDEV)" | sed "s/\(.*${ROOT_PART}\W:\)\(.*size=\W*\)[0-9]*\(.*\)/\1\2${NEW_SIZE}\3/") +echo "$newGPT" | sfdisk $LOOPDEV > /dev/null + END_SECTOR=$(sgdisk -i $ROOT_PART $LOOPDEV | grep "Last sector:" | cut -d ' ' -f 3) FIRST_LBA=$(sfdisk -d $LOOPDEV | grep 'first-lba:' | tr -d ' ' | cut -d ':' -f 2) FINAL_SIZE=$(( ($END_SECTOR + $FIRST_LBA) * $SECTOR_SIZE )) From c05e28350d75819c7b21ecc46d277217ec147b40 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Wed, 30 Oct 2024 21:23:08 +0000 Subject: [PATCH 10/30] Linux not loading if bootfs on 1 or big number patition --- build/add_config_disk.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/add_config_disk.sh b/build/add_config_disk.sh index cd11e73..c648853 100755 --- a/build/add_config_disk.sh +++ b/build/add_config_disk.sh @@ -115,19 +115,19 @@ LOOPDEV=$(losetup -P --show -f $TMP_DISK) # Formatting mkfs.fat ${LOOPDEV}p${CONFIG_PART} - # Определяем название одноплатнка + # We define the name of the single-board computer mount ${LOOPDEV}p${ROOT_PART} /mnt BOARD=$(cat /mnt/etc/hostname) echo $BOARD umount /mnt - # Изменяем раздел загрузик в U-Boot + # Changing the partition boot in U-Boot case $BOARD in orangepi3b) mount ${LOOPDEV}p${BOOT_PART} /mnt sed -i "s/rootdev=UUID=.*/rootdev=\/dev\/disk\/by-partuuid\/$(blkid -s PARTUUID -o value ${LOOPDEV}p${ROOT_PART})/" /mnt/orangepiEnv.txt sed -i "s/if test \"\${devtype}\".*/setenv partuuid \"$(blkid -s PARTUUID -o value ${LOOPDEV}p${BOOT_PART})\"/" /mnt/boot.cmd - sed -i "/# default values/a setenv devnum \"0:2\"" /mnt/boot.cmd + sed -i "/# default values/a setenv devnum \"\${devnum}:$(($ROOT_PART-1))\"" /mnt/boot.cmd mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d /mnt/boot.cmd /mnt/boot.scr umount /mnt ;; From 3d46b53ffa5a2da88f044bff75f13bbbe2837f0b Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Wed, 30 Oct 2024 21:41:12 +0000 Subject: [PATCH 11/30] Archivation stops if .xz file exists --- build/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/release.sh b/build/release.sh index ce29d01..0c76d75 100755 --- a/build/release.sh +++ b/build/release.sh @@ -185,7 +185,7 @@ echo "Image shrunked from ${TOTAL_BLOCKS} to ${TOTAL_BLOCKS_SHRINKED}." NEW_NAME="openipc_sbcgs_${BOARD}_${BUILD_DATE}_${VERSION}.img" echo_blue "Compression image and rename xz file $NEW_NAME" mv $IMAGE $NEW_NAME -xz -T0 $NEW_NAME +xz -fv -T0 $NEW_NAME echo_green "Finish" From 2d4829cd20add449d1acca01bc89eef32abf40cb Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 10:25:36 +0000 Subject: [PATCH 12/30] Fixed comments --- build/add_config_disk.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/add_config_disk.sh b/build/add_config_disk.sh index c648853..fc8ab40 100755 --- a/build/add_config_disk.sh +++ b/build/add_config_disk.sh @@ -44,15 +44,15 @@ fi echo "Create a new disk" -# Копируем сектора с загрузчиками +# Copy sectors and bootloader skip_mb=$(($start_sector/$mbToSector)) # We do not read empty blocks at the beginning of the img image, in MB dd if=$1 of=$TMP_DISK bs=1M count=$skip_mb -# Добавить 16М + образ +# Add 16M + images seek_mb=$(($skip_mb + $SIZE_DISK)) # Seek +16М dd if=$1 of=$TMP_DISK bs=1M skip=$skip_mb seek=$seek_mb status=progress -# Добавить в конец длинну, равную first_lba (нужно для sgdisk -ge) +# Add in end length equals first_lba (need for sgdisk -ge) size_img=$(($(du -b "$TMP_DISK" | awk '{print $1}')/$sector_size)) r34=$(($size_img - $full_lba)) if [ $r34 -ne $gptReserveSizeSector ];then From d6f8d2eb43f9d0af1d6dcd67593d5a9fe310aeae Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 12:25:48 +0000 Subject: [PATCH 13/30] Added automount partition /config --- build/add_config_disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/add_config_disk.sh b/build/add_config_disk.sh index fc8ab40..359c79a 100755 --- a/build/add_config_disk.sh +++ b/build/add_config_disk.sh @@ -118,7 +118,7 @@ LOOPDEV=$(losetup -P --show -f $TMP_DISK) # We define the name of the single-board computer mount ${LOOPDEV}p${ROOT_PART} /mnt BOARD=$(cat /mnt/etc/hostname) - echo $BOARD + echo "UUID=$(blkid -s UUID -o value ${LOOPDEV}p${CONFIG_PART}) /config vfat defaults,x-systemd.automount 0 2" >> /mnt/etc/fstab umount /mnt # Changing the partition boot in U-Boot From 24c563d95585cd3fd2b8d21aa2da3304e458f128 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 12:31:24 +0000 Subject: [PATCH 14/30] Removed unnecessary output --- build/add_config_disk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/add_config_disk.sh b/build/add_config_disk.sh index 359c79a..d13b8bd 100755 --- a/build/add_config_disk.sh +++ b/build/add_config_disk.sh @@ -128,7 +128,7 @@ LOOPDEV=$(losetup -P --show -f $TMP_DISK) sed -i "s/rootdev=UUID=.*/rootdev=\/dev\/disk\/by-partuuid\/$(blkid -s PARTUUID -o value ${LOOPDEV}p${ROOT_PART})/" /mnt/orangepiEnv.txt sed -i "s/if test \"\${devtype}\".*/setenv partuuid \"$(blkid -s PARTUUID -o value ${LOOPDEV}p${BOOT_PART})\"/" /mnt/boot.cmd sed -i "/# default values/a setenv devnum \"\${devnum}:$(($ROOT_PART-1))\"" /mnt/boot.cmd - mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d /mnt/boot.cmd /mnt/boot.scr + mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d /mnt/boot.cmd /mnt/boot.scr >/dev/null umount /mnt ;; esac From 2119bed9fcc33fff274bb26e61e0e49093b4d196 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 12:39:09 +0000 Subject: [PATCH 15/30] Adaptation for the main branch --- build/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/release.sh b/build/release.sh index 0c76d75..fa934fa 100755 --- a/build/release.sh +++ b/build/release.sh @@ -179,7 +179,7 @@ truncate --size=$FINAL_SIZE $IMAGE > /dev/null sgdisk -ge $IMAGE > /dev/null sgdisk -v $IMAGE > /dev/null -echo "Image shrunked from ${TOTAL_BLOCKS} to ${TOTAL_BLOCKS_SHRINKED}." +echo "Image shrunked from ${TOTAL_BLOCKS} to ${TOTAL_BLOCKS_SHRINKED}." # compression image and rename xz file NEW_NAME="openipc_sbcgs_${BOARD}_${BUILD_DATE}_${VERSION}.img" From 42370a28aa18ffed7f49c47e5e37f6d72fdcaea2 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 12:44:38 +0000 Subject: [PATCH 16/30] Solved problem replace the file-config from git repo --- .gitignore | 3 ++- build/config | 3 +-- build/config.example | 8 ++++++++ build/release.sh | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 build/config.example diff --git a/.gitignore b/.gitignore index 9bad3d4..1a923a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ rootfs/ *.img *.xz -*.7z \ No newline at end of file +*.7z +./config \ No newline at end of file diff --git a/build/config b/build/config index a0a7840..ef9dd84 100644 --- a/build/config +++ b/build/config @@ -4,6 +4,5 @@ IMAGE_URL="https://github.com/radxa-build/radxa-zero3/releases/download/b6/radxa IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zero-3_debian_bullseye_cli.img.xz" # Example file -IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" - +#IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" ROOTFS="rootfs" diff --git a/build/config.example b/build/config.example new file mode 100644 index 0000000..0611144 --- /dev/null +++ b/build/config.example @@ -0,0 +1,8 @@ +# The IMAGE_URL must be a local absolute path or a network download URL and iamge muse be .xz file +# !!! USE DEBIAN DISTRIBUTIONS !!! +IMAGE_URL="https://github.com/radxa-build/radxa-zero3/releases/download/b6/radxa-zero3_debian_bullseye_xfce_b6.img.xz" +IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zero3_debian_bullseye_cli.img.xz" + +# Example file +#IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" +ROOTFS="rootfs" diff --git a/build/release.sh b/build/release.sh index fa934fa..6d67c54 100755 --- a/build/release.sh +++ b/build/release.sh @@ -7,6 +7,7 @@ echo_blue() { printf "\033[1;34m$*\033[m\n"; } cd "$(dirname "$0")" +[ -f config ] || cp config.example config source config # Checking free space From 0885fc88ed072956773d6ee55f402756546ad604 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 17:09:45 +0000 Subject: [PATCH 17/30] Re-downloading or unpacking the image (solved) and add .7z, .img --- build/config | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/config b/build/config index ef9dd84..86a023d 100644 --- a/build/config +++ b/build/config @@ -4,5 +4,8 @@ IMAGE_URL="https://github.com/radxa-build/radxa-zero3/releases/download/b6/radxa IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zero-3_debian_bullseye_cli.img.xz" # Example file -#IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" +IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" +#IMAGE_URL=/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.img +#IMAGE_URL=radxa-zero3_debian_bullseye_cli.img + ROOTFS="rootfs" From 1532d6e065b737567e3fb9df1f73cf6ee42c1e38 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 17:20:55 +0000 Subject: [PATCH 18/30] Change final output --- build/release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/release.sh b/build/release.sh index 6d67c54..b5b2bd4 100755 --- a/build/release.sh +++ b/build/release.sh @@ -184,10 +184,10 @@ echo "Image shrunked from ${TOTAL_BLOCKS} to ${TOTAL_BLOCKS_SHRINKED}." # compression image and rename xz file NEW_NAME="openipc_sbcgs_${BOARD}_${BUILD_DATE}_${VERSION}.img" -echo_blue "Compression image and rename xz file $NEW_NAME" +echo_blue "Compression image and rename xz file '$NEW_NAME'" mv $IMAGE $NEW_NAME xz -fv -T0 $NEW_NAME -echo_green "Finish" +echo_green "$NEW_NAME" exit 0 From c7d6c78dd531a2c4f5f30423fc47cd78605edc2c Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 17:40:52 +0000 Subject: [PATCH 19/30] Add example and remove build/config from git --- .gitignore | 2 +- build/config | 11 ----------- build/config.example | 3 +++ 3 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 build/config diff --git a/.gitignore b/.gitignore index 1a923a6..59cebfa 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ rootfs/ *.img *.xz *.7z -./config \ No newline at end of file +build/config \ No newline at end of file diff --git a/build/config b/build/config deleted file mode 100644 index 86a023d..0000000 --- a/build/config +++ /dev/null @@ -1,11 +0,0 @@ -# The IMAGE_URL must be a local absolute path or a network download URL and iamge muse be .xz file -# !!! USE DEBIAN DISTRIBUTIONS !!! -IMAGE_URL="https://github.com/radxa-build/radxa-zero3/releases/download/b6/radxa-zero3_debian_bullseye_xfce_b6.img.xz" -IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zero-3_debian_bullseye_cli.img.xz" - -# Example file -IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" -#IMAGE_URL=/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.img -#IMAGE_URL=radxa-zero3_debian_bullseye_cli.img - -ROOTFS="rootfs" diff --git a/build/config.example b/build/config.example index 0611144..18396e5 100644 --- a/build/config.example +++ b/build/config.example @@ -5,4 +5,7 @@ IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zer # Example file #IMAGE_URL="/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.7z" +#IMAGE_URL=/root/Orangepi3b_1.0.6_debian_bullseye_server_linux5.10.160.img +#IMAGE_URL=radxa-zero3_debian_bullseye_cli.img + ROOTFS="rootfs" From 826644020d372579993641ea79df22522bc75b87 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Thu, 31 Oct 2024 17:42:54 +0000 Subject: [PATCH 20/30] Moved debug flag set +x to config --- build/config.example | 1 + build/release.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/config.example b/build/config.example index 18396e5..8b70e91 100644 --- a/build/config.example +++ b/build/config.example @@ -9,3 +9,4 @@ IMAGE_URL="https://github.com/zhouruixi/rbuild/releases/download/image/radxa-zer #IMAGE_URL=radxa-zero3_debian_bullseye_cli.img ROOTFS="rootfs" +set +x \ No newline at end of file diff --git a/build/release.sh b/build/release.sh index b5b2bd4..94e392f 100755 --- a/build/release.sh +++ b/build/release.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -e -x +set -e echo_red() { printf "\033[1;31m$*\033[m\n"; } echo_green() { printf "\033[1;32m$*\033[m\n"; } echo_blue() { printf "\033[1;34m$*\033[m\n"; } From a19e84b8cc66b1e8986933df01ad555e39df2bd1 Mon Sep 17 00:00:00 2001 From: EgorNiKO <тшniko_egor@mail.ru> Date: Wed, 30 Oct 2024 01:00:53 +0000 Subject: [PATCH 21/30] Add .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 59cebfa..1bf7ec4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ rootfs/ *.img *.xz *.7z -build/config \ No newline at end of file +build/config From b957f800726c923aaa6387cfaabc5e7d1d7cae16 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Fri, 1 Nov 2024 23:10:10 +0000 Subject: [PATCH 22/30] In opi3b missing package gdisk --- build/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.sh b/build/build.sh index 9da2e42..f6cda5c 100755 --- a/build/build.sh +++ b/build/build.sh @@ -31,7 +31,7 @@ fi # Update system to date apt update DEBIAN_FRONTEND=noninteractive apt dist-upgrade -y --allow-downgrades -apt install -y git cmake dkms build-essential meson +apt install -y git cmake dkms build-essential meson gdisk ## [ -d /home/radxa/SourceCode ] || mkdir -p /home/radxa/SourceCode From 621a3c0ba3264a6659d4a31a22208dfb725ab306 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Fri, 1 Nov 2024 23:51:32 +0000 Subject: [PATCH 23/30] in opi3b missing package samba --- build/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.sh b/build/build.sh index f6cda5c..961e150 100755 --- a/build/build.sh +++ b/build/build.sh @@ -31,7 +31,7 @@ fi # Update system to date apt update DEBIAN_FRONTEND=noninteractive apt dist-upgrade -y --allow-downgrades -apt install -y git cmake dkms build-essential meson gdisk +apt install -y git cmake dkms build-essential meson gdisk samba ## [ -d /home/radxa/SourceCode ] || mkdir -p /home/radxa/SourceCode From 2eacaa0487718930bd78da9abd76de848631dc9b Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Sat, 2 Nov 2024 01:33:54 +0000 Subject: [PATCH 24/30] in opi3b missing package gpiod --- build/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.sh b/build/build.sh index 961e150..01b6222 100755 --- a/build/build.sh +++ b/build/build.sh @@ -31,7 +31,7 @@ fi # Update system to date apt update DEBIAN_FRONTEND=noninteractive apt dist-upgrade -y --allow-downgrades -apt install -y git cmake dkms build-essential meson gdisk samba +apt install -y git cmake dkms build-essential meson gdisk samba gpiod ## [ -d /home/radxa/SourceCode ] || mkdir -p /home/radxa/SourceCode From 9a206bec0e7c2fcd957121998c27b2d3b7af9c20 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Sat, 2 Nov 2024 13:05:29 +0000 Subject: [PATCH 25/30] Initial compatibility with opi3b --- gs/gs-init.sh | 28 ++++++++++++++++++---------- gs/gs.sh | 50 +++++++++++++++++++++++++++++--------------------- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/gs/gs-init.sh b/gs/gs-init.sh index 308e567..fdde19b 100755 --- a/gs/gs-init.sh +++ b/gs/gs-init.sh @@ -40,16 +40,24 @@ if [ "${REC_Dir}" != "$(grep -oP '(?<=^/dev/mmcblk1p4\t).*?(?=\t)' /etc/fstab)" echo -e "${os_dev}p4\t${REC_Dir}\texfat\tdefaults\t0\t0" >> /etc/fstab fi -# Enable dtbo -# set max resolution to 4k -dtc -I dts -O dtb -o /boot/dtbo/rk3566-hdmi-max-resolution-4k.dtbo /home/radxa/gs/rk3566-hdmi-max-resolution-4k.dts -# enbale USB OTG role switch -dtc -I dts -O dtb -o /boot/dtbo/rk3566-dwc3-otg-role-switch.dtbo /home/radxa/gs/rk3566-dwc3-otg-role-switch.dts -dtbo_enable_array=($dtbo_enable_list) -for dtbo in "${dtbo_enable_array[@]}"; do - mv /boot/dtbo/rk3568-${dtbo}.dtbo.disabled /boot/dtbo/rk3568-${dtbo}.dtbo -done -u-boot-update +case $BOARD in + radxa-zero3) + # Enable dtbo + [ -d /boot/dtbo ] || mkdir -p /boot/dtbo + # set max resolution to 4k + dtc -I dts -O dtb -o /boot/dtbo/rk3566-hdmi-max-resolution-4k.dtbo /home/radxa/gs/rk3566-hdmi-max-resolution-4k.dts + # enbale USB OTG role switch + dtc -I dts -O dtb -o /boot/dtbo/rk3566-dwc3-otg-role-switch.dtbo /home/radxa/gs/rk3566-dwc3-otg-role-switch.dts + dtbo_enable_array=($dtbo_enable_list) + for dtbo in "${dtbo_enable_array[@]}"; do + mv /boot/dtbo/rk3568-${dtbo}.dtbo.disabled /boot/dtbo/rk3568-${dtbo}.dtbo + done + u-boot-update + ;; + orangepi3b) + echo "" + ;; +esac # Add eth0 network configuration [ -f /etc/systemd/network/eth0.network ] || cat > /etc/systemd/network/eth0.network << EOF diff --git a/gs/gs.sh b/gs/gs.sh index 60abd70..c13149e 100755 --- a/gs/gs.sh +++ b/gs/gs.sh @@ -7,27 +7,35 @@ set -x source /config/gs.conf need_u_boot_update=0 need_reboot=0 - -# dtbo configuration -if [[ "$enable_external_antenna" == "yes" && ! -f /boot/dtbo/radxa-zero3-external-antenna.dtbo && -d /sys/class/net/wlan0 ]]; then - mv /boot/dtbo/radxa-zero3-external-antenna.dtbo.disabled /boot/dtbo/radxa-zero3-external-antenna.dtbo - need_u_boot_update=1 - need_reboot=1 -elif [[ "$enable_external_antenna" == "no" && -f /boot/dtbo/radxa-zero3-external-antenna.dtbo && -d /sys/class/net/wlan0 ]] ; then - mv /boot/dtbo/radxa-zero3-external-antenna.dtbo /boot/dtbo/radxa-zero3-external-antenna.dtbo.disabled - need_u_boot_update=1 - need_reboot=1 -fi - -dtbo_enable_array=($dtbo_enable_list) -for dtbo in "${dtbo_enable_array[@]}"; do - if [ -f /boot/dtbo/rk3568-${dtbo}.dtbo.disabled ]; then - echo "enable ${dtbo}" - mv /boot/dtbo/rk3568-${dtbo}.dtbo.disabled /boot/dtbo/rk3568-${dtbo}.dtbo - need_u_boot_update=1 - need_reboot=1 - fi -done +BOARD=$(cat /etc/hostname) + +case $BOARD in + radxa-zero3) + # dtbo configuration + if [[ "$enable_external_antenna" == "yes" && ! -f /boot/dtbo/radxa-zero3-external-antenna.dtbo && -d /sys/class/net/wlan0 ]]; then + mv /boot/dtbo/radxa-zero3-external-antenna.dtbo.disabled /boot/dtbo/radxa-zero3-external-antenna.dtbo + need_u_boot_update=1 + need_reboot=1 + elif [[ "$enable_external_antenna" == "no" && -f /boot/dtbo/radxa-zero3-external-antenna.dtbo && -d /sys/class/net/wlan0 ]] ; then + mv /boot/dtbo/radxa-zero3-external-antenna.dtbo /boot/dtbo/radxa-zero3-external-antenna.dtbo.disabled + need_u_boot_update=1 + need_reboot=1 + fi + + dtbo_enable_array=($dtbo_enable_list) + for dtbo in "${dtbo_enable_array[@]}"; do + if [ -f /boot/dtbo/rk3568-${dtbo}.dtbo.disabled ]; then + echo "enable ${dtbo}" + mv /boot/dtbo/rk3568-${dtbo}.dtbo.disabled /boot/dtbo/rk3568-${dtbo}.dtbo + need_u_boot_update=1 + need_reboot=1 + fi + done + ;; + orangepi3b) + echo "" + ;; +esac # Update REC_Dir in fstab [ -d $REC_Dir ] || mkdir -p $REC_Dir From 60942635b2b9cca209fec750775b699ab53a6370 Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Sat, 2 Nov 2024 17:17:14 +0000 Subject: [PATCH 26/30] fix miss install RTL8812CU RTL8731BU driver --- build/build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/build.sh b/build/build.sh index 01b6222..c96aac1 100755 --- a/build/build.sh +++ b/build/build.sh @@ -88,6 +88,7 @@ if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + ./dkms-install.sh popd else echo "${DRIVE_NAME} is already installed" @@ -117,6 +118,7 @@ if [ $(find /lib/modules -name ${DRIVE_NAME}* | wc -l) == 0 ];then sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile sed -i "s^dkms build -m \${DRV_NAME} -v \${DRV_VERSION}^dkms build -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh sed -i "s^dkms install -m \${DRV_NAME} -v \${DRV_VERSION}^dkms install -m \${DRV_NAME} -v \${DRV_VERSION} -k \$(ls /lib/modules | tail -n 1)^" dkms-install.sh + ./dkms-install.sh popd else echo "${DRIVE_NAME} is already installed" From 748896df521533e5be2c0e441b40891ec5523d6d Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Sat, 2 Nov 2024 17:25:38 +0000 Subject: [PATCH 27/30] Fix conflict to main branch --- build/build.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build/build.sh b/build/build.sh index c96aac1..2e8f124 100755 --- a/build/build.sh +++ b/build/build.sh @@ -213,7 +213,11 @@ DEBIAN_FRONTEND=noninteractive apt -y install lrzsz net-tools socat netcat exfat # disable services case $BOARD in radxa-zero3) + # disable services + sed -i '/disable_service systemd-networkd/a disable_service dnsmasq' /config/before.txt + # enable services + sed -i "s/disable_service systemd-networkd/# disable_service systemd-networkd/" /config/before.txt sed -i "s/disable_service ssh/# disable_service ssh/" /config/before.txt sed -i "s/disable_service nmbd/# disable_service smbd/" /config/before.txt sed -i "s/disable_service smbd/# disable_service nmbd/" /config/before.txt @@ -222,8 +226,11 @@ case $BOARD in apt purge -y cloud-initramfs-growroot sed -i "s/resize_root/# resize_root/" /config/before.txt - # disable services - sed -i '/disable_service systemd-networkd/a disable_service dnsmasq' /config/before.txt + # umanage NICs from NetwrkManager + cat > /etc/NetworkManager/conf.d/00-gs-unmanaged.conf << EOF + [keyfile] + unmanaged-devices=interface-name:eth0;interface-name:br0;interface-name:usb0;interface-name:dummy0;interface-name:radxa0;interface-name:wlx* +EOF ;; orangepi3b) # Added for compatibility with RadxaZero3 From 90597b0c12d7ff40a7995a705e3136caf8a0014a Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Sat, 2 Nov 2024 17:25:38 +0000 Subject: [PATCH 28/30] Fix conflict to main branch --- build/build.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build/build.sh b/build/build.sh index c96aac1..56e7cd6 100755 --- a/build/build.sh +++ b/build/build.sh @@ -210,10 +210,13 @@ popd # install useful packages DEBIAN_FRONTEND=noninteractive apt -y install lrzsz net-tools socat netcat exfatprogs ifstat fbi minicom bridge-utils console-setup psmisc ethtool drm-info libdrm-tests proxychains4 -# disable services case $BOARD in radxa-zero3) + # disable services + sed -i '/disable_service systemd-networkd/a disable_service dnsmasq' /config/before.txt + # enable services + sed -i "s/disable_service systemd-networkd/# disable_service systemd-networkd/" /config/before.txt sed -i "s/disable_service ssh/# disable_service ssh/" /config/before.txt sed -i "s/disable_service nmbd/# disable_service smbd/" /config/before.txt sed -i "s/disable_service smbd/# disable_service nmbd/" /config/before.txt @@ -222,8 +225,11 @@ case $BOARD in apt purge -y cloud-initramfs-growroot sed -i "s/resize_root/# resize_root/" /config/before.txt - # disable services - sed -i '/disable_service systemd-networkd/a disable_service dnsmasq' /config/before.txt + # umanage NICs from NetwrkManager + cat > /etc/NetworkManager/conf.d/00-gs-unmanaged.conf << EOF + [keyfile] + unmanaged-devices=interface-name:eth0;interface-name:br0;interface-name:usb0;interface-name:dummy0;interface-name:radxa0;interface-name:wlx* +EOF ;; orangepi3b) # Added for compatibility with RadxaZero3 From 07f738ac07ed5dcf5c0510554567d8c56666e4ce Mon Sep 17 00:00:00 2001 From: Ruixi Zhou Date: Tue, 5 Nov 2024 16:47:33 +0800 Subject: [PATCH 29/30] fix typo and build_dir Signed-off-by: Ruixi Zhou --- build/build.sh | 4 ++-- build/release.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/build.sh b/build/build.sh index b23c5a2..f1b9f35 100755 --- a/build/build.sh +++ b/build/build.sh @@ -130,8 +130,8 @@ sed -i '/disable_service systemd-networkd/a disable_service dnsmasq' /config/bef # enable services sed -i "s/disable_service systemd-networkd/# disable_service systemd-networkd/" /config/before.txt sed -i "s/disable_service ssh/# disable_service ssh/" /config/before.txt -sed -i "s/disable_service nmbd/# disable_service smbd/" /config/before.txt -sed -i "s/disable_service smbd/# disable_service nmbd/" /config/before.txt +sed -i "s/disable_service nmbd/# disable_service nmbd/" /config/before.txt +sed -i "s/disable_service smbd/# disable_service smbd/" /config/before.txt # disable auto extend root partition and rootfs apt purge -y cloud-initramfs-growroot diff --git a/build/release.sh b/build/release.sh index 6dfef75..d65f3de 100755 --- a/build/release.sh +++ b/build/release.sh @@ -5,7 +5,7 @@ echo_red() { printf "\033[1;31m$*\033[m\n"; } echo_green() { printf "\033[1;32m$*\033[m\n"; } echo_blue() { printf "\033[1;34m$*\033[m\n"; } -build_dir=$(dirname "$0") +build_dir=$(dirname $(readlink -f "$0")) cd $build_dir source config From 9a9cbae3095390d19c3799a26307914c01f9e4be Mon Sep 17 00:00:00 2001 From: EgorNiKO Date: Tue, 5 Nov 2024 19:50:43 +0000 Subject: [PATCH 30/30] Add lib libspdlog-dev --- build/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.sh b/build/build.sh index 8d68e27..8c16862 100755 --- a/build/build.sh +++ b/build/build.sh @@ -166,7 +166,7 @@ pushd wfb-ng popd # PixelPilot_rk / fpvue -apt install -y libcairo-dev libdrm-dev +apt install -y libcairo-dev libdrm-dev libspdlog-dev apt --no-install-recommends -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools case $BOARD in