[ mvebu ] Switch fake-hwclock to hardware RTC AR-159 (#1946)

* [ mvebu ] Switch fake-hwclock to hardware RTC AR-159

* remove fake-hwclock dpkg
* tweak /lib/udev/hwclock-set to be executed even if systemd present
* move helios4 bsp file under mvebu folder for tidiness
This commit is contained in:
Gauthier Provost
2020-05-13 11:44:44 +08:00
committed by GitHub
parent 76b79a2f51
commit e3dd8abedb
9 changed files with 52 additions and 7 deletions

View File

@@ -42,26 +42,26 @@ family_tweaks_bsp()
### Fancontrol tweaks
# copy hwmon rules to fix device mapping
install -m 644 $SRC/packages/bsp/helios4/90-helios4-hwmon.rules $destination/etc/udev/rules.d/
install -m 644 $SRC/packages/bsp/mvebu/helios4/90-helios4-hwmon.rules $destination/etc/udev/rules.d/
# copy fancontrol config
install -m 644 $SRC/packages/bsp/helios4/fancontrol_pwm-fan.conf $destination/etc/fancontrol
install -m 644 $SRC/packages/bsp/helios4/fancontrol.service $destination/etc/systemd/system/
install -m 644 $SRC/packages/bsp/mvebu/helios4/fancontrol_pwm-fan.conf $destination/etc/fancontrol
install -m 644 $SRC/packages/bsp/mvebu/helios4/fancontrol.service $destination/etc/systemd/system/
### Mdadm tweaks
# copy mdadm-fault-led script and set right permission
install -m 755 $SRC/packages/bsp/helios4/mdadm-fault-led.sh $destination/usr/sbin
install -m 755 $SRC/packages/bsp/mvebu/helios4/mdadm-fault-led.sh $destination/usr/sbin
### Ethernet tweaks
# copy and enable helios4-wol.service
install -m 644 $SRC/packages/bsp/helios4/helios4-wol.service $destination/lib/systemd/system/
install -m 644 $SRC/packages/bsp/mvebu/helios4/helios4-wol.service $destination/lib/systemd/system/
### Other tweaks
# add custom motd default conf file
install -m 644 $SRC/packages/bsp/helios4/armbian-motd $destination/etc/default/
install -m 644 $SRC/packages/bsp/mvebu/helios4/armbian-motd $destination/etc/default/
# create modules file
if [[ $BRANCH == dev && -n $MODULES_DEV ]]; then

View File

@@ -53,5 +53,12 @@ family_tweaks()
# execute specific tweaks function if present
[[ $(type -t family_tweaks_s) == function ]] && family_tweaks_s
chroot $SDCARD /bin/bash -c "apt-get -y -qq remove --auto-remove linux-sound-base alsa-base alsa-utils bluez>/dev/null 2>&1"
# Tweak to force SYS time to be synced from RTC at startup
install -m 755 $SRC/packages/bsp/mvebu/hwclock-set $SDCARD/lib/udev/
if [[ $DISTRIBUTION == "Ubuntu" ]]; then
chroot $SDCARD /bin/bash -c "apt-get -y -qq remove --auto-remove fake-hwclock linux-sound-base alsa-base alsa-utils bluez"
else
chroot $SDCARD /bin/bash -c "apt-get -y -qq remove --auto-remove fake-hwclock alsa-utils bluez"
fi
}

38
packages/bsp/mvebu/hwclock-set Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
# Reset the System Clock to UTC if the hardware clock from which it
# was copied by the kernel was in localtime.
dev=$1
# Armbian Tweak - Execute even if systemd is present
#if [ -e /run/systemd/system ] ; then
# exit 0
#fi
if [ -e /run/udev/hwclock-set ]; then
exit 0
fi
if [ -f /etc/default/rcS ] ; then
. /etc/default/rcS
fi
# These defaults are user-overridable in /etc/default/hwclock
BADYEAR=no
HWCLOCKACCESS=yes
HWCLOCKPARS=
HCTOSYS_DEVICE=rtc0
if [ -f /etc/default/hwclock ] ; then
. /etc/default/hwclock
fi
if [ yes = "$BADYEAR" ] ; then
/sbin/hwclock --rtc=$dev --systz --badyear
/sbin/hwclock --rtc=$dev --hctosys --badyear
else
/sbin/hwclock --rtc=$dev --systz
/sbin/hwclock --rtc=$dev --hctosys
fi
# Note 'touch' may not be available in initramfs
> /run/udev/hwclock-set