main
Links 2022-04-05 21:37:27 +02:00
rodzic b9950a8492
commit 9132b9a7a1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 68FB9F01C0C482FC
10 zmienionych plików z 8798 dodań i 0 usunięć

4
.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1,4 @@
userpatches/overlay/extracted/*
userpatches/overlay/boot.scr
build/
uboot_sdcard.bin

Wyświetl plik

@ -1,2 +1,91 @@
# x6100-armbian
tools and scripts to build armbian for the x6100
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# requirements
- SD card updade image
- access to the x6100 (or a way to extract files form the update image)
# build steps
## extract uboot:
```
dd if=X6100-sdcard-20220219.img of=uboot_sdcard.bin bs=1024 skip=8 count=512 seek=0
```
## extract kernel and kernel modules
we need:
- zImage
- sun8i-r16-x6100.dtb
- kernel moduels found in /lib/modules/5.8.9
put the files to /userpatches/overlay/extracted
example:
```
└── userpatches
└── overlay
...
├── extracted
│   ├── modules
│   │   └── 5.8.9
│   │   ├── kernel
...........
│   │   ├── modules.alias
│   │   ├── modules.alias.bin
│   │   ├── modules.builtin
│   │   ├── modules.builtin.bin
│   │   ├── modules.builtin.modinfo
│   │   ├── modules.dep
│   │   ├── modules.dep.bin
│   │   ├── modules.devname
│   │   ├── modules.order
│   │   ├── modules.softdep
│   │   ├── modules.symbols
│   │   └── modules.symbols.bin
│   ├── sun8i-r16-x6100.dtb
│   └── zImage
```
## build armbian:
```
git clone https://github.com/armbian/build --depth=1
cp -r userpatches/ build/
cd build
./compile.sh docker BOARD=lime-a33 BRANCH=current RELEASE=buster BUILD_MINIMAL=no BUILD_DESKTOP=yes KERNEL_ONLY=no KERNEL_CONFIGURE=no DESKTOP_ENVIRONMENT=xfce DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base DESKTOP_APPGROUPS_SELECTED="3dsupport browsers" COMPRESS_OUTPUTIMAGE=sha,gpg,img
```
## install on sdcard
install armbian:
```
dd if=output/images/Armbian_22.05.0-trunk_Lime-a33_buster_current_5.15.32_xfce_desktop.img of=/dev/<SDCARD>
```
install uboot:
```
dd if=uboot_sdcard.bin of=/dev/<SDCARD> bs=1024 seek=8
```
# booting armbian kernel
Note:
currently the screen driver src is not public, resulting in no screen output.
(kernel/drivers/gpu/drm/panel/panel-jlt4013a-pss.ko)
change:
/userpatches/overlay/boot.cmd
from:
```
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}/zImage_org
```
to:
```
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}/zImage
```

Wyświetl plik

@ -0,0 +1,265 @@
#!/bin/bash
# arguments: $RELEASE $LINUXFAMILY $BOARD $BUILD_DESKTOP
#
# This is the image customization script
# NOTE: It is copied to /tmp directory inside the image
# and executed there inside chroot environment
# so don't reference any files that are not already installed
# NOTE: If you want to transfer files between chroot and host
# userpatches/overlay directory on host is bind-mounted to /tmp/overlay in chroot
# The sd card's root path is accessible via $SDCARD variable.
RELEASE=$1
LINUXFAMILY=$2
BOARD=$3
BUILD_DESKTOP=$4
Main() {
touch /root/.no_rootfs_resize
apt-get install -y wsjtx tightvncserver xtightvncserver gdb-minimal gdbserver strace
apt-get install -y nano htop curl ncdu gpg dtrx localepurge mtr-tiny screen iotop git wget net-tools etckeeper sudo file bash-completion psmisc dnsutils software-properties-common apt-transport-https xauth aptitude fzf
cp /tmp/overlay/locale.nopurge /etc/locale.nopurge
cp /tmp/overlay/extracted/sun8i-r16-x6100.dtb /boot/
cp /tmp/overlay/extracted/sun8i-r16-x6100.dts /boot/
cp /tmp/overlay/extracted/zImage /boot/zImage_org
cp /tmp/overlay/boot.cmd /boot/boot.cmd
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
cp /tmp/overlay/*.sh /root/
chmod +x /root/*.sh
cp /tmp/overlay/gpio_setup.service /etc/systemd/system/gpio_setup.service
systemctl enable gpio_setup.service
cp -r /tmp/overlay/extracted/modules/* /lib/modules/
case $RELEASE in
stretch)
# your code here
# InstallOpenMediaVault # uncomment to get an OMV 4 image
;;
buster)
# your code here
;;
bullseye)
# your code here
;;
bionic)
# your code here
;;
focal)
# your code here
;;
esac
} # Main
InstallOpenMediaVault() {
# use this routine to create a Debian based fully functional OpenMediaVault
# image (OMV 3 on Jessie, OMV 4 with Stretch). Use of mainline kernel highly
# recommended!
#
# Please note that this variant changes Armbian default security
# policies since you end up with root password 'openmediavault' which
# you have to change yourself later. SSH login as root has to be enabled
# through OMV web UI first
#
# This routine is based on idea/code courtesy Benny Stark. For fixes,
# discussion and feature requests please refer to
# https://forum.armbian.com/index.php?/topic/2644-openmediavault-3x-customize-imagesh/
echo root:openmediavault | chpasswd
rm /root/.not_logged_in_yet
. /etc/default/cpufrequtils
export LANG=C LC_ALL="en_US.UTF-8"
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
case ${RELEASE} in
jessie)
OMV_Name="erasmus"
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all3.deb"
;;
stretch)
OMV_Name="arrakis"
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all4.deb"
;;
esac
# Add OMV source.list and Update System
cat > /etc/apt/sources.list.d/openmediavault.list <<- EOF
deb https://openmediavault.github.io/packages/ ${OMV_Name} main
## Uncomment the following line to add software from the proposed repository.
deb https://openmediavault.github.io/packages/ ${OMV_Name}-proposed main
## This software is not part of OpenMediaVault, but is offered by third-party
## developers as a service to OpenMediaVault users.
# deb https://openmediavault.github.io/packages/ ${OMV_Name} partner
EOF
# Add OMV and OMV Plugin developer keys, add Cloudshell 2 repo for XU4
if [ "${BOARD}" = "odroidxu4" ]; then
add-apt-repository -y ppa:kyle1117/ppa
sed -i 's/jessie/xenial/' /etc/apt/sources.list.d/kyle1117-ppa-jessie.list
fi
mount --bind /dev/null /proc/mdstat
apt-get update
apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
apt-get update
# install debconf-utils, postfix and OMV
HOSTNAME="${BOARD}"
debconf-set-selections <<< "postfix postfix/mailname string ${HOSTNAME}"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'No configuration'"
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends \
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \
debconf-utils postfix
# move newaliases temporarely out of the way (see Ubuntu bug 1531299)
cp -p /usr/bin/newaliases /usr/bin/newaliases.bak && ln -sf /bin/true /usr/bin/newaliases
sed -i -e "s/^::1 localhost.*/::1 ${HOSTNAME} localhost ip6-localhost ip6-loopback/" \
-e "s/^127.0.0.1 localhost.*/127.0.0.1 ${HOSTNAME} localhost/" /etc/hosts
sed -i -e "s/^mydestination =.*/mydestination = ${HOSTNAME}, localhost.localdomain, localhost/" \
-e "s/^myhostname =.*/myhostname = ${HOSTNAME}/" /etc/postfix/main.cf
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends \
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \
openmediavault
# install OMV extras, enable folder2ram and tweak some settings
FILE=$(mktemp)
wget "$OMV_EXTRAS_URL" -qO $FILE && dpkg -i $FILE
/usr/sbin/omv-update
# Install flashmemory plugin and netatalk by default, use nice logo for the latter,
# tweak some OMV settings
. /usr/share/openmediavault/scripts/helper-functions
apt-get -y -q install openmediavault-netatalk openmediavault-flashmemory
AFP_Options="mimic model = Macmini"
SMB_Options="min receivefile size = 16384\nwrite cache size = 524288\ngetwd cache = yes\nsocket options = TCP_NODELAY IPTOS_LOWDELAY"
xmlstarlet ed -L -u "/config/services/afp/extraoptions" -v "$(echo -e "${AFP_Options}")" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/smb/extraoptions" -v "$(echo -e "${SMB_Options}")" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/flashmemory/enable" -v "1" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/ssh/enable" -v "1" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/services/ssh/permitrootlogin" -v "0" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/system/time/ntp/enable" -v "1" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/system/time/timezone" -v "UTC" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/system/network/dns/hostname" -v "${HOSTNAME}" /etc/openmediavault/config.xml
xmlstarlet ed -L -u "/config/system/monitoring/perfstats/enable" -v "0" /etc/openmediavault/config.xml
echo -e "OMV_CPUFREQUTILS_GOVERNOR=${GOVERNOR}" >>/etc/default/openmediavault
echo -e "OMV_CPUFREQUTILS_MINSPEED=${MIN_SPEED}" >>/etc/default/openmediavault
echo -e "OMV_CPUFREQUTILS_MAXSPEED=${MAX_SPEED}" >>/etc/default/openmediavault
for i in netatalk samba flashmemory ssh ntp timezone interfaces cpufrequtils monit collectd rrdcached ; do
/usr/sbin/omv-mkconf $i
done
/sbin/folder2ram -enablesystemd || true
sed -i 's|-j /var/lib/rrdcached/journal/ ||' /etc/init.d/rrdcached
# Fix multiple sources entry on ARM with OMV4
sed -i '/stretch-backports/d' /etc/apt/sources.list
# rootfs resize to 7.3G max and adding omv-initsystem to firstrun -- q&d but shouldn't matter
echo 15500000s >/root/.rootfs_resize
sed -i '/systemctl\ disable\ armbian-firstrun/i \
mv /usr/bin/newaliases.bak /usr/bin/newaliases \
export DEBIAN_FRONTEND=noninteractive \
sleep 3 \
apt-get install -f -qq python-pip python-setuptools || exit 0 \
pip install -U tzupdate \
tzupdate \
read TZ </etc/timezone \
/usr/sbin/omv-initsystem \
xmlstarlet ed -L -u "/config/system/time/timezone" -v "${TZ}" /etc/openmediavault/config.xml \
/usr/sbin/omv-mkconf timezone \
lsusb | egrep -q "0b95:1790|0b95:178a|0df6:0072" || sed -i "/ax88179_178a/d" /etc/modules' /usr/lib/armbian/armbian-firstrun
sed -i '/systemctl\ disable\ armbian-firstrun/a \
sleep 30 && sync && reboot' /usr/lib/armbian/armbian-firstrun
# add USB3 Gigabit Ethernet support
echo -e "r8152\nax88179_178a" >>/etc/modules
# Special treatment for ODROID-XU4 (and later Amlogic S912, RK3399 and other big.LITTLE
# based devices). Move all NAS daemons to the big cores. With ODROID-XU4 a lot
# more tweaks are needed. CS2 repo added, CS1 workaround added, coherent_pool=1M
# set: https://forum.odroid.com/viewtopic.php?f=146&t=26016&start=200#p197729
# (latter not necessary any more since we fixed it upstream in Armbian)
case ${BOARD} in
odroidxu4)
HMP_Fix='; taskset -c -p 4-7 $i '
# Cloudshell stuff (fan, lcd, missing serials on 1st CS2 batch)
echo "H4sIAKdXHVkCA7WQXWuDMBiFr+eveOe6FcbSrEIH3WihWx0rtVbUFQqCqAkYGhJn
tF1x/vep+7oebDfh5DmHwJOzUxwzgeNIpRp9zWRegDPznya4VDlWTXXbpS58XJtD
i7ICmFBFxDmgI6AXSLgsiUop54gnBC40rkoVA9rDG0SHHaBHPQx16GN3Zs/XqxBD
leVMFNAz6n6zSWlEAIlhEw8p4xTyFtwBkdoJTVIJ+sz3Xa9iZEMFkXk9mQT6cGSQ
QL+Cr8rJJSmTouuuRzfDtluarm1aLVHksgWmvanm5sbfOmY3JEztWu5tV9bCXn4S
HB8RIzjoUbGvFvPw/tmr0UMr6bWSBupVrulY2xp9T1bruWnVga7DdAqYFgkuCd3j
vORUDQgej9HPJxmDDv+3WxblBSuYFH8oiNpHz8XvPIkU9B3JVCJ/awIAAA==" \
| tr -d '[:blank:]' | base64 --decode | gunzip -c >/usr/local/sbin/cloudshell2-support.sh
chmod 755 /usr/local/sbin/cloudshell2-support.sh
apt install -y i2c-tools odroid-cloudshell cloudshell2-fan
sed -i '/systemctl\ disable\ armbian-firstrun/i \
lsusb | grep -q -i "05e3:0735" && sed -i "/exit\ 0/i echo 20 > /sys/class/block/sda/queue/max_sectors_kb" /etc/rc.local \
/usr/sbin/i2cdetect -y 1 | grep -q "60: 60" && /usr/local/sbin/cloudshell2-support.sh' /usr/lib/armbian/armbian-firstrun
;;
bananapim3|nanopifire3|nanopct3plus|nanopim3)
HMP_Fix='; taskset -c -p 4-7 $i '
;;
edge*|ficus|firefly-rk3399|nanopct4|nanopim4|nanopineo4|renegade-elite|roc-rk3399-pc|rockpro64|station-p1)
HMP_Fix='; taskset -c -p 4-5 $i '
;;
esac
echo "* * * * * root for i in \`pgrep \"ftpd|nfsiod|smbd|afpd|cnid\"\` ; do ionice -c1 -p \$i ${HMP_Fix}; done >/dev/null 2>&1" \
>/etc/cron.d/make_nas_processes_faster
chmod 600 /etc/cron.d/make_nas_processes_faster
# add SATA port multiplier hint if appropriate
[ "${LINUXFAMILY}" = "sunxi" ] && \
echo -e "#\n# If you want to use a SATA PM add \"ahci_sunxi.enable_pmp=1\" to bootargs above" \
>>/boot/boot.cmd
# Filter out some log messages
echo ':msg, contains, "do ionice -c1" ~' >/etc/rsyslog.d/omv-armbian.conf
echo ':msg, contains, "action " ~' >>/etc/rsyslog.d/omv-armbian.conf
echo ':msg, contains, "netsnmp_assert" ~' >>/etc/rsyslog.d/omv-armbian.conf
echo ':msg, contains, "Failed to initiate sched scan" ~' >>/etc/rsyslog.d/omv-armbian.conf
# Fix little python bug upstream Debian 9 obviously ignores
if [ -f /usr/lib/python3.5/weakref.py ]; then
wget -O /usr/lib/python3.5/weakref.py \
https://raw.githubusercontent.com/python/cpython/9cd7e17640a49635d1c1f8c2989578a8fc2c1de6/Lib/weakref.py
fi
# clean up and force password change on first boot
umount /proc/mdstat
chage -d 0 root
} # InstallOpenMediaVault
UnattendedStorageBenchmark() {
# Function to create Armbian images ready for unattended storage performance testing.
# Useful to use the same OS image with a bunch of different SD cards or eMMC modules
# to test for performance differences without wasting too much time.
rm /root/.not_logged_in_yet
apt-get -qq install time
wget -qO /usr/local/bin/sd-card-bench.sh https://raw.githubusercontent.com/ThomasKaiser/sbc-bench/master/sd-card-bench.sh
chmod 755 /usr/local/bin/sd-card-bench.sh
sed -i '/^exit\ 0$/i \
/usr/local/bin/sd-card-bench.sh &' /etc/rc.local
} # UnattendedStorageBenchmark
InstallAdvancedDesktop()
{
apt-get install -yy transmission libreoffice libreoffice-style-tango meld remmina thunderbird kazam avahi-daemon
[[ -f /usr/share/doc/avahi-daemon/examples/sftp-ssh.service ]] && cp /usr/share/doc/avahi-daemon/examples/sftp-ssh.service /etc/avahi/services/
[[ -f /usr/share/doc/avahi-daemon/examples/ssh.service ]] && cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/
apt clean
} # InstallAdvancedDesktop
Main "$@"

