Trying to get mainline kernel working on N1

Post Reply
User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Trying to get mainline kernel working on N1

Unread post by mad_ady » Wed Jan 09, 2019 5:14 pm

I'm planning to use my N1 as a nas, replacing my XU4, and since I'm using XFS as a filesystem, I'd like to use the newest available kernel on it (there can be problems if you mount a XFS system with an older kernel).
So, this is what I tried so far (inspired from http://opensource.rock-chips.com/wiki_Upstream_Kernel) - currently kernel 5.0.0 rc1:

Code: Select all

git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git
cd linux-rockchip/
make rockchip_linux_defconfig
scripts/kconfig/merge_config.sh .config config-4.4.114
make menuconfig
#added the odroid lirc blaster driver from xu4 branch because I'll need it
#copied over the extra edid from the old 4.4.114 kernel
cp -ar ../../linux/firmware/edid/*.bin firmware/edid/
make -j 6 Image dtbs modules
sudo cp arch/arm64/boot/Image /media/boot/Image.mainline
#there was no dtb for N1, so I didn't copy any to /media/boot
sudo make modules_install
sudo make firmware_install
kver=`make kernelrelease`
sudo cp .config /boot/config-${kver}
cd /boot
sudo update-initramfs -c -k ${kver}
sudo mkimage -A arm64 -O linux -T ramdisk -a 0x0 -e 0x0 -n initrd.img-${kver} -d initrd.img-${kver} uInitrd-${kver}
sudo cp uInitrd-${kver} /media/boot/uInitrd.mainline
I'm using this kernel config: http://paste.ubuntu.com/p/SNwqGmPjnb/

I'm using this boot.ini:

Code: Select all

ODROIDN1-UBOOT-CONFIG

# U-Boot configuration
setenv kernel_addr "0x02000000"
setenv fdt_addr "0x01f00000"
setenv initrd_addr "0x04000000"

# Enable/Disable ODROID-VU7 Touchsreen
setenv disable_vu7 "false" # false

# Kernel cmdline rootfs and misc
setenv bootrootfs "swiotlb=1 console=ttyFIQ0,115200n8 root=UUID=a130ca78-0841-400a-8823-06a304a00850 rootwait rw"

# Load kernel, uInitrd and dtb
load mmc ${bootdev} ${kernel_addr} Image.mainline
load mmc ${bootdev} ${initrd_addr} uInitrd.mainline
load mmc ${bootdev} ${fdt_addr} rk3399-odroidn1-linux.dtb

# Set the kernel bootargs
setenv bootargs "${bootrootfs} disable_vu7=${disable_vu7}"

# Boot the board
booti ${kernel_addr} ${initrd_addr} ${fdt_addr}

When I try to boot the kernel it remains at:

Code: Select all

U-Boot 2017.07-g12f5cec5fe (Apr 17 2018 - 16:04:19 +0300)

Model: Hardkernel ODROID-N1
DRAM:  3.9 GiB
MMC:   dwmmc@fe320000: 1, sdhci@fe330000: 0
In:    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
U-Boot 2017.07-g12f5cec5fe (Apr 17 2018 - 16:04:19 +0300)

Model: Hardkernel ODROID-N1
Net:
Error: ethernet@fe300000 address not set.
No ethernet found.
Hit any key to stop autoboot:  0
reading boot.ini
707 bytes read in 11 ms (62.5 KiB/s)
cfgload: applying boot.ini...
cfgload: setenv kernel_addr "0x02000000"
cfgload: setenv fdt_addr "0x01f00000"
cfgload: setenv initrd_addr "0x04000000"
cfgload: setenv disable_vu7 "false" # false
cfgload: setenv bootrootfs "swiotlb=1 console=ttyFIQ0,115200n8 root=UUID=a130ca78-0841-400a-8823-06a304a00850 rootwait rw"
cfgload: load mmc ${bootdev} ${kernel_addr} Image.mainline
reading Image.mainline
21864456 bytes read in 2299 ms (9.1 MiB/s)
cfgload: load mmc ${bootdev} ${initrd_addr} uInitrd.mainline
reading uInitrd.mainline
9729827 bytes read in 1033 ms (9 MiB/s)
cfgload: load mmc ${bootdev} ${fdt_addr} rk3399-odroidn1-linux.dtb
reading rk3399-odroidn1-linux.dtb
72899 bytes read in 29 ms (2.4 MiB/s)
cfgload: setenv bootargs "${bootrootfs} disable_vu7=${disable_vu7}"
cfgload: booti ${kernel_addr} ${initrd_addr} ${fdt_addr}
## Loading init Ramdisk from Legacy Image at 04000000 ...
   Image Name:   initrd.img-5.0.0-rc1-ubuntu-06-g
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    9729763 Bytes = 9.3 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Ramdisk to f55dc000, end f5f236e3 ... OK
   Loading Device Tree to 00000000f55c7000, end 00000000f55dbcc2 ... OK

Starting kernel ...

I'll be looking into running with a different dtb (which one?), and I'll also double check kernel size and the offset it gets written to, so that the kernel and initrd don't overwrite eachother.

joy
Posts: 611
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by joy » Wed Jan 09, 2019 5:39 pm

Nice topic!

User avatar
rooted
Posts: 6094
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by rooted » Wed Jan 09, 2019 5:47 pm

Maybe you need to use mainline u-boot?

User avatar
OverSun
Posts: 1402
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by OverSun » Wed Jan 09, 2019 5:53 pm

I was planning to wait for rockchip video decoder to make it into mainline, and then make it work, since I use my N1 as my main media station.
I think this should be pretty easy, only the .dtb part is need to be properly ported, and this one is what prevents your kernel from booting I guess. .dts description changed significantly between 4.4 and 4.20 - 5.0

BTW I still maintain the latest 4.4 kernel for N1 and it works flawlessly, especially with libreelec patches (another branch): https://github.com/Owersun/linux-hardkernel/

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Wed Jan 09, 2019 6:23 pm

Should I try a generic rk3399 dtb, or it wouldn't help anyway? The branch I'm trying has experimental vpu support, if I'm not mistaking, though I won't be using it...

User avatar
meveric
Posts: 9608
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by meveric » Wed Jan 09, 2019 7:13 pm

OverSun wrote:
Wed Jan 09, 2019 5:53 pm
BTW I still maintain the latest 4.4 kernel for N1 and it works flawlessly, especially with libreelec patches (another branch): https://github.com/Owersun/linux-hardkernel/
Thanks that is really nice of you to share! :)
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Wed Jan 09, 2019 8:19 pm

@Owersun: a bit offtopic, but, would you be interested in integrating the patches from my branch to yours, so that I don't have to maintain mine? Your branch seems more advanced anyway:
https://github.com/hardkernel/linux/com ... idn1-4.4.y

I can export them as patch files if you want to. The important changes are adding kexec support (for petitboot), spi flash support and ir blaster via gpio (tested, it works).

User avatar
OverSun
Posts: 1402
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by OverSun » Thu Jan 10, 2019 2:04 am

generic rk3399 should be able to at least boot, while providing almost no devices in the system. thing is that there is no such thing as generic rk3399, there is a base .dtsi, but that's an "include" file, this is where "i" comes in the end. by default everything is disabled in that file, all the devices are status = "disabled", and all the board vendors create their board .dts'es, for rk3399 sometimes they contain barely few required regulators description and bunch of settings to set devices to status = "ok". so this is what needs to be created for N1 - .dts describing regulators (which are going to be identical probably to what there already is), plus list of devices that N1 has and should be enabled.

sure thing, no prob I can take you changes into the branch.
can you just remove the "ignoring compile warnings", seems pretty hectic practice for me, and create pull request?

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Thu Jan 10, 2019 3:30 am

I will try. To do this I need to fork your repo and add the patches, right? I think I have some instructions written somewhere.

User avatar
rooted
Posts: 6094
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by rooted » Thu Jan 10, 2019 4:30 am

mad_ady wrote:I will try. To do this I need to fork your repo and add the patches, right? I think I have some instructions written somewhere.
Correct. Fork his repo, add your changes, push, create pull request.

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Fri Jan 11, 2019 10:03 pm

I'm knee deep in the process to push my changes to Owersun's repo, and some of those changes turn on some features in the defconfig. It seems that the kernel can't build and the build process exists with:

Code: Select all

...
  LD      fs/built-in.o
  LINK    vmlinux
  LD      vmlinux.o
  MODPOST vmlinux.o
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
drivers/built-in.o: In function `iep_iommu_info_create':
odroid-sysfs.c:(.text+0x532d8): undefined reference to `iep_iommu_ion_set_ops'
odroid-sysfs.c:(.text+0x532d8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `iep_iommu_ion_set_ops'
Makefile:1034: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
I haven't touched odroid-sysfs or iep_iommu*. @Owersun - any idea what's going on?

I will continue with the PR, but I wanted to test things before pushing changes.

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Mon Jan 14, 2019 7:29 pm

Ok, I get the same error on Owersun's unmodified branch, so it wasn't me :)

User avatar
OverSun
Posts: 1402
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by OverSun » Mon Jan 14, 2019 8:21 pm

You need to disable "CONFIG_ION" (and have CONFIG_DRM enabled)

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Mon Jan 14, 2019 10:44 pm

Yup, I disabled ION and now it built and ran fine. Thank you!

elatllat
Posts: 1115
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by elatllat » Thu Jan 17, 2019 2:59 am

mad_ady wrote:
Wed Jan 09, 2019 5:14 pm
...Starting kernel ...
OverSun wrote:
Wed Jan 09, 2019 5:53 pm
...only the .dtb part is need to be properly ported...
How would one debug a dts that compiles but produces no useful uart output?

Maybe adding "loglevel=7" to the bootargs?

There are 13 examples to work from in mainline (arch/arm64/boot/dts/rockchip/rk3399*.dts), but rk3399-gru-kevin.dts (google chromebook) is the only one with a thermal_zone so I looked at it, the new interface and without understanding I hacked up a dts that compiles but only got as far as mad_ady.

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest