Trying to get mainline kernel working on N1

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Thu Jan 02, 2020 2:10 pm

Thanks for the feedback! I wasn't able to boot 4.4 with the mainline uboot because the format was not supported.

I'll upload a backup of the original uboot so you can revert to it if needed shortly.

I got those patches from one of moon.linux'es posts earlier in the thread. I'll add the links shortly.

brad
Posts: 1028
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 H2 (64 bit ftw)
Location: Australia
Has thanked: 23 times
Been thanked: 51 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by brad » Thu Jan 02, 2020 2:27 pm

I'm compiling up a 5.3 from oversun and a 5.4.7 from mainline with Oversun's patches to see if they boot, I have to get it right first shot as I don't have access to UART adaptor (just spend hours looking for it)

I wasn't game to try to boot 4.4 as the different formats also

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Thu Jan 02, 2020 2:50 pm

Sorry for making your N1 unbootable :( But at least you now have a goal :)
Here is my bootloader backup: https://mega.nz/#!ZkBj1AiL!bskfUmrxHrAj ... asSrD4_0g8. My partition layout is the following - check yours before flashing so you don't corrupt the first partition.

Code: Select all

root@aldebaran64:~# fdisk -l /dev/mmcblk1
Disk /dev/mmcblk1: 29.1 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x630bb630

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk1p1       32769   294911   262143  128M  c W95 FAT32 (LBA)
/dev/mmcblk1p2      294912 61069312 60774401   29G 83 Linux
You can restore it with odroid-backup. Better make a backup of what's left before restoring just in case... If you try to write it with dd, note that it contains the MBR as well! odroid-backup can skip the mbr section and flash the rest.

The patches for uboot I got from here:
viewtopic.php?f=155&t=33373&start=50#p268522 and here viewtopic.php?f=155&t=33373&start=50#p273395. Not sure I need both of them, but they applied ok (there are some kernel patches too).

I too compiled Oversun's latest 5.3, but haven't booted it yet. Will try to see if I have time today to try out your steps (without overwriting my bootloader automatically)

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Thu Jan 02, 2020 3:17 pm

Ok, I started from scratch with your suggestions (with toolchains installed from apt on 18.04). I only applied this patch:

Code: Select all

mkdir Jan2020
cd Jan2020/
git clone https://github.com/ARM-software/arm-trusted-firmware.git
git clone https://github.com/rockchip-linux/rkbin.git
git clone https://github.com/u-boot/u-boot.git
ls -l
cp 0001-u-boot-rockchip-rk3399-Add-Odroid-N1-support.patch u-boot/
cd u-boot/
patch -p1 < 0001-u-boot-rockchip-rk3399-Add-Odroid-N1-support.patch 
vi buildn1spltpl.sh 
./buildn1spltpl.sh 
And now the build process finished correctly. It looks like I messed up the patches and merged them when I shouldn't have... Sorry for wasting your time!

Alas, I don't think I have time to try it out right now, but I hope to get a chance soon...

brad
Posts: 1028
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 H2 (64 bit ftw)
Location: Australia
Has thanked: 23 times
Been thanked: 51 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by brad » Thu Jan 02, 2020 3:49 pm

mad_ady wrote:
Thu Jan 02, 2020 2:50 pm
Sorry for making your N1 unbootable :( But at least you now have a goal :)
It was actually my N2 ;) but I have rebuilt it now and taking a full backup of the emmc :)

Back to the N1 I tried to install uboot & 5.2 kernel to the emmc but I could not get it to boot, no blue light at all. I'm out of ways to move forward now until I find my UART adaptor. I have 2 of them and they are probably together somewhere.

Im glad you got yours to compile :) these things happen :) Hope you know where your uart adaptor is :)

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Thu Jan 02, 2020 4:16 pm

My UART is permanently attached to the N1. I got a bunch of them for good measure :)

Ok, flashed the uboot manually to emmc and it booted:

Code: Select all

�                                                                                                                                                                                                                            [0/0]
U-Boot TPL 2020.01-rc5-00042-g6cb87cbb14-dirty (Jan 02 2020 - 08:00:46)
Channel 0: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
256B stride
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2020.01-rc5-00042-g6cb87cbb14-dirty (Jan 02 2020 - 08:00:46 +0200)
Trying to boot from MMC2
NOTICE:  BL31: v2.2(release):v2.2-270-g86ed8953
NOTICE:  BL31: Built : 08:00:36, Jan  2 2020


U-Boot 2020.01-rc5-00042-g6cb87cbb14-dirty (Jan 02 2020 - 08:02:08 +0200)

Model: Hardkernel ODROID-N1
DRAM:  3.9 GiB
PMIC:  RK808
MMC:   dwmmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
Model: Hardkernel ODROID-N1
Net:
Error: ethernet@fe300000 address not set.
No ethernet found.

Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
485 bytes read in 17 ms (27.3 KiB/s)
## Executing script at 00500000
16960000 bytes read in 535 ms (30.2 MiB/s)
55579 bytes read in 25 ms (2.1 MiB/s)
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Device Tree to 00000000f5f00000, end 00000000f5f1091a ... OK

Starting kernel ...

The kernel (5.3.0-rc5) doesn't quite come up... Time to restore my backup... I will also try mainline kernel with moon.linux's patch.

Edit: here is my boot.txt used to generate boot.scr. If I remember correctly the serial port should be ttyS2 on mainline, instead of ttyFIQ0, right?

Code: Select all

