2014-11-26 11:33:58 +00:00
|
|
|
#!/bin/bash
|
2018-06-16 17:41:16 +00:00
|
|
|
#
|
|
|
|
|
# Copyright (c) Authors: http://www.armbian.com/authors
|
|
|
|
|
#
|
|
|
|
|
# This file is licensed under the terms of the GNU General Public
|
|
|
|
|
# License version 2. This program is licensed "as is" without any
|
|
|
|
|
# warranty of any kind, whether express or implied.
|
2016-02-23 12:10:14 +00:00
|
|
|
|
2017-01-14 20:35:53 +00:00
|
|
|
. /etc/armbian-release
|
|
|
|
|
. /etc/os-release
|
|
|
|
|
. /lib/init/vars.sh
|
|
|
|
|
. /lib/lsb/init-functions
|
2018-06-16 17:41:16 +00:00
|
|
|
. /usr/lib/armbian/armbian-common
|
2016-02-23 12:10:14 +00:00
|
|
|
|
2017-01-16 18:53:36 +00:00
|
|
|
case "$1" in
|
|
|
|
|
start)
|
2016-08-28 17:41:52 +00:00
|
|
|
|
2018-10-14 16:07:12 +00:00
|
|
|
# read number of cores needed below
|
|
|
|
|
cpu_cores=$(grep -c '^processor' /proc/cpuinfo | sed 's/^0$/1/')
|
|
|
|
|
|
|
|
|
|
# adjust custom htop initial configuration based on CPU count https://github.com/avafinger/htop-2.1.1_enhanced-version
|
VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh, Static MAC for networkd (#2789)
* VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh
VENDOR parameter in configuration
zsh is the best of course...
Static MAC for networkd
ROCK Pi N10 (Radxa) - Initial support, knwon bugs:
- Problem with poweroff (kernel panic).
- DeviceTree is not fully verified, I suspect missing and unnecessary
entries.
- No support for NPU
- u-boot without NVME support
- I have doubts if I chose the right preboot loader for RK3399Pro, NPU
and installed DDR memory.
* New RK3399Pro boot preloaders.
* rootfs checksum, DEBOOTSTRAP_LIST fix, output.log fix
Repaired checksum for rootfs
Added use PACKAGE_LIST_RM to purge DEBOOTSTRAP_LIST
Better logging to output.log
Fix for new host distribution detection (ie Debian Bullseye).
ubootdebs as new cleaning option
2021-05-11 19:50:14 +00:00
|
|
|
right_meters="Hostname Tasks LoadAverage DiskIO NetworkIO Uptime Systemd CpuFreq"
|
|
|
|
|
right_meter_modes="2 2 2 2 2 2 2 2"
|
2018-10-14 16:07:12 +00:00
|
|
|
sed -i 's/header_margin=.*/header_margin=1/g' /etc/skel/.config/htop/htoprc
|
VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh, Static MAC for networkd (#2789)
* VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh
VENDOR parameter in configuration
zsh is the best of course...
Static MAC for networkd
ROCK Pi N10 (Radxa) - Initial support, knwon bugs:
- Problem with poweroff (kernel panic).
- DeviceTree is not fully verified, I suspect missing and unnecessary
entries.
- No support for NPU
- u-boot without NVME support
- I have doubts if I chose the right preboot loader for RK3399Pro, NPU
and installed DDR memory.
* New RK3399Pro boot preloaders.
* rootfs checksum, DEBOOTSTRAP_LIST fix, output.log fix
Repaired checksum for rootfs
Added use PACKAGE_LIST_RM to purge DEBOOTSTRAP_LIST
Better logging to output.log
Fix for new host distribution detection (ie Debian Bullseye).
ubootdebs as new cleaning option
2021-05-11 19:50:14 +00:00
|
|
|
sed -i 's/left_meters=.*/left_meters=AllCPUs Memory Zram Swap CpuTemp/g' /etc/skel/.config/htop/htoprc
|
|
|
|
|
sed -i 's/left_meter_modes=.*/left_meter_modes=1 1 1 1 2/g' /etc/skel/.config/htop/htoprc
|
2018-10-14 16:07:12 +00:00
|
|
|
sed -i "s/right_meters=.*/right_meters=$right_meters/g" /etc/skel/.config/htop/htoprc
|
|
|
|
|
sed -i "s/right_meter_modes=.*/right_meter_modes=$right_meter_modes/g" /etc/skel/.config/htop/htoprc
|
|
|
|
|
# copy predefined settings for root user
|
|
|
|
|
cp -R /etc/skel/.config /root/
|
|
|
|
|
|
2017-01-16 18:53:36 +00:00
|
|
|
# Run a q&d benchmark to be able to identify cards way too slow easily
|
|
|
|
|
echo -e "\n### quick iozone test:$(cd /root; iozone -e -I -a -s 1M -r 4k -i 0 -i 1 -i 2 | grep '^ 1024' | sed 's/ 1024 //')" >> $Log
|
2017-01-15 16:41:54 +00:00
|
|
|
|
2018-06-16 17:41:16 +00:00
|
|
|
# Bluetooth tweaks
|
2017-05-14 14:36:17 +00:00
|
|
|
|
2017-04-15 17:21:42 +00:00
|
|
|
case ${BOARD} in
|
2018-01-27 09:04:23 +00:00
|
|
|
cubietruck)
|
2017-04-15 17:21:42 +00:00
|
|
|
systemctl enable brcm40183-patch && service brcm40183-patch start
|
|
|
|
|
;;
|
2018-06-16 17:41:16 +00:00
|
|
|
bananapim2zero|bananapim2plus|nanopiair|nanopim1plus|orangepizeroplus2*|orangepiwin|nanopineoplus2|nanopik2)
|
2017-04-15 17:21:42 +00:00
|
|
|
update-rc.d ap6212-bluetooth defaults
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2016-10-04 14:09:09 +00:00
|
|
|
|
2019-06-14 18:17:25 +00:00
|
|
|
# Debian Buster desktop bugfix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923289
|
|
|
|
|
[[ -d /etc/lightdm ]] && dpkg-reconfigure libgdk-pixbuf2.0-0 && update-mime-database /usr/share/mime
|
|
|
|
|
|
2017-01-16 18:53:36 +00:00
|
|
|
# update console info
|
|
|
|
|
setupcon --save
|
2017-11-03 15:20:12 +00:00
|
|
|
|
2018-04-29 13:02:11 +00:00
|
|
|
# add unique installation id to the image release file
|
2018-09-17 11:25:53 +00:00
|
|
|
sed '1s/^/IMAGE_UUID=/' /proc/sys/kernel/random/uuid >> /etc/armbian-image-release
|
2018-04-29 13:02:11 +00:00
|
|
|
|
2017-01-16 18:53:36 +00:00
|
|
|
# SSH Keys creation
|
|
|
|
|
rm -f /etc/ssh/ssh_host*
|
|
|
|
|
read entropy_before </proc/sys/kernel/random/entropy_avail
|
|
|
|
|
dpkg-reconfigure openssh-server >/dev/null 2>&1
|
|
|
|
|
service sshd restart
|
|
|
|
|
read entropy_after </proc/sys/kernel/random/entropy_avail
|
2017-04-07 06:51:08 +00:00
|
|
|
echo -e "\n### [firstrun] Recreated SSH keys (entropy: ${entropy_before} ${entropy_after})" >>${Log}
|
2017-11-03 15:20:12 +00:00
|
|
|
|
2017-10-11 11:00:02 +00:00
|
|
|
# get rid of purple background color in newt apps whiptail, partimage, debconf ... Reverting to Debian look.
|
2018-06-16 18:57:41 +00:00
|
|
|
[[ -f /etc/newt/palette ]] && sed -e 's/magenta/blue/g' -i /etc/newt/palette
|
2017-10-11 11:00:02 +00:00
|
|
|
|
2017-11-08 17:45:59 +00:00
|
|
|
# desktop tweaks - enable show windows content on stronger boards
|
|
|
|
|
if [[ ${cpu_cores} -gt 2 && -f /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml ]]; then
|
|
|
|
|
sed -i 's/<property name="box_move" type="bool" value=".*/<property name="box_move" type="bool" value="false"\/>/g' \
|
|
|
|
|
/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
|
|
|
|
|
fi
|
|
|
|
|
|
2018-09-17 11:25:53 +00:00
|
|
|
# randomize mac in armbianEnv.txt
|
2018-09-18 08:03:41 +00:00
|
|
|
if [[ -f /boot/armbianEnv.txt ]]; then
|
|
|
|
|
get_random_mac
|
|
|
|
|
sed -i "s/^ethaddr=.*/ethaddr=$MACADDR/" /boot/armbianEnv.txt
|
|
|
|
|
get_random_mac
|
|
|
|
|
sed -i "s/^eth1addr=.*/eth1addr=$MACADDR/" /boot/armbianEnv.txt
|
|
|
|
|
fi
|
2018-09-17 11:25:53 +00:00
|
|
|
|
|
|
|
|
# hardware workarounds per family
|
2017-01-14 20:35:53 +00:00
|
|
|
case $LINUXFAMILY in
|
2016-06-18 14:28:02 +00:00
|
|
|
sun7i|sun8i)
|
2017-01-14 20:35:53 +00:00
|
|
|
# set some mac address for BT
|
2017-09-07 20:02:27 +00:00
|
|
|
[[ -n $(lsmod | egrep "dhd|brcmfmac" ) ]] && \
|
2017-01-14 20:35:53 +00:00
|
|
|
(MACADDR=$(printf '43:29:B1:%02X:%02X:%02X\n' $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]) ; \
|
|
|
|
|
sed -i "s/^MAC_ADDR=.*/MAC_ADDR=${MACADDR}/" /etc/default/brcm40183 ;\
|
|
|
|
|
sed -i "s/^MAC_ADDR=.*/MAC_ADDR=${MACADDR}/" /etc/default/ap6212 \
|
|
|
|
|
echo -e "\n### [firstrun] Use MAC address ${MACADDR} for Bluetooth from now" >>${Log})
|
|
|
|
|
|
|
|
|
|
case $BOARD_NAME in
|
2017-10-11 11:46:03 +00:00
|
|
|
"NanoPi Air"|"NanoPi M1 Plus"|"Nanopi Neo Plus 2")
|
2017-03-18 18:00:56 +00:00
|
|
|
# change serial port for BT on FriendlyELEC H3 boards
|
2017-01-14 20:35:53 +00:00
|
|
|
sed -i "s/^PORT=.*/PORT=ttyS3/" /etc/default/ap6212
|
2017-03-18 18:00:56 +00:00
|
|
|
;;
|
2017-10-23 10:28:41 +00:00
|
|
|
"Orange Pi Zero"|"NanoPi Duo"|"Sunvell R69")
|
2018-09-17 12:46:50 +00:00
|
|
|
get_random_mac
|
|
|
|
|
echo "options xradio_wlan macaddr=${MACADDR}" >/etc/modprobe.d/xradio_wlan.conf
|
|
|
|
|
echo -e "\n### [firstrun] Use MAC address ${MACADDR} for Wi-Fi from now" >>${Log}
|
2017-01-14 20:35:53 +00:00
|
|
|
cd /etc/network/ && ln -sf interfaces.network-manager interfaces
|
|
|
|
|
(modprobe -r xradio_wlan && sleep 1 && modprobe xradio_wlan) &
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# trigger red or blue LED as user feedback
|
|
|
|
|
echo heartbeat >/sys/class/leds/*red*/trigger 2>/dev/null || echo heartbeat >/sys/class/leds/*blue*/trigger 2>/dev/null
|
2016-06-18 14:28:02 +00:00
|
|
|
;;
|
Bananapi R2 (#1151)
* Initial commit BPi R2:
Currently working/not working:
- u-boot:
- builds with minor issues
- patching and cleanup happens on 'https://github.com/chwe17/u-boot-mt'
- next (https://github.com/frank-w/BPI-R2-4.14)
- boots with minor issues
- ETH doesn't work with nm
- sata works
- no wifi (needs driver from: https://github.com/frank-w/BPI-R2-4.4)
- USB not working (xhci-mtk 1a1c0000.usb: fail to get vbus) needs investigation
- appended device tree is needed due to u-boot doesn't work with fdt (kernelpacking needs adjustemts e.g. cat zImage dtb > zImage-dtb
- dev (kernel.org master)
- untested, needs adjustments in config (e.g. CONFIG_LOCALVERSION="")
- since no defconfig is available config is based on frank-w 4.16 Kernel
- Kernel builds without issues
- manual packing of kernel and dtb similar to next
The board boots, serial console is available but everything else must be expected as not working!
- to do:
- u-boot needs a cleanup
- binary blobs needs investigation
- eMMC is **not tested** and needs for sure adjustements! (don't try nand-sata-install!!!)
- bootscript isn't tested (only manual boot over u-boot console at the moment)
- both kernelconfigs aren't 'armbian standard' modules need to be adjusted
Only use it when you know're familiar with u-boot commands!
* Small fixes, add bootscript
- add bootscript for patched u-boot (needs patching of u-boot, currently under investigation and not working properly)
- revert cat zImage dtb > zImage-dtb (cause not working)
- first cleanup of dev kernelconfig (remove CONFIG_LOCALVERSION="")
* Minor fixup
-kernelconfig for next was adjustet so that USB is recognized
-firt bootscripts was written to boot with source command (doesn't work 100% reliable)
-slightly adjustd boardconfig (e.g. bootscript)
must still be considered as early wip!
* small update (FDT works now)
-working bootscript
-adjusted boardconfig
-earlyprintk activated in kernelconfig
* First attempt to get ETH working
-all interfaces are bridged together
-performance sucks at the moment (not clear if it's related to insane network configuration or I miss something obvious... :P )
* Major update (see below for changes):
- 4.14 kernel was dropped due to https://forum.armbian.com/topic/7296-bananapi-r2-csc-mt7623-as-new-boardfamily/?do=findComment&comment=55194 and following
- boot.cmd was adjusted to 'clean' mainline behaviour
- next build opition and its defaultconfg was removed (at the moment dev only)
- rework of the network default configuration
- default configuration will be over network.d **not** NetworkManager
- per default all wired interfaces are bridged together to br0 (still wip)
- old 'interfaces' configuration was removed
- boardconfig is adjusted (no desktop until I've prove that HDMI works)
- what works/ not works:
- board boots up without manual u-boot hacking
- SATA, USB3 (massstorage) is tested and works without issues
- due to rework of network configuration this is still wip and must be considered as 'not working'
* moved to network.d for configuration of wired network
- renamed bsp packages
- blacklist wired interfaces for NetworkManager
- defined all wired interfaces as br0 in systemd/network
- defined networkd als default renderer for bionic (not tested yet!)
* The houskeeping commit:
- BOARDFAMILY was renamed to mt7623 instead of mt7623n (including patchfolders etc.)
- Network.d has no fully control over wired networkes (block NM from controll, start networkd on firstrun etc.)
- Further cleanup kernelconfig
- CPU temp is visible from userspace
- missed switch driver loaded
- cryptodrivers are there (not tested)
- still a bunch of work
* Add DMA mem alloc patch
-under testing!
* Add next option (4.17.y) stick dev to master (4.18-rc1 untested)
* minor fixes:
- solve kconfig issues between 4.17 and 4.18
- stick next branch to 4.18
- first attempts to bring up gmac2 (doesn't work currently)
* switch to upstream u-boot
- fix ext4 dependency in patch series
- kernelpacking currently broken
* add bootz & cmd_ext4
* resolved merge conflict
* apply ugly u-boot patch, fix bootscript
* remove unneeded stuff, apply forgotten stuff
* update config for dev & clean up boardconf (remove xenial)
* - drop dev and next, move into default. There is no intention to provide stock kernel
- fixed board description, renamed to WIP, where it can be merged later
- packing boot firmware to the u-boot package
- docker dependencies (aufs will be added later. not essential)
- attached to 4.19.y
- loading armbianEnv.txt
- UUID support (tested)
- enabled ZRAM (tested)
- enabled eMMC install (not quite working properly yet)
- Bionic has some issues with systemd networking.
* gov to ondemand (thermals are conservative anyway), remove unneeded kernelconfigs
* Added AUFS, remove debug from kernel boot parameters, add ath10 mPCI support (which works)
* add power-off-key and rtc
* Added onboard wireless, but it's enabling is disabled by default. Too fragile.
* Change to CSC target
2018-11-08 17:51:42 +00:00
|
|
|
|
|
|
|
|
mvebu64|mt7623)
|
2017-09-28 08:15:26 +00:00
|
|
|
# configure/enable/start systemd-networkd
|
2017-10-11 11:46:03 +00:00
|
|
|
systemctl start systemd-networkd.service
|
|
|
|
|
systemctl start systemd-resolved.service
|
|
|
|
|
systemctl enable systemd-networkd.service
|
|
|
|
|
systemctl enable systemd-resolved.service
|
|
|
|
|
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
|
|
|
|
|
systemctl restart systemd-networkd
|
|
|
|
|
;;
|
2019-07-25 14:27:17 +00:00
|
|
|
odroidc1)
|
|
|
|
|
if [[ -f /boot/boot.ini ]]; then
|
|
|
|
|
get_random_mac
|
|
|
|
|
sed -i '/setenv rootfstype "ext4"/a setenv ethaddr "'$MACADDR'"' /boot/boot.ini
|
|
|
|
|
fi
|
|
|
|
|
;;
|
2018-05-30 11:46:32 +00:00
|
|
|
*)
|
2018-09-17 11:25:53 +00:00
|
|
|
|
2016-06-18 14:28:02 +00:00
|
|
|
esac
|
2016-05-05 13:49:46 +00:00
|
|
|
|
2018-10-25 09:27:16 +00:00
|
|
|
# varios temporary hardware workarounds
|
2020-08-10 16:22:48 +00:00
|
|
|
[[ $LINUXFAMILY == rk3399 || $LINUXFAMILY == rockchip64 ]] && [[ $BOARD != helios64 ]] && set_fixed_mac
|
2018-10-25 09:27:16 +00:00
|
|
|
[[ $BRANCH == dev && $LINUXFAMILY == rockchip ]] && set_fixed_mac
|
2019-11-19 22:25:39 +00:00
|
|
|
[[ $BRANCH == current && $LINUXFAMILY == odroidc1 ]] && set_fixed_mac
|
2019-05-05 21:32:29 +00:00
|
|
|
[[ $LINUXFAMILY == meson64 ]] && set_fixed_mac
|
2018-06-16 17:41:16 +00:00
|
|
|
systemctl disable armbian-firstrun
|
2017-01-16 18:53:36 +00:00
|
|
|
exit 0
|
|
|
|
|
;;
|
2014-10-08 05:39:24 +00:00
|
|
|
|
2017-01-16 18:53:36 +00:00
|
|
|
*)
|
|
|
|
|
echo "Usage: $0 start"
|
|
|
|
|
exit 0
|
|
|
|
|
;;
|
|
|
|
|
esac
|