Firefly Open Source Community

Title: Does updating the kernel from 4.4.x to 4.13.x require new u-boot.img? [Print This Page]

Author: ttodorov    Time: 9/18/2017 01:33
Title: Does updating the kernel from 4.4.x to 4.13.x require new u-boot.img?
Hello,

By following the RK3399 Wiki for creating a new Ubuntu rootfs image (Build Ubuntu Rfs) and the guide for firmware customization (Customize Firmware) I was able to build my own Xubuntu 17.04 update.img, which still uses the 4.4.55 Linux kernel. The way I went about it:

1) get the original arm64 ubuntu base image
2) extract the base image into a folder
3) mount-bind /proc, /sys, and /dev at the corresponding location under top folder
4) follow the Ubuntu Rfs Wiki guide to install additional software and create the new rootfs.img file
5) get the latest official Xubuntu image for Firefly RK3399
6) unpack official image following the firmware customization guide from the Wiki
7) replace the ubuntu1604 rootfs file with my new custom one
8) update the package list file to reflect the new rootfs file name
9) repack into a new update.img file and flash

Everything worked like a charm!

However, I am not very happy with the 4.4.x kernel, because it did not recognize the official PCIe M.2 b-key SSD adapter add-on from the firefly store, and I am unable to use an additional SSD drive. I checked what got into the latest 4.13.2 kernel release, and it looks like it supports the Firefly RK3399 board (at least according to the files in the DTS tree...). So I am going to try and compile a vanilla 4.13.2 kernel and see if it boots on my RK3399 board.

Before I go to all the trouble, I remember that you can't switch from 3.x kernel to 4.x kernel without also getting a newer version of u-boot. The question is, whether it would be possible like in the example above to create a new kernel.img with 4.13.2 and replace only that one image file within the whole update.img tree, without touching u-boot or anything else? I would appreciate the advice of people who have tried something like that before and know if it works or not...

Thanks!

Author: Fallen    Time: 9/22/2017 00:08
Were you ever able to get 4.13.x running?
Author: ttodorov    Time: 9/30/2017 01:06
Sorry for the late reply, I have been swamped with real-life work and had no time to try. I will be trying out to compile and image kernel 4.13 tomorrow. Anyone interested should expect update sometime Sunday.
Author: Fallen    Time: 9/30/2017 01:58
I understand, real life comes first. I was able to compile kernel 4.13 and u-boot then tried using the bootloader and trust.img from slackware-current because it seems the most up to date. Unfortunately the device refuses to boot with the new kernel.
Author: ttodorov    Time: 9/30/2017 22:10
Ok, I failed too.

Initial investigation shows that the the vanilla kernel must be patched to support the hardware. I figured this out by copying the firefly_linux_defconfig file from the firefly kernel git repo to the vanilla kernel tree and then comparing the resulting .config file after running "make ARCH=arm64 firefly_linux_defconfig" in both. There are a lot of symbols that are set in the firefly kernel, which are missing in the vanilla one - e.g. ARM Mali Midgard linux driver. I got that one from the ARM web site, but have not integrated it into 4.13.4 yet. I'll see how difficult that will be later. I haven't figured out the rest yet.

If only the firefly developers kept a better commit log with their git ;-(

Author: Fallen    Time: 10/1/2017 03:21
Interesting, I never checked the differences between the .configs. I recently got slackware-current working and was trying to see if just swapping out the /boot/Image (kernel) would be sufficient. I tried using the one I compiled as well as the kernel from http://co.us.mirror.archlinuxarm ... rch64-latest.tar.gz but neither booted. I also tried using
  1. mkimage -A arm64 -O linux -T kernel -a 0 -e 0 -n Linux -d boot/Image ../uImage
Copy the code
on the Image and also the initramfs-linux.img provided from the tar.gz, still no luck. Also tried all the previous attempts with the dtb provided in the tar.gz.

I wonder if the 4.13 kernel is just missing code required to run the rk3399-firefly. (Maybe this is what you are suggesting)
Author: Fallen    Time: 10/12/2017 08:39
@ttodorov Have you tried using https://kernel.googlesource.com/ ... nd/linux-rockchip/?
Author: ttodorov    Time: 10/17/2017 23:34
Hi, Fallen

Thx for the link!  I had a look and while it has a lot of the rockchip stuff, this tree does not have any of the peripheral drivers needed for the Firefly RK3399. Just to illustrate, I compared the changes between the vanilla 4.4.55 kernel and the latest in the firefly kernel git... The patches are extensive. The diff is over 250 MB of text! The diffstat output alone is 1.3 MB, and it shows that over 10k files have been changed or added (file attached). Now, that is between same kernel versions - 4.4.55, and current kernels, say after 4.11.x have a lot of the arm stuff already in. But nevertheless, the vanilla 4.13.x tree does not include drivers for most of the peripherals on the Firefly   Besides the Mali driver, parts of the HDMI stuff is missing, the framebuffer driver for rockchip is missing, the audio codec(s) is only partially there, a lot of the network drivers for the Ffly are missing, almost none of the power regulators have drivers, some security stuff is missing, etc.  Now, granted that a lot of the stuff in the firefly kernel git repo is to support their other products, so I suspect it would be possible to pick and choose what to port to a recent kernel version. Even better, if I could take the device name and find a patch for the newest kernels for them somewhere else on the Internet. I just don't have the time right now...
Author: ttodorov    Time: 10/17/2017 23:42
Sorry, the forum won't let me upload the diffstat file. If you are interested, here is how to create this yourself

1) Download vanilla 4.4.55 kernel from kernel.org and unpack it in some folder. Rename the top folder from linux to linux-4.4.555 or something like that.
2) Clone the firefly git repository in the same folder. I renamed my git copy from 'linux-kernel' to 'linux-firefly'
3) Run a diff between the two like this: diff -uNr -x ".git" -x ".gitignore"  linux-4.4.55/  linux-firefly/   >  firefly_changes.diff
4) Run diffstat over the patch file like this: diffstat -T firefly_changes.diff

This will tell you which files have changed, and which of the them are new vs. which were edited
Author: Fallen    Time: 10/20/2017 00:10
almost none of the power regulators have drivers, some security stuff is missing


This is something that I think is holding me back at the moment but I'll talk more about that later.

I got 4.15 from the rockchip kernel from kernel.org booted and it was working. It booted up into arch (my rootfs) and I proceeded to customize it. A quick reboot and no hdmi signal...

A serial debug shows that u boot hands off to the kernel but no signal. So I restarted it and got signal, but this time after the kernel hand off there is just a blinking underscore in the top left.

As I stated earlier, the missing drivers, etc. seem to be a likely culprit. I built a kernel last night that appears to have more fixes. Will try it out today or tomorrow.
Author: Fallen    Time: 10/20/2017 00:20
Also, as you pointed out, I noticed (while I had the kernel working) the wifi module was not showing up. So no wifi but Ethernet did work. Can only imagine how many other devices didn't work that I didn't try.




Welcome Firefly Open Source Community (https://bbs.t-firefly.com/) Powered by Discuz! X3.1