Odroid C2 mainline U-boot support

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

Odroid C2 mainline U-boot support

Post by brad »

Tonight I decided to build mainline uboot (which now supports many functions for the odroid c2)

The build compiled fine using the odroid-c2_defconfig and a simple make

Next step was creating the sdcard image with fip_create, aml_encrypt and the relevant bootloaders from hardkernel u-boot version and installing to the sdcard with sd_fusing.sh

Booting fine into uboot with sdcard support (Ethernet appears to have issues)

I then decided to create a fat partition on the sdcard and attempted something a little different as EFI boot is supported. I downloaded the Ubuntu Zesty netboot image (http://ports.ubuntu.com/ubuntu-ports/di ... etaa64.efi) and placed it onto the sdcard.

I then created a custom boot script as below and to my surprise I was presented with GRUB2

Code: Select all

#Grub2 netboot loader
setenv efi_addr 11000000
setenv efi_file /ubuntu-installer/arm64/bootnetaa64.efi
setenv bootcmd 'fatload mmc 0:1 ${efi_addr} ${efi_file};bootefi ${efi_addr} ${efi_addr}'
boot
Grub command prompt..

Code: Select all

                    GNU GRUB  version 2.02~beta3-4ubuntu2

 Minimal BASH-like line editing is supported. For the first word, TAB   
   lists possible command completions. Anywhere else TAB lists possible 
   device or file completions.                                          



grub>
Possible commands are:
 . authenticate boot break clear configfile continue export
extract_entries_configfile extract_entries_source gettext insmod ls menuentry
 net_add_addr net_add_dns net_add_route net_bootp net_bootp6 net_del_addr
net_del_dns net_del_route net_get_dhcp_option net_ipv6_autoconf net_ls_addr
net_ls_cards net_ls_dns net_ls_routes net_nslookup normal normal_exit return
search search.file search.fs_label search.fs_uuid set setparams shift source
submenu terminal_input terminal_output unset
I havent really played with netboot for a while (and never loaded from uboot) but it appears it only supports loading from the network.

Tomorrow I plan to setup PXE boot on my network and test loading the Ubuntu netboot installer from grub to install Ubuntu to my sdcard, but first I need to work out the Ethernet issues in uboot.

I feel with the start of EFI and grub support this will open up some great new oportunites to install a variety of different distributions in a custom way from installation images. More testing needed.

Edit: It does seem it supports the sdcard in grub but not the fat filesystem im using at the moment. I will try placing the Ubuntu mini.iso on the sd tomorrow its a cdrom style image mini.iso ISO 9660 CD-ROM filesystem data 'ISOIMAGE' (bootable)

will try fat (or ext2 or 4) for uboot and ISO 9660 for grub.

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

Re: Odroid C2 mainline U-boot support

Post by brad »

I made some progress but failed to start the Ubuntu install kernel via grub.

My steps were

- Write the new uboot on mmc card along with meson-gxbb-odroidc2.dtb on a fat32 partition
- dd the full Zesty install image onto an sdcard
- boot uboot and using the following script boot into into the EFI image on the sdard (this could probably go into a boot.scr.img script)

Code: Select all

#Grub netboot loader
setenv efi_addr 11000000
setenv fdt_addr 10000000
setenv efi_file efi/boot/bootaa64.efi
setenv fdt_file meson-gxbb-odroidc2dtb
setenv bootcmd 'fatload mmc 1 ${fdt_addr} ${fdt_file}; fatload mmc 0 ${efi_addr} ${efi_file};bootefi ${efi_addr} ${fdt_addr}'
boot
- Next im presented with the Grub Ubuntu Installation screen and Select "Install Ubuntu Server"

Here is where the problems begin, I see the following but fail to boot into the kernel (it just hangs)

Code: Select all

EFI stub: Booting Linux Kernel...
EFI stub: EFI_RNG_PROTOCOL unavailable, no randomness supplied
EFI stub: ERROR: could not determine UEFI Secure Boot status.
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
Im not sure if it requires a UEFI secure boot status, there are problems initialising the kernel or I have a mismatched initrd

I attempted to add some debug but nothing. I also edited the ISO image and added a recent kernel which I had built but received invalid magic value errors so im a little stuck to press forward.

OpenProgger
Posts: 8
Joined: Sat Apr 29, 2017 2:58 am
languages_spoken: english,german
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by OpenProgger »

In general U-Boot Mainline have all features for boot from MMC but its not currently defined as boot device in the uboot sources. I just added the following line in the sources to start a uboot script in the first partition.
In include/configs/odroid-c2.h

Code: Select all

#define CONFIG_BOOTCOMMAND "load mmc 0:1 ${scriptaddr} script.bin;source ${scriptaddr};"
This line can be changed for example to boot a kernel directly but it needs a recompilation after any modification.
Uboots EFI implementation is a very basic one and doesn't provide secure boot and only required if your bootloader/OS supports EFI only.
From what i tried until now, there is some display code missing to get HDMI work in mainline kernel.

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

Re: Odroid C2 mainline U-boot support

Post by brad »

OpenProgger wrote:In general U-Boot Mainline have all features for boot from MMC but its not currently defined as boot device in the uboot sources. I just added the following line in the sources to start a uboot script in the first partition.
In include/configs/odroid-c2.h

Code: Select all

#define CONFIG_BOOTCOMMAND "load mmc 0:1 ${scriptaddr} script.bin;source ${scriptaddr};"
This line can be changed for example to boot a kernel directly but it needs a recompilation after any modification.
Uboots EFI implementation is a very basic one and doesn't provide secure boot and only required if your bootloader/OS supports EFI only.
From what i tried until now, there is some display code missing to get HDMI work in mainline kernel.
Thanks for the information, Uboot was already looking for a boot.src.img file on both my PXE/tftp server and on all available file-systems so if I were to compile a boot.scr up it would hopefully work.

I was a little worried about the secure boot in EFI as I had some trouble with magic values booting a custom kernel I produced, Ubuntu installer kernel did not have this problem. I was unable to boot the Ubuntu installation kernel directly from uboot so was thinking the EFI layer might have helped but maybe not in this instance.

I will try a normal kernel (not Ubuntu installer supplied one) to see if I can boot a normal premade OS when I have a chance.

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »

As of today u-boot git sources aka v2017.05-rc3 do support booting from mmc/sd via boot.scr.

-> http://git.denx.de/?p=u-boot.git;a=comm ... 00b3ce7503

However, I can't get saveenv to work.

What are the requirements for saveenv to work?

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

Re: Odroid C2 mainline U-boot support

Post by brad »

redhad wrote:As of today u-boot git sources aka v2017.05-rc3 do support booting from mmc/sd via boot.scr.

-> http://git.denx.de/?p=u-boot.git;a=comm ... 00b3ce7503

However, I can't get saveenv to work.

What are the requirements for saveenv to work?
I think its for writing to flash memory which the c2 dies nit have. Place your compiled script binary on the fs of the sdcard abd it shoukd find it. It should search all cards and filesystems it finds. You have to compile the script into a binary boot.scr.img file

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »

Brad, thank you very much for your quick reply.

I have here a mainline u-boot v2017.05-rc3 booted Gentoo Linux on top of gentoo-sources-4.11.

boot.scr does work indeed (via mkimage).

If I change the /etc/fw_printenv file of the u-boot tools as follows:

Code: Select all

/dev/mmcblk0            0xb4000         0x8000          0x200
and then run fw_printenv, it gives me those envs originally came with the hardkernels emmc and fw_setenv works,too. However, I believe, mainline u-boot doesn't use it as of yet (or I am missing here something).

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

Re: Odroid C2 mainline U-boot support

Post by brad »

redhad wrote: However, I believe, mainline u-boot doesn't use it as of yet (or I am missing here something).
No I think I might be the one missing something :) I need to do some more testing myself.