$ cat boot.txt
setenv ethaddr 00:1e:06:ae:d4:2e
setenv bootargs earlyprintk console=ttyS2,115200 root=/dev/mmcblk1p2 net.ifnames=0 biosdevname=0 fsck.mode=auto fsck.repair=yes mitigations=off rootwait ro usb-storage.quirks=0x174c:0x1153:u,0x152d:0x0578:u
load ${devtype} ${devnum} ${kernel_addr_r} /boot/vmlinuz-5.3.0-rc5+
load ${devtype} ${devnum} ${fdt_addr_r} /boot/rk3399-odroidn1.dtb
booti ${kernel_addr_r} - ${fdt_addr_r}


brad
Posts: 1028
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 H2 (64 bit ftw)
Location: Australia
Has thanked: 23 times
Been thanked: 51 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by brad » Thu Jan 02, 2020 5:04 pm

mad_ady wrote:
Thu Jan 02, 2020 4:16 pm
Edit: here is my boot.txt used to generate boot.scr. If I remember correctly the serial port should be ttyS2 on mainline, instead of ttyFIQ0, right?
Yes I believe so, I didn't have my files or boot.src set to boot from /boot/ so maybe that is my problem. Still looking for my uart...........

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Thu Jan 02, 2020 5:14 pm

Well, my maintenance window is over for now, so no rush.
Will try again with mainline + moon.linux's patch

brad
Posts: 1028
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 H2 (64 bit ftw)
Location: Australia
Has thanked: 23 times
Been thanked: 51 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by brad » Thu Jan 02, 2020 5:33 pm

I found my UART - finally!! (had fallen down behind draws)

I see this so maybe a flash problem, ill try again

Code: Select all

U-Boot TPL 2020.01-rc5-00042-g6cb87cbb14-dirty (Jan 02 2020 - 14:21:49)
Channel 0: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
256B stride
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2020.01-rc5-00042-g6cb87cbb14-dirty (Jan 02 2020 - 14:21:49 +1100)
Trying to boot from MMC2
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC2
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Thu Jan 02, 2020 8:15 pm

New maintenance window (last one for a while) scheduled for tonight. If you want I'll post my built uboot.

brad
Posts: 1028
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 H2 (64 bit ftw)
Location: Australia
Has thanked: 23 times
Been thanked: 51 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by brad » Thu Jan 02, 2020 8:46 pm

mad_ady wrote:
Thu Jan 02, 2020 8:15 pm
New maintenance window (last one for a while) scheduled for tonight. If you want I'll post my built uboot.
Thanks ok I got uboot sorted out, now having the same trouble as you booting 5.3, stuck at Starting Kernel..

Im not sure what is wrong im trying to work out if ttyS2 is correct for mainline console.

Edit it appears to be correct based on https://github.com/Owersun/linux-hardke ... n1.dts#L68

moon.linux
Posts: 1171
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english
Has thanked: 0
Been thanked: 5 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by moon.linux » Thu Jan 02, 2020 11:14 pm

@mad_ady and @brad,

You probably need to compile the u-boot + ATF and kernel with additional patches from armbian repository,
it will boot cleanly.

Code: Select all

#make ARCH=arm64 mrproper
make ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" defconfig
make ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" -j$(nproc) LOCALVERSION=-xn1mlu dtbs Image modules
Note : Use the image to boot instead of vmlinux

Once booted to login prompt best approach as of now is the get the board to shutdown correctly as some
sub module like pcie or mmc are not getting clean released, which lead to board stuck in u-boot.

Here is the series of patches for clean shutdown,
[0] https://patchwork.kernel.org/patch/11279249/
[1] https://patchwork.kernel.org/cover/11282445/

Currently I see that ethernet is broken on my Odroid N1, so disable the node as of now, until proper solution is found.
These users thanked the author moon.linux for the post (total 2):
brad (Thu Jan 02, 2020 11:22 pm) • mad_ady (Fri Jan 03, 2020 12:18 am)

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Sat Jan 04, 2020 1:18 am

When you say that ethernet is broken, you mean with your current build, not physically broken, right?

Anyway, here are the uboot binaries for those too lazy to build them themselves: https://mega.nz/#F!YhwzVSoL!2QClQMTY48rsTzh12o9q_A

Flash with

Code: Select all

sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64                                                     
sudo dd if=u-boot.itb of=/dev/mmcblk0 seek=16384
sudo dd if=trust.img of=/dev/mmcblk0 seek=24576 conv=notrunc
but before backup the first 16MB of your disk.

Hope to pick it up from here a few weeks later, hopefully with working ethernet...

moon.linux
Posts: 1171
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english
Has thanked: 0
Been thanked: 5 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by moon.linux » Sun Jan 05, 2020 10:32 pm

In the future we need only one single image for build the u-boot binary.
https://patchwork.ozlabs.org/patch/1217531/

User avatar
rooted
Posts: 7136
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 387 times
Been thanked: 108 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by rooted » Sun Jan 05, 2020 11:24 pm

moon.linux wrote:In the future we need only one single image for build the u-boot binary.
https://patchwork.ozlabs.org/patch/1217531/
Which one of those will work for the N1?

User avatar
mad_ady
Posts: 7113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 308 times
Been thanked: 212 times
Contact:

Re: Trying to get mainline kernel working on N1

Unread post by mad_ady » Sun Jan 05, 2020 11:41 pm

rk3399 should work, though there might be odroid specific things which are still needed.

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 3 guests