Wyświetl plik

@ -0,0 +1,42 @@
setenv verbosity "1"
setenv devnum "0"
setenv rootdev "/dev/mmcblk${devnum}p1"
setenv kernel_addr_r 0x46000000
setenv fdt_addr_r 0x49000000
setenv ramdisk_addr_r 0x50000000
# Print boot source
itest.b *0x28 == 0x00 && echo "U-boot loaded from SD"
itest.b *0x28 == 0x02 && echo "U-boot loaded from eMMC or secondary SD"
itest.b *0x28 == 0x03 && echo "U-boot loaded from SPI"
echo "devnum: ${devnum}"
if test "${devtype}" = "mmc"; then
part uuid mmc ${devnum}:1 partuuid;
setenv devnum ${mmc_bootdev}
setenv rootdev "/dev/mmcblk${mmc_bootdev}p1"
fi
echo "Boot script loaded from ${devtype}"
echo "rootdev: ${rootdev}"
echo "devnum: ${devnum}"
echo "mmc_bootdev: ${mmc_bootdev}"
echo "prefix: ${prefix}"
echo "------------ x6100 boot script ------------"
setenv bootargs console=ttyS0,115200 root=${rootdev} rootwait panic=10 fbcon=rotate:3 video=VGA:480x800 cgroup_enable=memory swapaccount=1 loglevel=${verbosity}
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}/zImage_org
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}/uInitrd
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}/sun8i-r16-x6100.dtb
fdt addr ${fdt_addr_r}
fdt resize 65536
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
# Recompile with:
# mkimage -C none -A arm -T script -d boot.cmd boot.scr