User avatar
OverSun
Posts: 1493
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 19 times
Contact:

Re: Odroid C2 mainline U-boot support

Post by OverSun »

Did you read the very first line of the output? =D

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »

Here is what fw_printenv gives out:

Code: Select all

# fw_printenv 
baudrate=115200
boardname=ODROIDC2
bootargs=root=/dev/mmcblk0p2 rw init=/init rootwait console=ttyS0,115200 hdmimode=1080p60hz hdmitx=cecf logo=osd1,loaded,0x3f800000,1080p60hz androidboot.hardware=odroidc2 androidboot.serialno=${fbt_id#} androidboot.selinux=disabled  
bootcmd=cfgload; showlogo ${hdmimode}; movi read dtb 0 ${dtbaddr}; movi read boot 0 ${loadaddr}; booti ${loadaddr} - ${dtbaddr}
bootdelay=1
bootlogo_addr=0x20000000
cecconfig=cec0xf
cvbsmode=576cvbs
display_bpp=24
display_color_bg=0
display_color_fg=0xffff
display_color_index=24
display_height=1080
display_layer=osd1
display_width=1920
dtbaddr=0x1000000
ethaddr=00:00:00:00:00:00
fb_addr=0x3f800000
fb_height=720
fb_width=1280
fbt_id#=HKC000000DEA0DBE
fdt_high=0x20000000
gatewayip=192.168.0.1
hdmimode=1080p60hz
hostname=odroidc2
loadaddr=0x20000000
logoopt=osd1,loaded,0x3f800000,1080p60hz
mmc_size=8
netmask=255.255.255.0
outputmode=1080p60hz
serverip=192.168.0.10
stderr=serial
stdin=serial
stdout=serial
vout_mode=hdmi
ipaddr=192.168.3.108
sn and mac were obfuscated.

User avatar
OverSun
Posts: 1493
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 19 times
Contact:

Re: Odroid C2 mainline U-boot support

Post by OverSun »

Well, the source code says that it doesn't use the stored u-boot env anymore. Even if you found on the partition correct, the config for C2 uses "#define CONFIG_ENV_IS_NOWHERE 1", meaning it's not read from the card anymore and is always in the memory.
Not sure how they achieve this, maybe it's streamlined into the blob or something. Anyway, the u-boot env you've found is not used anyway.

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »

v2017.05 is out. Works like a charm.

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »

It should be also mentioned, that there is a way to sign u-boot after the fip_create on the C2 itself via https://github.com/afaerber/meson-tools.

OpenProgger
Posts: 8
Joined: Sat Apr 29, 2017 2:58 am
languages_spoken: english,german
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by OpenProgger »

redhad wrote:It should be also mentioned, that there is a way to sign u-boot after the fip_create on the C2 itself via https://github.com/afaerber/meson-tools.
Works without problems. Now i can safely uninstall qemu :)

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »

OpenProgger wrote:
redhad wrote:It should be also mentioned, that there is a way to sign u-boot after the fip_create on the C2 itself via https://github.com/afaerber/meson-tools.
Works without problems. Now i can safely uninstall qemu :)
Since you seem to use Gentoo as well, maybe those ebuilds in my overlay (https://github.com/nxmyoz/c2-overlay) may be useful (u-boot, meson-tools, fip_create an hardkernels bin files for u-boot).

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

redhad wrote:v2017.05 is out. Works like a charm.
Greetings,

what is the process you did to make it work? config?

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »


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

Re: Odroid C2 mainline U-boot support

Post by brad »

redhad wrote:Follow the instructions in http://git.denx.de/?p=u-boot.git;a=blob ... ME;hb=HEAD.
One small thing that has changed since these instruction which may catch you out is fip_create command. In hardkernel source it is now produced from source rather than from a precompiled binary. You need to compile the hardkernel source first before you can obtain the fip_create to use with the new version of uboot.

sirko
Posts: 10
Joined: Sun Oct 16, 2016 11:44 pm
languages_spoken: german, english
ODROIDs: C2
Location: Germany
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by sirko »

Please prevent me going crazy with that.
My goal is to update kernel on an Ubuntu 16.04 to mainline kernel 4.12.rc2 from kernel.org, I try to adopt that guide for Ubuntu 16.04:

https://github.com/nxmyoz/c2-overlay

amlbootsig from meson-tools seems to work fine.
No problems to sign u-boot on an C2 locally.
Btw, it's not nessecary to compile complete legacy hardkernel u-boot package, inside ./tools/fip_create/fip_create already is a Makefile, so chdir inside that dir and executing a make does the job to get a aarch64 fip_create.

After installation of mainline u-boot, a
dd if=/dev/mmcblk0 count=1024 2>/dev/null | strings | grep -e '^U-Boot'
shows me new u-boot version.

I fatload matching uInitrd, Image, dtb, as installed before in /media/boot/
My approach is to try to completely use all paths and values inside old boot.ini, convert it into a boot.scr, but with bootm istead of booti.

Since I'm doing all that stuff in Ansible, I'm to lazy to pick out all commands...

Any working complete kernel/u-boot script for Ubuntu out there?

The machine reboots, I can ping it for a while, then again, but not login via ssh...

Just let me have a guess: Its better to buy that serial converter to have serial access for debugging, right?

Regards
Sirko

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

Re: Odroid C2 mainline U-boot support

Post by brad »

sirko wrote:Please prevent me going crazy with that.
My goal is to update kernel on an Ubuntu 16.04 to mainline kernel 4.12.rc2 from kernel.org, I try to adopt that guide for Ubuntu 16.04:
Hi Sirko,
firstly having access to the serial converter will be very helpful for debug purposes.

But if would would like to try to debug without it here are some thoughts.

Odroid lights
===========
Red - power only no loading into uboot
Steady Blue - We are in the uboot environment
Flashing Blue - We have successfully started the kernel to some degree

Ethernet
========
Uboot will boot with Ethernet enabled and will pick an address if its default dhcp enabled whilst in the uboot environment
Kernel will change that IP address in mainline as it uses a random mac address, ensure that the IP has not changed and being the reason you can ping initially but then not ssh to it. You should be able to confirm in your router config.

Example script I used in an older version of mainline uboot which was working (not sure if it works with current uboot environment and I was pasting into the console rather than boot.scr.img)

Code: Select all

#MMC Boot
setenv kernel_addr 11000000
setenv fdt_addr 1000000
setenv initrd_loadaddr 13000000
setenv bootfile Image
setenv fdtfile meson-gxbb-odroidc2.dtb
setenv initrdfile uInitrd
setenv fsargs "setenv bootargs root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rw no_console_suspend fsck.fix=yes"
setenv bootcmd 'fatload mmc 0:1 ${initrd_loadaddr} ${initrdfile} ;fatload mmc 0:1 ${kernel_addr} ${bootfile};fatload mmc 0:1 ${fdt_addr} ${fdtfile};run fsargs ;booti ${kernel_addr} ${initrd_loadaddr} ${fdt_addr}'
boot
I believe I had some troubles with bootm command failing to start the kernel but booti was working ok for me.

Hope it might be of some help.

Brad.

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

two pointers, it seem that fip_create still exists in the tree, am I missing something?
one of uboot's bins is the u-boot.img. the link above seems to replace it with the one from hk. how can I be sure that uboot is indeed 2017.05 and not 2015?

sirko
Posts: 10
Joined: Sun Oct 16, 2016 11:44 pm
languages_spoken: german, english
ODROIDs: C2
Location: Germany
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by sirko »

Interpreting the flashing heartbeat right, my way seems right;-)
Anyway, I'll order that serial adapter for debugging.

