Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Use new official 4.9 kernel build
if [[ "$1" =~ ^(ftp|https?):// ]]; then
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 "Extract kernel"
tar -xf kernel.tar.xz
KERNEL_VERSION=$(ls config-* | sed -e 's/^config-//')
echo "Kernel Version: $KERNEL_VERSION"
echo "Copy firmware and modules"
cp -R lib/* /lib
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 "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
sleep 3
umount /media/boot
rm -r /tmp/kernel-update
echo "Kernel updated successfully"
echo "Reboot to use new kernel"

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 commented Aug 22, 2017

Second try:

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

rm: cannot remove ‘/tmp/kernel-update’: No such file or directory
Download kernel
--2017-08-21 13:33:22--
           => ‘kernel.tar.xz’
Resolving (, 2a03:4000:6:f172::
Connecting to (||: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.

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