├── .github └── workflows │ └── rebuild-armbian.yml ├── .gitignore ├── README.md ├── armbian-rebuild ├── common-file ├── chroot.sh ├── libqrtr1_1.0-2_arm64.deb ├── libssl1.1_1.1.1n-0+deb11u3_arm64.deb ├── mobian-setup-usb-network ├── mobian-setup-usb-network.service ├── openstick-expanddisk-startup.service ├── openstick-expanddisk-startup.sh ├── openstick-utils-all.deb ├── qrtr-tools_1.0-2_arm64.deb ├── rmtfs_1.0-2_arm64.deb └── rules.v4 ├── download ├── kernel ├── boot.img ├── linux-headers-5.15.161+_5.15.161+-10.00.Custom_arm64.deb └── linux-image-5.15.161+_5.15.161+-10.00.Custom_arm64.deb └── modem ├── firmware-ufi001c.deb └── firmware-ufi003.deb /.github/workflows/rebuild-armbian.yml: -------------------------------------------------------------------------------- 1 | #========================================================================== 2 | # Description: Build Armbian 3 | # Copyright (C) 2023 https://github.com/windbell-project/msm8916-armbian 4 | #========================================================================== 5 | 6 | name: Rebuild armbian 7 | 8 | on: 9 | workflow_dispatch: 10 | inputs: 11 | armbian_board: 12 | description: "选择设备" 13 | required: true 14 | default: "ufi003" 15 | type: choice 16 | options: 17 | - ufi001c 18 | - ufi003 19 | 20 | jobs: 21 | build: 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: 安装依赖 25 | run: | 26 | sudo apt update -y 27 | sudo apt-get install -y zip flex bison libncurses-dev gawk libiberty-dev autoconf kmod bc build-essential gcc libc6 curl libstdc++6 git wget libssl-dev cpio p7zip-full img2simg qemu-user-static 28 | sudo apt clean 29 | - name: 下载源码 30 | run: | 31 | git clone https://github.com/windbell-project/msm8916-armbian 32 | - name: 下载镜像 33 | run: | 34 | pushd msm8916-armbian 35 | ./download 36 | popd 37 | - name: 打包 Armbian 38 | id: repack 39 | run: | 40 | pushd msm8916-armbian 41 | sudo mkdir armbian 42 | sudo mkdir armbian-msm8916 43 | sudo mkdir temp 44 | sudo dd if=/dev/zero of=temp.img bs=1M count=1536 45 | sudo dd if=/dev/zero of=armbian-msm8916.img bs=1M count=1234 46 | sudo mkfs.btrfs armbian-msm8916.img 47 | sudo mkfs.btrfs temp.img 48 | sudo mount -o compress=zstd:15 temp.img temp 49 | sudo mount -o compress=zstd:15 armbian-msm8916.img armbian-msm8916 50 | sudo losetup -P /dev/loop404 armbian.img 51 | sudo mount /dev/loop404p1 armbian 52 | sudo cp -rfp armbian/* temp 53 | sudo cp common-file/* temp/tmp 54 | sudo cp kernel/*.deb temp/tmp 55 | sudo cp modem/firmware-${{ inputs.armbian_board }}.deb temp/tmp 56 | sudo mount --bind /proc temp/proc 57 | sudo mount --bind /dev temp/dev 58 | sudo mount --bind /dev/pts temp/dev/pts 59 | sudo mount --bind /sys temp/sys 60 | sudo chroot temp /tmp/chroot.sh 61 | sudo rm temp/tmp/* 62 | sudo umount temp/proc 63 | sudo umount temp/dev/pts 64 | sudo umount temp/dev 65 | sudo umount temp/sys 66 | sudo cp -rfp temp/* armbian-msm8916 67 | sudo umount temp 68 | sudo umount armbian-msm8916 69 | sudo umount armbian 70 | sudo losetup -d /dev/loop404 71 | sudo img2simg armbian-msm8916.img rootfs.img 72 | sudo rm temp.img 73 | sudo rm -rf armbian 74 | sudo rm -rf armbian-msm8916 75 | sudo rm -rf temp 76 | popd 77 | echo "build_tag=Armbian_noble_save_$(date +"%Y.%m")" >> ${GITHUB_OUTPUT} 78 | - name: 上传 Armbian 镜像至 Release 79 | uses: ncipollo/release-action@main 80 | with: 81 | artifacts: "msm8916-armbian/rootfs.img,msm8916-armbian/kernel/boot.img" 82 | name: ${{ steps.repack.outputs.build_tag }} 83 | tag: ${{ steps.repack.outputs.build_tag }} 84 | allowUpdates: true 85 | removeArtifacts: false 86 | replacesArtifacts: true 87 | token: ${{ secrets.GITHUB_TOKEN }} 88 | body: | 89 | ### 以下是 Armbian OS 镜像 90 | - 本次固件基带为${{ inputs.armbian_board }} 91 | - 系统信息: 92 | - 默认用户名:root 93 | - 默认密码:1234 94 | - 全局配置命令:armbian-config 95 | - WiFi名称:4G-UFI 96 | - WiFi密码:12345678 97 | - 如遇无法开机的情况请使用未超频内核boot-no-overclock.img 98 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | armbian.img 2 | armbian-msm8916.img 3 | rootfs.img -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # msm8916-armbian 2 | MSM8916设备的Armbian镜像,支持UFI001B/C, UFI003等型号。 3 | 4 | ## 本地构建 5 | 1. 克隆本仓库 6 | 2. 执行download脚本 7 | 3. 以root权限运行armbian-rebuild脚本 8 | 4. 选择构建型号 9 | 5. 构建完成后会在源码目录得到rootfs.img 10 | -------------------------------------------------------------------------------- /armbian-rebuild: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 选择构建的设备 4 | echo "选择构建的设备:" 5 | echo "1. ufi001c" 6 | echo "2. ufi003" 7 | read -p "请输入设备型号:" device_type 8 | 9 | # 设置设备型号 10 | case $device_type in 11 | 1) 12 | device_type="ufi001c" 13 | ;; 14 | 2) 15 | device_type="ufi003" 16 | ;; 17 | *) 18 | echo "输入的设备型号不正确,请重新输入。" 19 | exit 1 20 | ;; 21 | esac 22 | 23 | # 创建目录 24 | mkdir -p original_image build temp 25 | 26 | # 创建镜像 27 | dd if=/dev/zero of=temp.img bs=1M count=1536 28 | mkfs.btrfs temp.img 29 | dd if=/dev/zero of=armbian-msm8916.img bs=1M count=1234 30 | mkfs.btrfs armbian-msm8916.img 31 | 32 | # 挂载镜像 33 | mount -t btrfs -o compress=zstd:15 temp.img temp 34 | mount -t btrfs -o compress=zstd:15 armbian-msm8916.img build 35 | losetup -P /dev/loop404 armbian.img 36 | mount /dev/loop404p1 original_image 37 | 38 | # 复制文件 39 | cp -frp original_image/* temp 40 | cp common-file/* temp/tmp 41 | cp kernel/*.deb temp/tmp 42 | cp modem/firmware-$device_type.deb temp/tmp 43 | 44 | # 挂载目录 45 | mount --bind /proc temp/proc 46 | mount --bind /dev temp/dev 47 | mount --bind /dev/pts temp/dev/pts 48 | mount --bind /sys temp/sys 49 | 50 | # 执行 chroot 51 | chroot temp /tmp/chroot.sh 52 | 53 | # 清理临时文件 54 | rm -rf temp/tmp/* 55 | 56 | # 卸载目录 57 | umount temp/proc 58 | umount temp/dev/pts 59 | umount temp/dev 60 | umount temp/sys 61 | 62 | # 复制文件 63 | cp -a temp/* build 64 | 65 | # 卸载镜像 66 | umount temp 67 | umount build 68 | umount original_image 69 | losetup -d /dev/loop404 70 | 71 | # 转换镜像 72 | img2simg armbian-msm8916.img rootfs.img 73 | 74 | # 清理工作目录 75 | rm -rf temp.img armbian-msm8916.img temp build original_image 76 | -------------------------------------------------------------------------------- /common-file/chroot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | install_package() { 4 | apt update 5 | dpkg -i /tmp/*.deb 6 | apt install -y coreutils network-manager modemmanager bc bsdmainutils gawk 7 | apt --fix-broken install -y 8 | apt install -y libqmi-utils 9 | DEBIAN_FRONTEND=noninteractive apt install -y iptables-persistent 10 | apt install -y dnsmasq-base 11 | } 12 | 13 | remove_package() { 14 | dpkg -l | grep -E "meson|linux-image" |awk '{print $2}'|xargs dpkg -P 15 | } 16 | 17 | set_language() { 18 | locale-gen zh_CN zh_CN.UTF-8 19 | update-locale LC_ALL=zh_CN.UTF-8 LANG=zh_CN.UTF-8 20 | fc-cache -fv 21 | } 22 | 23 | common_set() { 24 | rm /usr/sbin/openstick-startup-diagnose.sh 25 | rm /usr/lib/systemd/system/openstick-startup-diagnose.service 26 | rm /usr/lib/systemd/system/openstick-startup-diagnose.timer 27 | cp /tmp/mobian-setup-usb-network /usr/sbin/ 28 | cp /tmp/mobian-setup-usb-network.service /usr/lib/systemd/system/mobian-setup-usb-network.service 29 | cp /tmp/openstick-expanddisk-startup.sh /usr/sbin/ 30 | cp /tmp/rules.v4 /etc/iptables/ 31 | touch /etc/fstab 32 | echo "LABEL=aarch64 / btrfs defaults,noatime,compress=zstd,commit=30 0 0" > /etc/fstab 33 | sed -i '13 i\nmcli c u USB' /etc/rc.local 34 | sed -i 1s/-e// /etc/rc.local 35 | sed -i s/forking/idle/g /usr/lib/systemd/system/rc-local.service 36 | sed -i s/'Odroid N2'/MSM8916/g /etc/armbian-release 37 | sed -i s/'# ZRAM_PERCENTAGE=50'/ZRAM_PERCENTAGE=300/g /etc/default/armbian-zram-config 38 | sed -i s/'# MEM_LIMIT_PERCENTAGE=50'/MEM_LIMIT_PERCENTAGE=300/g /etc/default/armbian-zram-config 39 | sed -i '21 s/$sim/sim:sel/' /usr/sbin/openstick-sim-changer.sh 40 | rm /etc/localtime 41 | ln -s /usr/share/zoneinfo/Asia/Chongqing /etc/localtime 42 | } 43 | 44 | clean_file() { 45 | rm -rf /boot 46 | mkdir /boot 47 | } 48 | 49 | enable_motd() { 50 | chmod +x /etc/update-motd.d/* 51 | } 52 | 53 | clean_apt_lists() { 54 | rm -rf /var/lib/apt/lists 55 | apt clean all 56 | } 57 | 58 | remove_package 59 | clean_file 60 | install_package 61 | update-alternatives --set iptables /usr/sbin/iptables-legacy 62 | set_language 63 | common_set 64 | enable_motd 65 | clean_apt_lists 66 | exit -------------------------------------------------------------------------------- /common-file/libqrtr1_1.0-2_arm64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/common-file/libqrtr1_1.0-2_arm64.deb -------------------------------------------------------------------------------- /common-file/libssl1.1_1.1.1n-0+deb11u3_arm64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/common-file/libssl1.1_1.1.1n-0+deb11u3_arm64.deb -------------------------------------------------------------------------------- /common-file/mobian-setup-usb-network: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ ! -e /etc/NetworkManager/system-connections/USB.nmconnection ]; then 4 | # Create network connection 5 | nmcli connection add con-name USB \ 6 | ifname usb0 \ 7 | type ethernet \ 8 | ip4 192.168.68.1/24 9 | nmcli device wifi hotspot \ 10 | ifname wlan0 \ 11 | con-name wifi \ 12 | ssid 4G-UFI \ 13 | password 12345678 14 | 15 | # Set priorities so it doesn't take precedence over WiFi/mobile connections 16 | nmcli connection modify USB ipv4.route-metric 1500 17 | nmcli connection modify USB ipv4.dns-priority 150 18 | 19 | # Auto connection so it can be used for tethering 20 | nmcli connection modify USB ipv4.method shared 21 | nmcli connection modify USB connection.autoconnect yes 22 | nmcli c modify wifi ipv4.method shared ip4 "192.168.69.1/24" 23 | nmcli c modify wifi connection.autoconnect yes 24 | 25 | nmcli con add con-name "modem" type "gsm" ifname "wwan0qmi0" 26 | fi 27 | systemctl restart NetworkManager 28 | 29 | # set up ip forward 30 | sysctl -w net.ipv4.ip_forward=1 31 | -------------------------------------------------------------------------------- /common-file/mobian-setup-usb-network.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Setup USB networking 3 | Requires=NetworkManager.service 4 | After=NetworkManager.service 5 | ConditionFirstBoot=yes 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStart=/usr/sbin/mobian-setup-usb-network 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /common-file/openstick-expanddisk-startup.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Expand root to full size 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/usr/sbin/openstick-expanddisk-startup.sh 7 | ExecStartPost=/bin/systemctl disable openstick-expanddisk-startup.service 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | 12 | -------------------------------------------------------------------------------- /common-file/openstick-expanddisk-startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | get_root_mount_block() { 4 | awk '{if ( $2 == "/" ) { print $1, $3; exit; }}' /proc/mounts 5 | } 6 | 7 | main() { 8 | # I'm a posix standard script! 9 | # shellcheck disable=SC2046 10 | set -- $(get_root_mount_block) 11 | BLOCK="$1" 12 | FSTYPE="$2" 13 | 14 | logger "Resizeing root block $BLOCK($FSTYPE)" 15 | btrfs filesystem resize max "$BLOCK" 16 | 17 | } 18 | 19 | main 20 | 21 | -------------------------------------------------------------------------------- /common-file/openstick-utils-all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/common-file/openstick-utils-all.deb -------------------------------------------------------------------------------- /common-file/qrtr-tools_1.0-2_arm64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/common-file/qrtr-tools_1.0-2_arm64.deb -------------------------------------------------------------------------------- /common-file/rmtfs_1.0-2_arm64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/common-file/rmtfs_1.0-2_arm64.deb -------------------------------------------------------------------------------- /common-file/rules.v4: -------------------------------------------------------------------------------- 1 | # Generated by iptables-save v1.8.7 on Sat Feb 5 04:30:20 2022 2 | *nat 3 | :PREROUTING ACCEPT [0:0] 4 | :INPUT ACCEPT [0:0] 5 | :OUTPUT ACCEPT [4:276] 6 | :POSTROUTING ACCEPT [0:0] 7 | -A POSTROUTING -s 192.168.0.0/16 -j MASQUERADE 8 | COMMIT 9 | # Completed on Sat Feb 5 04:30:20 2022 10 | # Generated by iptables-save v1.8.7 on Sat Feb 5 04:30:20 2022 11 | *filter 12 | :INPUT ACCEPT [8:776] 13 | :FORWARD ACCEPT [0:0] 14 | :OUTPUT ACCEPT [16:1328] 15 | -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT 16 | -A FORWARD -s 192.168.0.0/16 -j ACCEPT 17 | COMMIT 18 | # Completed on Sat Feb 5 04:30:20 2022 19 | -------------------------------------------------------------------------------- /download: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tag=$(wget -qO- -t1 -T2 "https://api.github.com/repos/ophub/amlogic-s9xxx-armbian/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') 3 | file=$(wget -qO- -t1 -T2 "https://api.github.com/repos/ophub/amlogic-s9xxx-armbian/releases/latest" | grep "trunk" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') 4 | 5 | wget https://github.com/ophub/amlogic-s9xxx-armbian/releases/download/${tag}/${file} 6 | gunzip Armbian_*.gz 7 | mv Armbian_*.img armbian.img -------------------------------------------------------------------------------- /kernel/boot.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/kernel/boot.img -------------------------------------------------------------------------------- /kernel/linux-headers-5.15.161+_5.15.161+-10.00.Custom_arm64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/kernel/linux-headers-5.15.161+_5.15.161+-10.00.Custom_arm64.deb -------------------------------------------------------------------------------- /kernel/linux-image-5.15.161+_5.15.161+-10.00.Custom_arm64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/kernel/linux-image-5.15.161+_5.15.161+-10.00.Custom_arm64.deb -------------------------------------------------------------------------------- /modem/firmware-ufi001c.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/modem/firmware-ufi001c.deb -------------------------------------------------------------------------------- /modem/firmware-ufi003.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/windbell-project/msm8916-armbian/90a69d05c47795ddce33174c3550b2c5310fe9a4/modem/firmware-ufi003.deb --------------------------------------------------------------------------------