And ofcourse I meant fip_create source inside legacy hardkernel u-boot, wich seems still needed for signing image of mainline u-boot to me.

If that Combination kernel/U-boot once will run, then there are no longer limits regarding linux distributions or grsecurity patch.
My personal intention is, I want to run my C2 inside no longer with Ubuntu, but with Alpine Linux.

To reduce complexity.
Thank you.

redhad
Posts: 20
Joined: Wed May 03, 2017 10:58 pm
languages_spoken: english, german, russian, french
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by redhad »

@sirko: Please be aware that Grsecurity has ceased to publish its patches. Grsecurity had testing patches for kernel 4.10.x. Given that running mainline on the C2 will require more recent kernels (>4.10), Grsecurity won't be an option. Consider tuning your kernel according to https://kernsec.org/wiki/index.php/Kern ... on_Project, as KSPP will get and is already getting more attention because of Grsecurity's decision to withdraw from practicing open source development/open source distribution.

sirko
Posts: 10
Joined: Sun Oct 16, 2016 11:44 pm
languages_spoken: german, english
ODROIDs: C2
Location: Germany
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by sirko »

hi brad, daggs, redhad,

thank you a lot.
The problem was simple:

kernel 3.14 with legacy u-boot defines / with sd card AND emmc:

# mount | grep -e '\ /\ '
/dev/mmcblk0p2 on / type ext4 (rw,relatime)

After successful update to 4.12,
*cajeeeeeing...*

# uname -a
Linux hal02 4.12.0-rc6-gx-g9705596 #1 SMP PREEMPT Tue Jun 20 08:06:47 CEST 2017 aarch64 aarch64 aarch64 GNU/Linux

the new kernel defines sd card as: /dev/mmcblk1p2 !

At the moment, I test last changes to playbook, that takes some hours.
But for now, everything looks pretty stable.

*
The moment, weeks later, when you realized how to connect your damn cheap cp2104 (and at the end luckily not cared about all these voltage warnings about 3v3!) uart adapter clone without specs... and then, finally, you see the ERROR MESSAGE!

sirko
Posts: 10
Joined: Sun Oct 16, 2016 11:44 pm
languages_spoken: german, english
ODROIDs: C2
Location: Germany
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by sirko »

I finished the playbook.
For me, it runs successfully even on fresh ubuntu-minimal-installs.

Testers welcome.

https://github.com/datenklause/odroid-c ... 12-ansible

MartB
Posts: 15
Joined: Sun Jun 18, 2017 4:38 am
languages_spoken: english, german
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by MartB »

Sent the following patch to the mailing list, which enables serial# environment variable support which is read from the efuse.
Pretty simple but someone in the mainline kernel thread needed it.

Edit: This patch is now in u-boot master so no need to apply it anymore.

Code: Select all

From 73b98661a8994b68d8cddaee6c71a0e07da5ecb9 Mon Sep 17 00:00:00 2001
From: MartB <mart.b@outlook.de>
Date: Fri, 23 Jun 2017 15:05:11 +0200
Subject: [PATCH] odroid-c2: Populate serial# environment variable from efuse
---
 board/amlogic/odroid-c2/odroid-c2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/board/amlogic/odroid-c2/odroid-c2.c b/board/amlogic/odroid-c2/odroid-c2.c
index 9306b56a6a..b29f56d5eb 100644
--- a/board/amlogic/odroid-c2/odroid-c2.c
+++ b/board/amlogic/odroid-c2/odroid-c2.c
@@ -24,6 +24,7 @@ int board_init(void)
 int misc_init_r(void)
 {
 	u8 mac_addr[EFUSE_MAC_SIZE];
+	char serial[EFUSE_SN_SIZE];
 	ssize_t len;
 
 	/* Set RGMII mode */
@@ -50,5 +51,12 @@ int misc_init_r(void)
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
+	if (!getenv("serial#")) {
+		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
+			EFUSE_SN_SIZE);
+		if (len == EFUSE_SN_SIZE) 
+			setenv("serial#", serial);
+	}
+
 	return 0;
 }
-- 
2.13.0

oreggin
Posts: 3
Joined: Thu Feb 23, 2017 8:10 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by oreggin »

Hi folks,

I tried mainline u-boot and GRUB2 uEFI bootloader.
I have an SDCARD with MBR and two partitions. First is the /boot partition with ext4 and second is the / (root) partititon with ext4.
kernel, initrd, DTB, grub.efi, and all bootloader is on first partition.
I use ArchlinuxARM's kernel. initrd is unnecessary in grub.cfg.
I compiled grub2 under Gentoo Linux aarch64, but i think any distribution's grub2 is usable. For example: http://ports.ubuntu.com/ubuntu-ports/di ... efi.signed
What I did:
  • created an grub2uefi image:

    Code: Select all

    rm -rf grub.efi && grub-mkimage -O arm64-efi -o grub.efi -p "(hd0,msdos1)/grub/" `ls /usr/lib/grub/arm64-efi/*.mod | cut -d. -f1`
    set in boot.scr to boot grub.efi:

    Code: Select all

    setenv grub2uefi_addr_r 0x11000000
    if load ${devtype} ${devnum}:${distro_bootpart} ${grub2uefi_addr_r} /grub.efi; then
            bootefi ${grub2uefi_addr_r} ${grub2uefi_addr_r};
    fi
    configured and placed grub.cfg on sdcard's first partition: /grub/grub.cfg

    Code: Select all

    set timeout=5
    set default=0
    
    menuentry 'Arch Linux ARM' {
    	set root=(hd0,msdos1)
    	linux /Image console=ttyAML0,115200n8 root=/dev/mmcblk1p2 rootwait rw earlycon fsck.fix=yes
    	initrd /initramfs-linux.img
    	devicetree /dtbs/amlogic/meson-gxbb-odroidc2.dtb
    }
Here is the UART output:

Code: Select all