Wyświetl plik

@ -0,0 +1,22 @@
#!/bin/bash
mkdir -p /mnt/x6100
mount /dev/mmcblk2p2 /mnt/x6100
mount -t proc proc /mnt/x6100/proc
mount -t sysfs sys /mnt/x6100/sys
mount -o bind /dev /mnt/x6100/dev
mount -t devpts /dev/pts /mnt/x6100/dev/pts/
mkdir -p /mnt/x6100/run/udev
mount -o bind /run/udev /mnt/x6100/run/udev
mkdir -p /tmp/pulse
mkdir -p /mnt/x6100/tmp/pulse
mount -o bind /tmp/pulse /mnt/x6100/tmp/pulse
mkdir -p /tmp/dbus
mkdir -p /mnt/x6100/tmp/dbus
mount -o bind /tmp/dbus /mnt/x6100/tmp/dbus
chroot /mnt/x6100 /bin/bash

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.5 MiB

Wyświetl plik

@ -0,0 +1,18 @@
[Unit]
Description=GPIO setup
Before=network.target
Before=systemd-user-sessions.service
Before=network-online.target
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/root/gpio_setup.sh start
ExecStop=/root/gpio_setup.sh stop
TimeoutSec=30
StartLimitInterval=350
StartLimitBurst=10
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,60 @@
#!/bin/bash
function gpio_un {
GPIO=$1
GPIO_PATH="/sys/class/gpio/gpio${GPIO}"
if [ ! -d ${GPIO_PATH} ]; then
echo ${GPIO} > /sys/class/gpio/unexport
fi
}
function gpio_ex {
GPIO=$1
GPIO_PATH="/sys/class/gpio/gpio${GPIO}"
if [ ! -d ${GPIO_PATH} ]; then
echo ${GPIO} > /sys/class/gpio/export
fi
}
function gpio_set {
GPIO=$1
GPIO_PATH="/sys/class/gpio/gpio${GPIO}"
echo "out" > ${GPIO_PATH}/direction
echo $2 > ${GPIO_PATH}/value
}
ACTION=start
if [ "$1" != "" ] ; then
ACTION=$1
fi
if [ "$ACTION" == "start" ] ; then
#WIFI
gpio_ex 357
#WIFI ON
gpio_set 357 0
#RF
gpio_ex 138
#RF OFF
gpio_set 138 0
#KEYPAD
gpio_ex 143
#KEYPAD ON
gpio_set 143 1
else
#KEYPAD OFF
gpio_set 143 0
gpio_un 143
#RF OFF
gpio_set 138 0
gpio_un 138
#WIFI OFF
gpio_set 357 1
gpio_un 357
fi

Wyświetl plik

@ -0,0 +1,9 @@
MANDELETE
DONTBOTHERNEWLOCALE
SHOWFREEDSPACE
QUICKNDIRTYCALC
en
de
en_US.UTF-8
de_DE.UTF-8