mchehab I managed to get LibreELEC 8.2.2 with upstream 4.14.13 booting on RPi3. The process is a bit tricky/hacky and Kodi won't start - not sure if LibreELEC's Kodi can work at all on upstream kernel, could well be that the graphics layer relies on some downstream kernel changes. popcornmix should be able to tell more.
The official way to use a different kernel in LE is to fully rebuild it from source, but this shortcut could be enough for a few quick tests:
I've done this by starting with a plain LE 8.2.2 installation on sdcard - it'd probably be best if you follow the same route, then you can enable ssh and install tvheadend from Kodi. Even if kodi won't work with upstream kernel tvheadend should run and you can test it over the net.
LE uses an initrd to mount the read-only rootfs (that's the SYSTEM) file on the FAT partition. It's compresses with LZ4 so you'll also need to enable LZ4 squashfs support in the kernel.
I used this (hacky) script to extract the initramfs from the kernel image (KERNEL file on FAT partition):
#!/bin/bash
if [ $# -ne 2 ] ; then
echo "usage: $0 zImage initramfs.cpio"
exit 1
fi
zImage="$1"
export LC_ALL="C"
# find start of gziped kernel in the zImage file:
pos=`grep -P -a -b -m 1 -o '\x1F\x8B\x08' "$zImage" | cut -f 1 -d :`
if [ -z $pos ] ; then
echo "gzipped kernel not found in zImage"
exit 1
fi
echo "-I- Extracting kernel image from $zImage (start = $pos)"
dd if=$zImage bs=1 skip=$pos | gzip -d > /tmp/kernel.img
# find gzipped cpio archive in kernel
pos=`grep -P -a -b -m 1 --only-matching '\x1F\x8B\x08' /tmp/kernel.img | cut -f 1 -d :`
if [ -z $pos ] ; then
echo "gzipped cpio not found in kernel.img"
exit 1
fi
dd if=/tmp/kernel.img bs=1 skip=$pos | gunzip > "$2"
Display More
I started that with "./extract-initramfs KERNEL initrd-8.2.2" and copied the initrd-8.2.2 file to the root of the FAT partition. Fortunately there are no kernel modules in the initramfs, so we don't need to change that.
I then compiled a 32bit (ARCH="arm") upstream kernel using multi_v7_defconfig. I patched the the rpi3 DT so I could use PL011 as serial console and manually enabled CONFIG_SQUASHFS_LZ4. Then I copied zImage and the bcm283*.dtb files to a "upstream" directory on the FAT partition.
To get the upstream kernel booting I used these additional settings in config.txt - the initramfs entry brings in the previously extracted initrd
[PI3]
kernel=upstream/zImage
device_tree=upstream/bcm2837-rpi-3-b.dtb
avoid_warnings=2
initramfs initrd-8.2.2
and this cmdline.txt:
boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 ssh root=/dev/ram0 console=ttyAMA0,115200 earlycon=pl011,mmio32,0x3f201000
This is enough to get LE booting, but the initramfs will complain loudly because it doesn't find matching kernel modules in the rootfs (SYSTEM file) - after a minute it will continue booting up, but of course without modules it's a bit meh.
So I simply installed the modules to a temp directory on my PC, unsquashed the SYSTEM in a fakeroot, copied the modules into the unsquashed rootfs and then ran mksquashfs
cd ~/upstream-kernel
mkdir /tmp/modules
INSTALL_MOD_PATH=/tmp/modules make modules_install
cd ~/le-test
fakeroot
unsquashfs SYSTEM
cp -r /tmp/modules/lib/modules/4.14.13-dirty squashfs-root/usr/lib/modules/
mksquashfs squashfs-root SYSTEM-4.14 -comp lz4
Then I copied that SYSTEM-4.14 file to the root of the FAT partition, naming it SYSTEM. LE then booted up fine and could load at least some modules.
Hope I didn't miss an important step, if you have problems or questions just ping me.
so long,
Hias