Booting `Arch Linux ARM'




 EFI stub: Booting Linux Kernel...-gxbb-odroidc2.  20.23KiB  100%  386.43B/s ]
EFI stub: ERROR: Could not determine UEFI Secure Boot status.
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.13.0-rc1-1-ARCH (builduser@leming) (gcc version 7.1.1 20170516 (GCC)) #1 SMP Sun Jul 16 20:56:09 MDT 2017
[    0.000000] Boot CPU: AArch64 Processor [410fd034]
[    0.000000] Machine model: Hardkernel ODROID-C2
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: EFI v2.05 by Das U-boot
[    0.000000] efi:  SMBIOS=0x7cd00000 
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000071000000, size 188 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] earlycon: meson0 at MMIO 0x00000000c81004c0 (options '115200n8')
[    0.000000] bootconsole [meson0] enabled
 . . .
Works fine in unsecured mode.

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

I'm trying to boot an image with latest uboot and hk kernel.
running fdisk -l on the device after the dd, returns a valid partition table, but while booting I get this:

Code: Select all

GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 330760
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
Load bl30 from SD, src: 0x00010200, des: 0x01000000, size: 0x00009ef0
Sending bl30........................................OK. 
Run bl30...
Load bl301 from SD, src: 0x0001c200, des: 0x01000000, size: 0x000018c0
Wait bl30...Done
Sending bl301.......OK. 
Run bl301...
1 from SD, src: 0x00020200, des: 0x10100000, size: 0x00011130


--- UART initialized after reboot ---
[Reset cause: unknown]
[Image: unknown, amlogic_v1.1.3046-00db630-dirty 2016-08-31 09:24:14 tao.zeng@droid04]
bl30: check_permit, count is 1
bl30: check_permit: ok!
chipid: ef be ad de d f0 ad ba ef be aLoad bl33 from SD, src: 0x00034200, des: 0x01000000, size: 0x00055f00
d de not ES chip
[0.445572 Inits done]
secure task start!
high task start!
low task start!
NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9


U-Boot 2017.07 (Aug 04 2017 - 21:46:33 +0300) odroid-c2

DRAM:  2 GiB
MMC:   mmc@72000: 0, mmc@74000: 1
Using default environment

In:    serial@4c0
Out:   serial@4c0
Err:   serial@4c0
Net:   eth0: ethernet@c9410000
Hit any key to stop autoboot:  0 
** Wrong ISO Ident: hb8 on 0:1 **
switch to partitions #0, OK
mmc0 is current device
** No partition table - mmc 0 **
Card did not respond to voltage select!
mmc_init: -95, time 10
MMC Device 2 not found
no mmc device at slot 2
ethernet@c9410000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY ethernet@c9410000
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/01-00-1e-06-34-f1-f9
ethernet@c9410000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
what makes the issue weirder is that running fdisk -l once again, there is no partition table.
somehow the first boot delete the partition table.
any idea what it can be?

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

answering myself, the instructions at http://git.denx.de/?p=u-boot.git;a=blob ... 6c;hb=HEAD are simply wrong.
the last 3 dd will delete the image, notrunc must be added to conv.
passing that I was able to get the vfat found, iamge and dtb file loaded but it is stuck on starting kernel (using hk's repo).
the current output is this:

Code: Select all

GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 436267
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
Load bl30 from SD, src: 0x00010200, des: 0x01000000, size: 0x00009ef0
Sending bl30........................................OK. 
Run bl30...
Load bl301 from SD, src: 0x0001c200, des: 0x01000000, size: 0x000018c0
Wait bl30...Done
Sending bl301.......OK. 
Run bl301...
31 from SD, src: 0x00020200, des: 0x10100000, size: 0x00011130


--- UART initialized after reboot ---
[Reset cause: unknown]
[Image: unknown, amlogic_v1.1.3046-00db630-dirty 2016-08-31 09:24:14 tao.zeng@droid04]
bl30: check_permit, count is 1
bl30: check_permit: ok!
chipid: ef be ad de d f0 ad ba ef be Load bl33 from SD, src: 0x00034200, des: 0x01000000, size: 0x00055f00
ad de not ES chip
[0.550974 Inits done]
secure task start!
high task start!
low task start!
NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9


U-Boot 2017.07 (Aug 04 2017 - 21:53:09 +0300) odroid-c2

DRAM:  2 GiB
MMC:   mmc@72000: 0, mmc@74000: 1
Using default environment

In:    serial@4c0
Out:   serial@4c0
Err:   serial@4c0
Net:   eth0: ethernet@c9410000
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
6244 bytes read in 2 ms (3 MiB/s)
## Executing script at 1f000000
reading Image
13472384 bytes read in 578 ms (22.2 MiB/s)
reading meson64_odroidc2.dtb
29264 bytes read in 3 ms (9.3 MiB/s)
## Flattened Device Tree blob at 01000000
   Booting using the fdt blob at 0x1000000
   Loading Device Tree to 000000007df4e000, end 000000007df5824f ... OK

Starting kernel ...
does new uboot needs wrapper like latest kernel?

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

Re: Odroid C2 mainline U-boot support

Post by brad »

daggs wrote:answering myself, the instructions at http://git.denx.de/?p=u-boot.git;a=blob ... 6c;hb=HEAD are simply wrong.
the last 3 dd will delete the image, notrunc must be added to conv.
passing that I was able to get the vfat found, iamge and dtb file loaded but it is stuck on starting kernel (using hk's repo).
Its a complex little process to understand but it works fine for me

The last 3 dd command write out the various sections of the boot image to sdcard, none of them will delete anything but strategically place the image parts in the correct locations.

This line takes the hardkernel bl1 bootloader and writes the first 442 bytes of the BL1 image to disk . (This is what the S905 first looks for to initiate boot from the sd or emmc)

Code: Select all

dd if=$BL1 of=$DEV conv=fsync bs=1 count=442
This line takes the BL1 boot loader image, skips the first 512 bytes of the image and writes the rest of the BL1 image to disk (also skipping the first 512 bytes of disk)

Code: Select all

dd if=$BL1 of=$DEV conv=fsync bs=512 skip=1 seek=1
This line writes the FIP image created earlier in the build process to the disk skipping 49,664 bytes before starting to write.

Code: Select all

dd if=$DIR/u-boot.gxbb of=$DEV conv=fsync bs=512 seek=97
We need to write the image sections to the correct sections of the sdcard where the bootloader will look for them and also where they will not overlap the MBR on the disk.

In regards to no display on the console after booting the kernel, it might be possible you are using the wrong console in your boot.src script. Mainline uboot uses default console names where as hardkernel uboot and kernel do not. Try to remove any console name from your boot.src script and allow it to use default console names. You should not need a uImage wrapper in mainline uboot, booti and bootm should work to boot if you have loaded the Image and dtb to the correct locations. I can see what you have used from the console output would need to see the contents of the boot.src script.

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

brad wrote:
daggs wrote:answering myself, the instructions at http://git.denx.de/?p=u-boot.git;a=blob ... 6c;hb=HEAD are simply wrong.
the last 3 dd will delete the image, notrunc must be added to conv.
passing that I was able to get the vfat found, iamge and dtb file loaded but it is stuck on starting kernel (using hk's repo).
Its a complex little process to understand but it works fine for me

The last 3 dd command write out the various sections of the boot image to sdcard, none of them will delete anything but strategically place the image parts in the correct locations.

This line takes the hardkernel bl1 bootloader and writes the first 442 bytes of the BL1 image to disk . (This is what the S905 first looks for to initiate boot from the sd or emmc)

Code: Select all

dd if=$BL1 of=$DEV conv=fsync bs=1 count=442
This line takes the BL1 boot loader image, skips the first 512 bytes of the image and writes the rest of the BL1 image to disk (also skipping the first 512 bytes of disk)

Code: Select all

dd if=$BL1 of=$DEV conv=fsync bs=512 skip=1 seek=1
This line writes the FIP image created earlier in the build process to the disk skipping 49,664 bytes before starting to write.

Code: Select all

dd if=$DIR/u-boot.gxbb of=$DEV conv=fsync bs=512 seek=97
We need to write the image sections to the correct sections of the sdcard where the bootloader will look for them and also where they will not overlap the MBR on the disk.
mmm you are correct, the diff is that I'm writing the changes into a file, without notrunc they rest of the file will be deleted.
on a physical device, it should work without any problems.
brad wrote:In regards to no display on the console after booting the kernel, it might be possible you are using the wrong console in your boot.src script. Mainline uboot uses default console names where as hardkernel uboot and kernel do not. Try to remove any console name from your boot.src script and allow it to use default console names. You should not need a uImage wrapper in mainline uboot, booti and bootm should work to boot if you have loaded the Image and dtb to the correct locations. I can see what you have used from the console output would need to see the contents of the boot.src script.
here:

Code: Select all

# Possible screen resolutions
# Uncomment only a single Line! The line with setenv written.
# At least one mode must be selected.

# Custom modeline!
# To use custom modeline you need to disable all the below resolutions
# and setup your own! 
# For more information check our wiki: 
# http://odroid.com/dokuwiki/doku.php?id=en:c2_hdmi_autosetting
# Example below:
# setenv m "custombuilt" 
# setenv modeline "1920,1200,154000,74040,60,1920,1968,2000,2080,1200,1202,1208,1235,1,0,1"

# 480 Lines (720x480)
# setenv m "480i60hz" # Interlaced 60Hz
# setenv m "480i_rpt" # Interlaced for Rear Projection Televisions 60Hz
# setenv m "480p60hz" # 480 Progressive 60Hz
# setenv m "480p_rpt" # 480 Progressive for Rear Projection Televisions 60Hz

# 576 Lines (720x576)
# setenv m "576i50hz" # Interlaced 50Hz
# setenv m "576i_rpt" # Interlaced for Rear Projection Televisions 50Hz
# setenv m "576p50hz" # Progressive 50Hz
# setenv m "576p_rpt" # Progressive for Rear Projection Televisions 50Hz

# 720 Lines (1280x720)
# setenv m "720p50hz" # 50Hz
# setenv m "720p60hz" # 60Hz

# 1080 Lines (1920x1080)
# setenv m "1080i60hz" # Interlaced 60Hz
setenv m "1080p60hz" # Progressive 60Hz
# setenv m "1080i50hz" # Interlaced 50Hz
# setenv m "1080p50hz" # Progressive 50Hz                                                                                                                                                                                
# setenv m "1080p24hz" # Progressive 24Hz

# 4K (3840x2160)
# setenv m "2160p30hz"    # Progressive 30Hz
# setenv m "2160p25hz"    # Progressive 25Hz
# setenv m "2160p24hz"    # Progressive 24Hz
# setenv m "smpte24hz"    # Progressive 24Hz SMPTE
# setenv m "2160p50hz"    # Progressive 50Hz
# setenv m "2160p60hz"    # Progressive 60Hz
# setenv m "2160p50hz420" # Progressive 50Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it)
# setenv m "2160p60hz420" # Progressive 60Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it)

### VESA modes ###
# setenv m "640x480p60hz"
# setenv m "800x480p60hz"
# setenv m "480x800p60hz"
# setenv m "800x600p60hz"
# setenv m "1024x600p60hz"
# setenv m "1024x768p60hz"  
# setenv m "1280x800p60hz"
# setenv m "1280x1024p60hz"
# setenv m "1360x768p60hz"
# setenv m "1440x900p60hz"
# setenv m "1600x900p60hz"
# setenv m "1680x1050p60hz"
# setenv m "1600x1200p60hz"
# setenv m "1920x1200p60hz"
# setenv m "2560x1080p60hz"
# setenv m "2560x1440p60hz"
# setenv m "2560x1600p60hz"
# setenv m "3440x1440p60hz"

# HDMI BPP Mode
setenv m_bpp "32"
# setenv m_bpp "24"
# setenv m_bpp "16"

# HDMI DVI/VGA modes
# By default its set to HDMI, if needed change below.
# Uncomment only a single Line.
# setenv vout "dvi"
# setenv vout "vga"

# HDMI HotPlug Detection control
# Allows you to force HDMI thinking that the cable is connected.
# true = HDMI will believe that cable is always connected
# false = will let board/monitor negotiate the connection status
setenv hpd "true"
# setenv hpd "false"

# Monitor output
# Controls if HDMI PHY should output anything to the monitor
setenv monitor_onoff "false" # true or false

# Server Mode (aka. No Graphics)
# Setting nographics to 1 will disable all video subsystem
# This mode is ideal of server type usage. (Saves ~300Mb of RAM)
setenv nographics "0"

# Meson Timer
# 1 - Meson Timer
# 0 - Arch Timer 
# Using meson_timer improves the video playback however it breaks KVM (virtualization).
# Using arch timer allows KVM/Virtualization to work however you'll experience poor video
setenv mesontimer "1"

# UHS (Ultra High Speed) MicroSD mode enable/disable
setenv disableuhs "false"

# MicroSD Card Detection enable/disable
# Force the MMC controlled to believe that a card is connected.
setenv mmc_removable "true"

# USB Multi WebCam tweak
# Only enable this if you use it.
setenv usbmulticam "false"

# Default Console Device Setting
setenv condev "console=ttyS0,115200n8"   # on both

# CPU Frequency / Cores control
###########################################
### WARNING!!! WARNING!!! WARNING!!!
# Before changing anything here please read the wiki entry: 
# http://odroid.com/dokuwiki/doku.php?id=en:c2_set_cpu_freq
#
# MAX CPU's
# setenv maxcpus "1"
# setenv maxcpus "2"
# setenv maxcpus "3"
setenv maxcpus "4"

# MAX Frequency
# setenv max_freq "2016"  # 2.016GHz
# setenv max_freq "1944"  # 1.944GHz
# setenv max_freq "1944"  # 1.944GHz
# setenv max_freq "1920"  # 1.920GHz
# setenv max_freq "1896"  # 1.896GHz
# setenv max_freq "1752"  # 1.752GHz
# setenv max_freq "1680"  # 1.680GHz
# setenv max_freq "1656"  # 1.656GHz
setenv max_freq "1536"  # 1.536GHz



###########################################

# Boot Arguments
if test "${m}" = "custombuilt"; then setenv cmode "modeline=${modeline}"; fi

setenv bootargs "root=/dev/mmcblk0p2 rootwait ro ${condev} no_console_suspend hdmimode=${m} ${cmode} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop disablehpd=${hpd} max_freq=${max_freq} maxcpus=${maxcpus} monitor_onoff=${monitor_onoff} disableuhs=${disableuhs} mmc_removable=${mmc_removable} usbmulticam=${usbmulticam}"

setenv loadaddr "0x20000000"
setenv dtb_loadaddr "0x01000000"
setenv initrd_high "0xffffffff"
setenv fdt_high "0xffffffff"
setenv kernel_filename Image
setenv fdt_filename meson64_odroidc2.dtb

fatload mmc 0:1 ${loadaddr} ${kernel_filename}
fatload mmc 0:1 ${dtb_loadaddr} ${fdt_filename}
fdt addr ${dtb_loadaddr}

if test "${mesontimer}" = "0"; then fdt rm /meson_timer; fdt rm /cpus/cpu@0/timer; fdt rm /cpus/cpu@1/timer; fdt rm /cpus/cpu@2/timer; fdt rm /cpus/cpu@3/timer; fi
if test "${mesontimer}" = "1"; then fdt rm /timer; fi

if test "${nographics}" = "1"; then fdt rm /reserved-memory; fdt rm /aocec; fi
if test "${nographics}" = "1"; then fdt rm /meson-fb; fdt rm /amhdmitx; fdt rm /picdec; fdt rm /ppmgr; fi
if test "${nographics}" = "1"; then fdt rm /meson-vout; fdt rm /mesonstream; fdt rm /meson-fb; fi
if test "${nographics}" = "1"; then fdt rm /deinterlace; fdt rm /codec_mm; fi

booti ${loadaddr} - ${dtb_loadaddr}


#setenv loadaddr "0x20000000"
#setenv dtb_loadaddr "0x01000000"
#setenv initrd_high "0xffffffff"
#setenv fdt_high "0xffffffff"
#setenv kernel_filename Image
#setenv fdt_filename meson64_odroidc2.dtb

#fatload mmc 0:1 ${loadaddr} ${kernel_filename}
#fatload mmc 0:1 ${dtb_loadaddr} ${fdt_filename}
#booti ${loadaddr} - ${dtb_loadaddr}

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

Re: Odroid C2 mainline U-boot support

Post by brad »

Im not too sure but 2 things to possibly try..

Try to change the loadaddr in the scr script to "loadaddr "0x11000000" for booti

Also try to comment out this line for console..
# setenv condev "console=ttyS0,115200n8" # on both

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

tried that, still stuck at the same location... :-(

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

Re: Odroid C2 mainline U-boot support

Post by brad »

daggs wrote:tried that, still stuck at the same location... :-(
For the past few month I have been using the hardkernel uboot to boot the kernel, next time I build mainline will see if I can look into it further as there have been a few changes.

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

brad wrote:
daggs wrote:tried that, still stuck at the same location... :-(
For the past few month I have been using the hardkernel uboot to boot the kernel, next time I build mainline will see if I can look into it further as there have been a few changes.
ok, thanks, if it doesn't help, I'll ask at the uboot mailing list.

AdrianB
Posts: 11
Joined: Thu Aug 31, 2017 5:03 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by AdrianB »

Hi,

This year I brought an Odroid C2, so I'm new in Odroid. I was impress about its hardware over RPi, but my problem is the old kernel which armbian is coming.
For about few days I'm trying to boot kernel 4.12 or 4.10 which I saw that Odroid is supported in mainline.
Unfortunately the U-boot doesn't want to boot it. So I've moved to the next step to recompile the U-boot.
Yesterday and today I did everything I could to compile U-boot and run it.
I've compiled few versions: 201701, 201707, 201709 and 201501.
201501 I've compiled with GCC 4.9.2, the rest I've tried with GCC 4.9.x and 7.1/7.2 (crosscomplier for ARM64).
The only one which is booting is 201501, the rest are entering into a reset loop:

Code: Select all

GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 113804
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
aml log : SIG CHK : 351 for address 0x01700000
reset...
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 113801
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
aml log : SIG CHK : 351 for address 0x01700000
reset...
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 113802
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
aml log : SIG CHK : 351 for address 0x01700000
reset...
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;READ:0;CHK:0;
TE: 113803
no sdio debug board detected 

BL2 Built : 11:44:26, Nov 25 2015. 
gxb gfb13a3b-c2 - jcao@wonton

Board ID = 8
set vcck to 1100 mv
set vddee to 1050 mv
CPU clk: 1536MHz
DDR channel setting: DDR0 Rank0+1 same
DDR0: 2048MB(auto) @ 912MHz(2T)-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x000000b0
aml log : SIG CHK : 351 for address 0x01700000
reset...
GXBB:BL1:08dafd:0a8993;FEAT:EDFC318C;POC:3;RCY:0;EMMC:800;NAND:81;SD:0;
Please, can anybody tell me a procedure how can I make U-boot to boot on Odroid C2? I don't have any ideas.

I used the script sd_fusing.sh:

Code: Select all

root@Adi-Laptop:/opt/OdroidC2/u-boot/201709# cat ./sd_fusing.sh 
#!/bin/sh
#
# Copyright (C) 2015 Hardkernel Co,. Ltd
# Dongjin Kim <tobetter@gmail.com>
#
# SPDX-License-Identifier:	GPL-2.0+
#

BL1=bl1.bin.hardkernel
#UBOOT=u-boot.bin
UBOOT=u-boot-sign.bin

if [ -z $1 ]; then
        echo "Usage ./sd_fusing.sh <SD card reader's device>"
        exit 1
fi

if [ ! -f $BL1 ]; then
        echo "error: $BL1 does not exist"
        exit 1
fi

if [ ! -f $UBOOT ]; then
        echo "error: $UBOOT does not exist"
        exit 1
fi

sudo dd if=$BL1 of=$1 conv=fsync,notrunc bs=1 count=442
sudo dd if=$BL1 of=$1 conv=fsync,notrunc bs=512 skip=1 seek=1
sudo dd if=$UBOOT of=$1 conv=fsync,notrunc bs=512 seek=97

sync

sudo eject $1
echo Finished.
And those are the files in the same directory:

Code: Select all

root@Adi-Laptop:/opt/OdroidC2/u-boot/201709# ls -l
total 888
-rw-r--r-- 1 root root  49664 Aug 28 18:11 bl1.bin.hardkernel
-rwxr-xr-x 1 root root    677 Aug 30 21:57 sd_fusing.sh
-rw-r--r-- 1 root root 414872 Aug 30 20:44 u-boot.bin
root@Adi-Laptop:/opt/OdroidC2/u-boot/201709# 
Is this tool not valid for newer U-boot or I'm doing something wrong when I'm compiling the U-boot?

My steps:

Code: Select all

# export ARCH="arm64"
# export CROSS_COMPILE="aarch64-linux-gnu-"
# ${CROSS_COMPILE}gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/aarch64-linux-gnu/7/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=aarch64-linux-gnu --program-prefix=aarch64-linux-gnu- --includedir=/usr/aarch64-linux-gnu/include
Thread model: posix
gcc version 7.2.0 (Debian 7.2.0-1) 
# make distclean
# make odroid-c2_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
# make all -j8
... -> everything is build correctly, no errors
  LD      u-boot
  OBJCOPY u-boot.srec
  OBJCOPY u-boot-nodtb.bin
  SYM     u-boot.sym
  DTC     arch/arm/dts/meson-gxbb-odroidc2.dtb
start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1 -d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut -f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x01000000 $start $end
make[2]: 'arch/arm/dts/meson-gxbb-odroidc2.dtb' is up to date.
  SHIPPED dts/dt.dtb
  COPY    u-boot.dtb
  CAT     u-boot-dtb.bin
  COPY    u-boot.bin
  LD      u-boot.elf
  CFGCHK  u-boot.cfg
# ./sd_fusing.sh /dev/sdg
442+0 records in
442+0 records out
442 bytes copied, 0.04052 s, 10.9 kB/s
96+0 records in
96+0 records out
49152 bytes (49 kB, 48 KiB) copied, 0.015714 s, 3.1 MB/s
722+1 records in
722+1 records out
369728 bytes (370 kB, 361 KiB) copied, 0.0632932 s, 5.8 MB/s
Finished.
Now trying to boot and Odroid is entering that reset loop.
Any ideas please?

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

Re: Odroid C2 mainline U-boot support

Post by brad »

It looks like you missed a couple of steps in the Image creation before writing to the sd card. The official instruction here have some detail under the Image creation process...

If you are running x86/64 as host machine it should work fine. You dont need the sd_fusing.sh script for above instruction.

AdrianB
Posts: 11
Joined: Thu Aug 31, 2017 5:03 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by AdrianB »

Hi brad,

Thanks for reply. It could be. I'm not familiar with Odroid C2 devices.
I'm trying to understand the u-boot. I've found another u-boot sources which is mixing HardKernel U-boot loader with the new version.
On the official page of the Odroid C2 I'm founding also something about bl301.bin
I've found other Uboot gits and I saw that in the make file is copying the u-boot.bin to old HardKernel source from denx U-boot under hardkernel/fip/gxb/bl33.bin
I really can't find a clear information how u-boot is build for Odroid C2.
After you told me that I've jumped over some steps and checking that custom Uboot now for me is clear that u-boot for Odroid is composed from more than one .bin file:

Code: Select all

        cp denx/u-boot.bin hardkernel/fip/gxb/bl33.bin
        cd hardkernel/fip/gxb && ../fip_create \
          --bl30 bl30.bin --bl301 bl301.bin \
          --bl31 bl31.bin --bl33 bl33.bin fip.bin
        cd hardkernel/fip/gxb && cat bl2.package fip.bin > boot_new.bin
So: bl30.bin, bl301.bin, bl31.bi, bl33.bin (which is actually the new u-boot) and then bl2.package.
I've tried to understand those files which is doing what ... but I couldn't find any information.
In the end indeed is signing the boot_new.bin.

The problem with this u-boot is that is entering in u-boot but it can't boot anything. It says something about "MMC card voltage".

Do you have a link or some documentation about how the u-boot for Odroid C2 is compounded?

Thanks,
Adrian

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

Re: Odroid C2 mainline U-boot support

Post by brad »

AdrianB wrote:

Code: Select all

        cp denx/u-boot.bin hardkernel/fip/gxb/bl33.bin
        cd hardkernel/fip/gxb && ../fip_create \
          --bl30 bl30.bin --bl301 bl301.bin \
          --bl31 bl31.bin --bl33 bl33.bin fip.bin
        cd hardkernel/fip/gxb && cat bl2.package fip.bin > boot_new.bin
So: bl30.bin, bl301.bin, bl31.bi, bl33.bin (which is actually the new u-boot) and then bl2.package.
I've tried to understand those files which is doing what ... but I couldn't find any information.
There is not a lot of documentation for the Arm FIrmware used by the C2, its mostly proprietary and supplied as binaries. For a start I think its worth noting that there are quiet a few stages in the boot process but they can be separated into mainly into the Arm Trusted Firmware (ATF) and Uboot stages. The code above is bringing uboot (bl33.bin) into the image being created. This next link is a good starting overview of what the c2 is doing during the stages of boot the images it requires before loading uboot. (https://github.com/ARM-software/arm-tru ... erminology). The C2 is using a licenced version of the firmware and little different, no BL22 but there are bl30 & bl301.

Sorry, I was supposed to link this in my last post http://git.denx.de/?p=u-boot.git;a=blob ... -c2/README

There is also a step to write the BL1 image directly onto the sd in the readme. It splits the bl1.bin.hardkernel image in 2 and writes each part to separate locations on the physical disk for whatever reasons. The Bl1 image is found in the hardkernel uboot source as "/sd_fuse/bl1.bin.hardkernel" and there is some code in the README above with the example.

AdrianB
Posts: 11
Joined: Thu Aug 31, 2017 5:03 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by AdrianB »

Hi brad,

Thanks a lot! Also I've found last evening this: https://dn.odroid.com/S905/BootLoader/O ... layout.png
Also it is a good info the link you give me.

Now maybe is good thing to post here the script which I used (inspired from HardKernel Makefile) to build my U-boot binaries and to write them to the SD.
I success to boot into the U-Boot last evening.

I've created a directory with a structure like this:

Code: Select all

.
.
├── build_u-boot
├── fip
│   └── gxb
│       ├── bl2.package
│       ├── bl301.bin
│       ├── bl30.bin
│       └── bl31.bin
├── sd_fuse
│   ├── bl1.bin.hardkernel
│   └── sd_fusing.sh
├── tools
│   ├── amlbootsig
│   ├── aml_encrypt_gxb
│   ├── amlinfo
│   ├── fip_create
│   └── unamlbootsig
└── u-boot-binary
    └── u-boot_bl33.bin
The files from fip/gxb/ are the ones from HardKernel U-boot. They can be downloaded from their git repository.
fip_create also it can be found in HardKernel U-boot.
The tools can be compiled from meson-tools git https://github.com/afaerber/meson-tools or from HardKernel.
bl1.bin.hardkernel it can be found on HardKernel.
sd_fusing.sh it can be found on HardKernel.

u-boot-binary/u-boot_bl33.bin -> is the compiled U-boot and renamed as u-boot_bl33.bin

So, the script used by me is this, called build_u-boot:

Code: Select all

#!/bin/bash

### Build FIP image
tools/fip_create --bl30 fip/gxb/bl30.bin --bl301 fip/gxb/bl301.bin --bl31 fip/gxb/bl31.bin --bl33 u-boot-binary/u-boot_bl33.bin fip/gxb/fip.bin

### Add BL2 stage 2
cat fip/gxb/bl2.package fip/gxb/fip.bin > fip/gxb/boot_new.bin

### Sign the image
tools/aml_encrypt_gxb --bootsig --input fip/gxb/boot_new.bin --output fip/gxb/u-boot.bin

### Build u-boot.bin into sd_fuse/ starting from 49152
dd if=fip/gxb/u-boot.bin of=sd_fuse/u-boot.bin bs=512 skip=96

### Build u-boot.bin into root dir
dd if=sd_fuse/bl1.bin.hardkernel of=u-boot.bin conv=fsync
dd if=sd_fuse/bl1.bin.hardkernel of=u-boot.bin conv=fsync,notrunc bs=512 skip=1 seek=1
dd if=sd_fuse/u-boot.bin of=u-boot.bin conv=fsync,notrunc bs=512 seek=97

In the end we will get in the sd_fuse folder the u-boot.bin which is ready to be written on SD.
Use the sd_fuse script to write it on SD.

Maybe it will helps others to test new U-boot on Odroid C2 :).

Kind regards,
Adrian

rpcameron
Posts: 278
Joined: Sat Apr 30, 2016 7:24 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by rpcameron »

I'm a bit flummoxed as to why I can't seem to get a vanilla mainline to boot. This evening I built 2017.07 from sources, used HK's bl files to generate the u-boot.bin, and HK's sd_fusing script to write the image. I placed the generated dtb into an amlogic folder in the root of the FAT partition on the sdcard, but that was unnecessary as I couldn't even get uboot to properly start up.

I'm going to give it another shot, and then I'll try with the latest RC for 2017.09 as well. Perhaps I'm just missing a step that I keep glossing over as I build the image.

rpcameron
Posts: 278
Joined: Sat Apr 30, 2016 7:24 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by rpcameron »

I think I may have stumbled upon the reason why my builds didn't seem to work: I only have aarch64-linux-gnu toolchains, not aarch64-none-elf. So, I'm currently building an aarch64-none-elf toolchain on my main x86_64 machine for a cross-compile. Hopefully this will get me one step closer. (I guess I should be thankful that the Arch PKGBUILDs for binutils and gcc use a $_target variable at the head to specify the triple, so all I basically have to do is change one line, and hopefully this is just a `makepkg` away ...

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

rpcameron wrote:I think I may have stumbled upon the reason why my builds didn't seem to work: I only have aarch64-linux-gnu toolchains, not aarch64-none-elf. So, I'm currently building an aarch64-none-elf toolchain on my main x86_64 machine for a cross-compile. Hopefully this will get me one step closer. (I guess I should be thankful that the Arch PKGBUILDs for binutils and gcc use a $_target variable at the head to specify the triple, so all I basically have to do is change one line, and hopefully this is just a `makepkg` away ...
I'm not using arch, I use buildroot to genreate my images, there I use a gcc based toolchain, my uboot works, the issue is that the kernel does get loaded.
not sure how aarch64-none-elf is related.
further more, hk's buildroot uses gcc based toolchain and it works great.

rpcameron
Posts: 278
Joined: Sat Apr 30, 2016 7:24 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by rpcameron »

I'll give it another try now that 2017.09 final is out. It could be some typo I made while combining all of the proprietary bits into the final image, who knows ...

AdrianB
Posts: 11
Joined: Thu Aug 31, 2017 5:03 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by AdrianB »

Hi all,

After success to boot the new uboot, now I'm facing another issue: I can't boot any of my installed kernels, even the original 3.14.x version.
If I'm loading vmlinuz + uinitrd or initrd + dtb the booti command complains about uinitrd/initrd format.
If I'm loading uImage + initrd/uinit + dtb and try to use bootm command the result is that the uboot says there is no ARM64 magic.

Trying to boot without uinitrd or initrd (booti ${kernel_loadaddr} - ${dtb_loadaddr} ) I got a message: Starting kernel image ... (or something like this) and that's it. Even I've added to bootargs to output to the serial console.

Any ideas?

AdrianB
Posts: 11
Joined: Thu Aug 31, 2017 5:03 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by AdrianB »

Hi,

Coming back with some news. Today I success to boot the Kernel 4.12. Is starting but I can't find the root fs yet. I think the compiled kernel it has something missing because I can't see in /dev the mmc blocks.
Anyway, for people which wants to give a try with latest U-boot + GRUB EFI ARM64 and Kernel 4.x here is the boot.ini configuration in /boot/boot.ini:

Code: Select all

ODROIDC2-UBOOT-CONFIG

# Possible screen resolutions
# Uncomment only a single Line! The line with setenv written.
# At least one mode must be selected.

# 480 Lines (720x480)
# setenv m "480i60hz" # Interlaced 60Hz
# setenv m "480i_rpt" # Interlaced for Rear Projection Televisions 60Hz
# setenv m "480p60hz" # 480 Progressive 60Hz
# setenv m "480p_rpt" # 480 Progressive for Rear Projection Televisions 60Hz

# 576 Lines (720x576)
# setenv m "576i50hz" # Interlaced 50Hz
# setenv m "576i_rpt" # Interlaced for Rear Projection Televisions 50Hz
# setenv m "576p50hz" # Progressive 50Hz
# setenv m "576p_rpt" # Progressive for Rear Projection Televisions 50Hz

# 720 Lines (1280x720)
# setenv m "720p50hz" # 50Hz
# setenv m "720p60hz" # 60Hz

# 1080 Lines (1920x1080)
# setenv m "1080i60hz" # Interlaced 60Hz
setenv m "1080p60hz" # Progressive 60Hz
# setenv m "1080i50hz" # Interlaced 50Hz
# setenv m "1080p50hz" # Progressive 50Hz
# setenv m "1080p24hz" # Progressive 24Hz

# 4K (3840x2160)
# setenv m "2160p30hz"    # Progressive 30Hz
# setenv m "2160p25hz"    # Progressive 25Hz
# setenv m "2160p24hz"    # Progressive 24Hz
# setenv m "smpte24hz"    # Progressive 24Hz SMPTE
# setenv m "2160p50hz"    # Progressive 50Hz
# setenv m "2160p60hz"    # Progressive 60Hz
# setenv m "2160p50hz420" # Progressive 50Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it)
# setenv m "2160p60hz420" # Progressive 60Hz with YCbCr 4:2:0 (Requires TV/Monitor that supports it)

### VESA modes ###
# setenv m "640x480p60hz"
# setenv m "800x480p60hz"
# setenv m "800x600p60hz"
# setenv m "1024x600p60hz"
# setenv m "1024x768p60hz"  
# setenv m "1280x800p60hz"
# setenv m "1280x1024p60hz"
# setenv m "1360x768p60hz"
# setenv m "1366x768p60hz"
# setenv m "1440x900p60hz"
# setenv m "1600x900p60hz"
# setenv m "1600x1200p60hz"
# setenv m "1680x1050p60hz"
# setenv m "1920x1200p60hz"
# setenv m "2560x1440p60hz"
# setenv m "2560x1600p60hz"
# setenv m "2560x1080p60hz"
# setenv m "3440x1440p60hz"
	
# CEC Enable/Disable
setenv cec "cecf"

# HDMI BPP Mode
# setenv m_bpp "32"
setenv m_bpp "24"
# setenv m_bpp "16"

# HDMI DVI/VGA modes
# Uncomment only a single Line! The line with setenv written.
# At least one mode must be selected.
# setenv vout "dvi"
# setenv vout "vga"

# Meson Timer
# 1 - Meson Timer
# 0 - Arch Timer
# Using meson_timer improves the video playback whoever it breaks KVM (virtualization).
# Using arch timer allows KVM/Virtualization to work however you'll experience poor video
setenv mesontimer "0"

# Server Mode (aka. No Graphics)
# Setting nographics to 1 will disable all video subsystem
# This mode is ideal of server type usage. (Saves ~300Mb of RAM)
setenv nographics "0"

# CPU Frequency / Cores control
###########################################
### WARNING!!! WARNING!!! WARNING!!!
# Before changing anything here please read the wiki entry: 
# http://odroid.com/dokuwiki/doku.php?id=en:c2_set_cpu_freq
#
# MAX CPU's
# setenv maxcpus "1"
# setenv maxcpus "2"
# setenv maxcpus "3"
setenv maxcpus "4"

# MAX Frequency
# setenv max_freq "2016"  # 2.016GHz
# setenv max_freq "1944"  # 1.944GHz
# setenv max_freq "1944"  # 1.944GHz
# setenv max_freq "1920"  # 1.920GHz
# setenv max_freq "1896"  # 1.896GHz
# setenv max_freq "1752"  # 1.752GHz
# setenv max_freq "1680"  # 1.680GHz
# setenv max_freq "1656"  # 1.656GHz
setenv max_freq "1536"  # 1.536GHz

# Boot Arguments
setenv bootargs ""

# Booting
setenv dtb_loadaddr	"0x01000000"
setenf grub_loadaddr	"0x11000000"

setenv dtb_file "/boot/dtb-4.12.9-arm64/amlogic/meson-gxbb-odroidc2.dtb" # Set to your DTB
setenv grub_file "/EFI/debian/grubaa64.efi"

### Load GRUB efi ARM64
load mmc 0:1 ${grub_loadaddr} ${grub_file}
load mmc 0:2 ${dtb_loadaddr} ${dtb_file}

### Boot GRUB EFI
bootefi ${grub_loadaddr} ${dtb_loadaddr}
Also you need to create a FAT32 partition on SD (I've created 256MB partition) marked as ESD (EFI) and mount it to /boot/efi. Then I've installed grub-efi-arm64 and grub-efi-arm64-bin.
Then doing an grub-install will create the /boot/grub/arm64-efi dir and /boot/efi/EFI/debian/grubaa64.efi.
Also update-grub will create a /boot/grub/grub.cfg will all images on your disk.
Then I've booted the Kernel. Now remains only the kernel issues that is not finding /dev/mmcblk0
Hope those steps are good tutorials for others. I was inspired from here: https://www.cnx-software.com/2016/08/11 ... platforms/

Kind regards,
Adrian

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

I'm still trying to get latest uboot to boot hk stock kernel, have you been able to do so?

AdrianB
Posts: 11
Joined: Thu Aug 31, 2017 5:03 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Odroid C2 mainline U-boot support

Post by AdrianB »

Hi daggs,

In the end I've was able to boot GRUB EFI AA64. After booting GRUB as SBL (secondary bootloader) from Uboot, the rest is history. I'm not using Uboot to boot kernel directly. I like GRUB much more and the automatic script from Debian is doing the job very good.

daggs
Posts: 229
Joined: Tue Mar 22, 2016 6:34 pm
languages_spoken: english, spanish
ODROIDs: odroid c2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Odroid C2 mainline U-boot support

Post by daggs »

Greetings Adrian,
AdrianB wrote:Hi daggs,

In the end I've was able to boot GRUB EFI AA64. After booting GRUB as SBL (secondary bootloader) from Uboot, the rest is history. I'm not using Uboot to boot kernel directly. I like GRUB much more and the automatic script from Debian is doing the job very good.
I've decided to stop try to get the hk kernel to work with the mainline uboot and focus on mainline kernel + mainline uboot which works.
imho, there is no way to boot hk's kernel in mainline uboot without some serious investigation.
unfortunately, I have no time to do that.

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

Re: Odroid C2 mainline U-boot support

Post by brad »

Neil has pushed HDMI into uboot mainline although I am yet to try it. Should now allow for a custom boot menu to be developed to select various boot configs at boot time.

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest