Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use new official 4.9 kernel build
#!/bin/bash
DLPATH=ftp://vserver.obihoernchen.net/ODROID-XU4-KERNEL/LATEST-4.9
if [[ "$1" =~ ^(ftp|https?):// ]]; then
DLPATH="$1"
fi
rm -r /boot/*
# for safety
rm -r /tmp/kernel-update
echo "Download kernel"
mkdir /tmp/kernel-update
cd /tmp/kernel-update
wget $DLPATH -O kernel.tar.xz
echo
echo "Extract kernel"
tar -xf kernel.tar.xz
KERNEL_VERSION=$(ls config-* | sed -e 's/^config-//')
echo
echo "Kernel Version: $KERNEL_VERSION"
echo
echo "Copy firmware and modules"
cp -R lib/* /lib
echo
echo "Create intramfs and uInitrd"
cp config-$KERNEL_VERSION /boot
update-initramfs -c -k $KERNEL_VERSION
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n "uInitrd-$KERNEL_VERSION" -d /boot/initrd.img-$KERNEL_VERSION /boot/uInitrd-$KERNEL_VERSION
echo
echo "Install kernel"
mount /dev/mmcblk0p1 /media/boot
mount /dev/mmcblk1p1 /media/boot
cp zImage /media/boot
DTB=$(ls *.dtb)
cp $DTB /media/boot
sed -i -r "s/\S+\.dtb;/${DTB};/" /media/boot/boot.ini
echo "Using dtb: $DTB"
cp /boot/uInitrd-$KERNEL_VERSION /media/boot/uInitrd
sync
sleep 3
umount /media/boot
rm -r /tmp/kernel-update
echo
echo "Kernel updated successfully"
echo "Reboot to use new kernel"
@frojnd
Copy link

frojnd commented Aug 25, 2017

Will you update the script for OMV3 in the near future? Just askin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment