Skip to content

Commit

Permalink
Release the first version
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed Sep 19, 2021
1 parent f27e309 commit 9e11d4d
Show file tree
Hide file tree
Showing 3 changed files with 469 additions and 0 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Armbian for Amlogic S9xxx STB

Compile the Armbian for Amlogic S9xxx STB. including install to EMMC and update related functions. Support Amlogic S9xxx STB are ***`s905x3, s905x2, s905x, s905w, s905d, s922x, s912`***, etc. such as ***`Phicomm-N1, Octopus-Planet, X96-Max+, HK1-Box, H96-Max-X3, Belink GT-King, Belink GT-King Pro, UGOOS AM6 Plus, Fiberhome HG680P, ZTE B860H`***, etc.

The latest version of the Armbian firmware can be downloaded in [Releases](https://github.com/ophub/amlogic-s9xxx-armbian/releases).

## Armbian Firmware instructions

| Model | STB | Armbian Firmware |
| ---- | ---- | ---- |
| s905x3 | [X96-Max+](https://tokopedia.link/uMaH09s41db), [HK1-Box](https://tokopedia.link/xhWeQgTuwfb), [H96-Max-X3](https://tokopedia.link/KuWvwoYuwfb), [Ugoos-X3](https://tokopedia.link/duoIXZpdGgb), [X96-Air](https://tokopedia.link/5WHiETbdGgb), [A95XF3-Air](https://tokopedia.link/ByBL45jdGgb) | armbian_aml_s905x3_buster_k*.img |
| s905x2 | [X96Max-4G](https://tokopedia.link/HcfLaRzjqeb), [X96Max-2G](https://tokopedia.link/HcfLaRzjqeb) | armbian_aml_s905x2_buster_k*.img |
| s905x | [HG680P](https://tokopedia.link/HbrIbqQcGgb), [B860H](https://tokopedia.link/LC4DiTXtEib) | armbian_aml_s905x_buster_k*.img |
| s905w | [X96-Mini](https://tokopedia.link/ro207Hsjqeb), [TX3-Mini](https://www.tokopedia.com/beststereo/tanix-tx3-mini-2gb-16gb-android-7-1-kodi-17-3-amlogic-s905w-4k-tv-box) | armbian_aml_s905w_buster_k*.img |
| s922x | [Belink](https://tokopedia.link/RAgZmOM41db), [Belink-Pro](https://tokopedia.link/sfTHlfS41db), [Ugoos-AM6-Plus](https://tokopedia.link/pHGKXuV41db) | armbian_aml_s922x_buster_k*.img |
| s912 | [H96-Pro-Plus](https://tokopedia.link/jb42fsBdGgb), Octopus-Planet | armbian_aml_s912_buster_k*.img |
| s905d | Phicomm-N1 | armbian_aml_s905d_buster_k*.img |

## Install to EMMC and update instructions

Choose the corresponding firmware according to your STB. Then write the IMG file to the USB hard disk through software such as [Rufus](https://rufus.ie/) or [balenaEtcher](https://www.balena.io/etcher/). Insert the USB hard disk into the STB. Common for all `Amlogic S9xxx STB`.

- ### Install Armbian

Login in to armbian (default user: root, default password: 1234) → input command:

```yaml
armbian-install
```

- ### Update Armbian

Login in to armbian → input command:

```yaml
armbian-update
```

## Kernel

- The kernels of `amlogic s9xxx armbian` and `amlogic s9xxx openwrt` are common, you can directly use the [kernel](https://github.com/ophub/flippy-kernel) compiled by flippy to to `update armbian`.

- In the same way, you can also extract the kernel for openwrt from the armbian, The extracted kernel storage path in the `build/output/images` directory, and the file name is `amlogic-s9xxx-openwrt-kernel-*.tar.gz`. The kernel can be used in the [amlogic-s9xxx-openwrt](https://github.com/ophub/amlogic-s9xxx-openwrt/tree/main/amlogic-s9xxx/amlogic-kernel).

## Acknowledgments

The [armbian](https://github.com/armbian/build) directly calls the official source code for compilation, The `u-boot` uses related resources developed by [flippy](https://github.com/unifreq/openwrt_packit) for `amlogic s9xxx openwrt`. The compilation ideas refer to the tutorial of [ebkso](https://www.kflyo.com/howto-compile-armbian-for-n1-box), thanks.

## License

[LICENSE](https://github.com/ophub/build-armbian/blob/main/LICENSE) © OPHUB

102 changes: 102 additions & 0 deletions kernel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/bash
#========================================================================================================================
# Description: Automatically Build the kernel for OpenWrt
# Copyright (C) 2021 https://github.com/ophub/build-armbian
#========================================================================================================================

make_path=${PWD}
tmp_path=${make_path}/tmp_kernel
armbian_tmp=${tmp_path}/armbian_tmp
kernel_tmp=${tmp_path}/kernel_tmp
dtb_tmp=${tmp_path}/dtb_tmp
modules_tmp=${tmp_path}/modules_tmp
armbian_outputpath=${make_path}/build/output/images
armbian_dtbpath=https://github.com/ophub/amlogic-s9xxx-openwrt/trunk/amlogic-s9xxx/amlogic-dtb

die() {
echo -e " [ \033[1;31m Error \033[0m ] ${1}"
exit 1
}

build_kernel() {
echo "Start build kernel for amlogic-s9xxx-openwrt ..."

mkdir -p ${armbian_tmp} ${kernel_tmp} ${dtb_tmp} ${modules_tmp}

cd ${tmp_path}
echo "copy armbian to tmp folder ..."
cp ${armbian_outputpath}/*.img . && sync
armbian_old=$( ls *.img 2>/dev/null | head -n 1 )
echo "armbian: ${armbian_old}"

echo "mount armbian ..."
loop_old=$(losetup -P -f --show "${armbian_old}")
[ ${loop_old} ] || die "losetup ${armbian_old} failed."

if ! mount ${loop_old}p1 ${armbian_tmp}; then
die "mount ${loop_old}p1 failed!"
fi
sync && sleep 3

echo "Copy modules files"
cp -rf ${armbian_tmp}/lib/modules/* ${modules_tmp} && sync
if [ $( ls ${modules_tmp}/ -l 2>/dev/null | grep "^d" | wc -l ) -eq 0 ]; then
die "The modules files is Missing!"
fi
armbian_version=$(ls ${modules_tmp}/)
echo "armbian_version: ${armbian_version}"
kernel_version=$(echo ${armbian_version} | grep -oE '[1-9].[0-9]{1,2}.[0-9]+')
mkdir -p ${kernel_version}
echo "kernel_version: ${kernel_version}"

echo "Copy five boo kernel files"
cp -f ${armbian_tmp}/boot/{config-*,initrd.img-*,System.map-*,uInitrd-*,vmlinuz-*} ${kernel_tmp} && sync
if [ ! -f ${kernel_tmp}/config-* -o ! -f ${kernel_tmp}/initrd.img-* -o ! -f ${kernel_tmp}/System.map-* -o ! -f ${kernel_tmp}/uInitrd-* -o ! -f ${kernel_tmp}/vmlinuz-* ]; then
die "The five boot kernel files is Missing!"
fi

echo "supplement .dtb file from github.com ..."
svn checkout ${armbian_dtbpath} ${dtb_tmp} >/dev/null 2>&1
echo "Copy .dtb files"
cp -f ${armbian_tmp}/boot/dtb-*/amlogic/*.dtb ${dtb_tmp} && sync
sync

cd ${modules_tmp}
echo "Package modules-${armbian_version}.tar.gz"
tar -czf modules-${armbian_version}.tar.gz *
mv -f modules-${armbian_version}.tar.gz ../${kernel_version} && sync

cd ${dtb_tmp}
echo "Package dtb-amlogic-${armbian_version}.tar.gz"
rm -rf $(find . -type d) 2>/dev/null && sync
rm -rf .svn && sync
tar -czf dtb-amlogic-${armbian_version}.tar.gz *
mv -f dtb-amlogic-${armbian_version}.tar.gz ../${kernel_version} && sync

cd ${kernel_tmp}
echo "Package boot-${armbian_version}.tar.gz"
tar -czf boot-${armbian_version}.tar.gz *
mv -f boot-${armbian_version}.tar.gz ../${kernel_version} && sync

cd ${tmp_path}
echo "umount old armbian ..."
umount -f ${armbian_tmp} 2>/dev/null
losetup -d ${loop_old} 2>/dev/null
echo "mv ${kernel_version} folder to ${armbian_outputpath}"
mv -f ${kernel_version} ${armbian_outputpath}/ && sync

cd ${armbian_outputpath}
echo "kernel save path: ${armbian_outputpath}/${kernel_version}.tar.gz"
tar -czf amlogic-s9xxx-openwrt-kernel-${kernel_version}.tar.gz ${kernel_version} && sync
rm -rf ${kernel_version} && sync

cd ${make_path}
echo "delete tmp folders ..."
rm -rf ${tmp_path} && sync

echo "build kernel complete ..."
}

build_kernel
wait

Loading

0 comments on commit 9e11d4d

Please sign in to comment.