Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Obihoernchen
Last active August 25, 2017 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Obihoernchen/28c02a8eeb37f816b4f3e9ea6f150f42 to your computer and use it in GitHub Desktop.
Save Obihoernchen/28c02a8eeb37f816b4f3e9ea6f150f42 to your computer and use it in GitHub Desktop.
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 20, 2017

I installed Armbian_5.33_Odroidxu4_Debian_jessie_next_4.9.37.img for odroid XU4, then I used this script trying to install latest kernel with mali support. Since the preinstalled one 4.9.37-odroidxu4 didn't have support for it. I run your script and those are the last lines I got:

Install kernel
mount: mount point /media/boot does not exist
mount: mount point /media/boot does not exist
sed: can't read /media/boot/boot.ini: Not a directory
Using dtb: exynos5422-odroidxu4.dtb
cp: failed to access ‘/media/boot/uInitrd’: Not a directory
umount: /media/boot: not mounted

Kernel updated successfully
Reboot to use new kernel

I wasn't cautious and didn't see about /media/boot does not exists and some failures... only Kernel updates successfully which was false since then I was in a loop and now I have to reinstall it :)

What exactly is "/media/boot"? Do I have to create it manually or is this on openmediavault3 named something else?

Thank you!

@frojnd
Copy link

frojnd commented Aug 22, 2017

Second try:

I've created /media/boot and run update script:

./update-kernel.sh
rm: cannot remove ‘/tmp/kernel-update’: No such file or directory
Download kernel
--2017-08-21 13:33:22--  ftp://vserver.obihoernchen.net/ODROID-XU4-KERNEL/LATEST-4.9
           => ‘kernel.tar.xz’
Resolving vserver.obihoernchen.net (vserver.obihoernchen.net)... 188.68.56.63, 2a03:4000:6:f172::
Connecting to vserver.obihoernchen.net (vserver.obihoernchen.net)|188.68.56.63|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /ODROID-XU4-KERNEL ... done.
==> SIZE LATEST-4.9 ... 14553744
==> PASV ... done.    ==> RETR LATEST-4.9 ... done.
Length: 14553744 (14M) (unauthoritative)

LATEST-4.9                                                  100%[===========================================================================================================================================>]  13.88M  1.12MB/s   in 11s

2017-08-21 13:33:33 (1.29 MB/s) - ‘kernel.tar.xz’ saved [14553744]


Extract kernel

Kernel Version: 4.9.38

Copy firmware and modules

Create intramfs and uInitrd
update-initramfs: Generating /boot/initrd.img-4.9.38
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
W: mdadm: no arrays defined in configuration file.
update-initramfs: Converting to u-boot format
Image Name:   uInitrd-4.9.38
Created:      Mon Aug 21 13:33:58 2017
Image Type:   ARM Linux RAMDisk Image (uncompressed)
Data Size:    6106265 Bytes = 5963.15 kB = 5.82 MB
Load Address: 00000000
Entry Point:  00000000

Install kernel
mount: special device /dev/mmcblk0p1 does not exist
sed: can't read /media/boot/boot.ini: No such file or directory
Using dtb: exynos5422-odroidxu4.dtb

Kernel updated successfully
Reboot to use new kernel

So this time only these 2 commands failed:

  1. mount: special device /dev/mmcblk0p1 does not exist - but I think that's normal since I also have /dev/mmcblk1p1
  2. sed: can't read /media/boot/boot.ini: No such file or directory - no idea why /media/boot/boot.ini is not present?

Any help appreciated.

@Obihoernchen
Copy link
Author

Hi,

yes unfortunately OMV3/armbian changed the boot layout so this script is not compatible with OMV3 right now.

@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