Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
printing to screen from arm kernel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Oct 18, 2017 6:26 pm    Post subject: printing to screen from arm kernel Reply with quote

Greetings,

I have a image that I try to boot via uboot, I verified that the uboot does everything it should and it does, the issue is that the kernel does boot.
I want to test the asm part of the kernel, see if it even gets to there, how can I print in asm on arm64 a char to screen?

thanks.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Thu Oct 19, 2017 5:07 am    Post subject: Re: printing to screen from arm kernel Reply with quote

Hi,

DaggyStyle wrote:
...the issue is that the kernel does boot...


Does it boot or not?

What do you mean with "asm": assembler?

Whats the hardware you have. I have u-boot on a cubietruck with sd and i had to reconfigure the boot.scr to show up the kernel messages on the standard vga/hdmi console.

greets, bb
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Oct 20, 2017 6:51 am    Post subject: Reply with quote

Greetings,

the board is an odroidc2, I compile the code locally on my desktop and then deploy it on the board.
it doesn't boots, here is the output I see:
Code:
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 ...

I use uboot-2017.07, the partition layout is a fat boot partition followed by a ext4 root partition. the output is via serial as at that stage of the boot, there is no console.
when I debugged the issue on uboot, I traced the call to armv8_switch_to_el2 which looks like it is trying to boot the kernel.
I want to see if the issue is with uboot or the kernel.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Fri Oct 20, 2017 3:43 pm    Post subject: Reply with quote

Hi,

you should try to create a new boot.scr of a boot.cmd. I use this for my cubietruck with u-boot to show up the kernel messages via ttyS0 and vga console. You should try to modify this for your needs:

Code:

ext2load mmc 0 0x46000000 uImage
ext2load mmc 0 0x49000000 sun7i-a20-cubietruck.dtb
setenv bootargs console=ttyS0,115200 console=tty0 earlyprintk root=/dev/sda2 rootwait panic=10 ${extra}
setenv video-mode sunxi:1024x768-24@60,monitor=vga,edid=1
bootm 0x46000000 - 0x49000000


I boot of a harddrive after kernel load. You can create a new boot.scr out of this boot.cmd via the following command:

Code:

mkimage -C none -A arm -T script -d boot.cmd boot.scr


Your current bott.scr can help you get the needed stuff for your boot.cmd if you dont have one:

Code:

$ cat /boot/boot.scr
'V֍ِY��-
ext2load mmc 0 0x46000000 uImage
ext2load mmc 0 0x49000000 sun7i-a20-cubietruck.dtb
setenv bootargs console=ttyS0,115200 console=tty0 earlyprintk root=/dev/sda2 rootwait panic=10 ${extra}
setenv video-mode sunxi:1024x768-24@60,monitor=vga,edid=1
bootm 0x46000000 - 0x49000000
$


I hope this helps debugging a bit ;)

greets, bb
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Sat Oct 21, 2017 11:08 am    Post subject: Reply with quote

Greetings,

I've tried what you are suggesting, here is my bood.cmd:
Code:
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
setenv bootargs console=ttyS0,115200 console=tty0 earlyprintk root=/dev/mmcblk0p2 rootwait panic=10 ${extra}

fatload mmc 0 ${loadaddr} ${kernel_filename}
fatload mmc 0 ${dtb_loadaddr} ${fdt_filename}

bootm ${loadaddr} - ${dtb_loadaddr}


I end up with this output:
Code:
reading Image
13489152 bytes read in 580 ms (22.2 MiB/s)
reading meson64_odroidc2.dtb
29835 bytes read in 3 ms (9.5 MiB/s)
Wrong Image Format for bootm command
ERROR: can't get kernel image!


note that I'm using an image and not uImage .
running booti ${loadaddr} - ${dtb_loadaddr}
leaves me with the same output as mentioned in the first post.
one thing I've noticed, the ouput of base is "Base Address: 0x00000000"
is it logical?

Thanks.

Dagg.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Sun Oct 22, 2017 8:29 am    Post subject: Reply with quote

Hi,

I havent done it this far like you did. Do you have an older running kernel (maybe from a different distro)?. I got my kernel config and all the information I needed for a booting 4.x kernel for my cubietruck from a guy who got it already booting.

If you have a booting kernel from a different distro, you should check the loader address and the entry point address of the kernel. You can get it via file:

Code:

$ file /boot/uImage
/boot/uImage: u-boot legacy uImage, Linux 4.13.7, Linux/ARM, OS Kernel Image (Not compressed), 5405352 bytes, Fri Oct 20 07:56:18 2017, Load Address: 0x40008000, Entry Point: 0x40008000, Header CRC: 0xE1031E61, Data CRC: 0xBA5B9A6D
$


Im not sure if you can directly boot an Image file or if you need to convert to uImage. But imo it sounds like uImage is an u-boot enabled image ;)

greets, bb
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Mon Oct 23, 2017 11:37 am    Post subject: Reply with quote

Hi,

i downloaded this image and decompressed/checked it for the kernel: https://dl.armbian.com/odroidc2/archive/Armbian_5.33.171007_Odroidc2_Debian_stretch_next_4.13.5.7z

This image includes a uImage as well. So it looks like, you need an uImage as well for booting.

greets, bb
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Oct 27, 2017 11:02 am    Post subject: Reply with quote

ok, tried uImage, didn't worked, see some outputs:
Code:
dagg@NCC-5001-D ~/workspace/buildroots/buildroot-odroidc2-uboot-upstream $ file output/images/uImage
output/images/uImage: u-boot legacy uImage, linux, Linux/ARM 64-bit, OS Kernel Image (Not compressed), 13489152 bytes, Wed Oct 25 20:58:43 2017, Load Address: 0x01080000, Entry Point: 0x01080000, Header CRC: 0x18F16B3D, Data CRC: 0x04047AA0
dagg@NCC-5001-D ~/workspace/buildroots/buildroot-odroidc2-uboot-upstream $ cat board/hardkernel/odroidc2/boot.cmd
setenv loadaddr "0x01080000"
setenv dtb_loadaddr "0x01000000"
#setenv initrd_high "0xffffffff"
#setenv fdt_high "0xffffffff"
setenv kernel_filename uImage
setenv fdt_filename meson64_odroidc2.dtb
setenv bootargs console=ttyS0,115200 console=tty0 earlyprintk root=/dev/mmcblk0p2 rootwait panic=10 ${extra}

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

bootm ${loadaddr} - ${dtb_loadaddr}


did I got it wrong?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Oct 27, 2017 12:19 pm    Post subject: Reply with quote

I've tested the image you've suggested, it uses kernel 4.13.x with u-boot 2015.01 (vendor's version) while I'm trying to run kernel 3.14 (vendor's version) with latest uboot.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Sat Oct 28, 2017 8:14 am    Post subject: Reply with quote

got an idea, I'll try setup a netboot and see if it boots, I know the maintainer of the relevant code in uboot works with netboot.
will update when I have more info
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri Nov 03, 2017 9:32 am    Post subject: Reply with quote

continuing here, got the tftp to work and I get this:
Code:
fatinfo mmc 0:1
Interface:  MMC
  Device 0: Vendor: Man 000074 Snr 8291a601 Rev: 4.2 Prod: USDU1
            Type: Removable Hard Disk
            Capacity: 7487.0 MB = 7.3 GB (15333376 x 512)
Filesystem: FAT16 "NO NAME    "
=> fatinfo mmc 0 
Interface:  MMC
  Device 0: Vendor: Man 000074 Snr 8291a601 Rev: 4.2 Prod: USDU1
            Type: Removable Hard Disk
            Capacity: 7487.0 MB = 7.3 GB (15333376 x 512)
Filesystem: FAT16 "NO NAME    "
=> setenv autoload no
=> setenv ipaddr 10.0.0.218
=> setenv dtb_loadaddr "0x01000000"
=> setenv fdt_filename meson64_odroidc2.dtb
=> setenv bootargs console=ttyS0,115200 console=tty0 earlyprintk root=/dev/mmcblk0p2 rootwait panic=10
=> fatload mmc 0:1 ${dtb_loadaddr} ${fdt_filename}
reading meson64_odroidc2.dtb
29835 bytes read in 3 ms (9.5 MiB/s)
=> dhcp
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 10.0.0.218 (4 ms)
=> setenv loadaddr "0x01080000"
=> setenv kernel_filename Image
=> setenv serverip 10.0.0.1                                                                           
=> tftp ${loadaddr} ${kernel_filename}
Speed: 1000, full duplex
Using ethernet@c9410000 device
TFTP from server 10.0.0.1; our IP address is 10.0.0.218
Filename 'Image'.
Load address: 0x1080000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #########
         14.6 MiB/s
done
Bytes transferred = 13489152 (cdd400 hex)
=> booti
FDT and ATAGS support not compiled in - hanging
### ERROR ### Please RESET the board ###


ideas?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Fri Nov 03, 2017 8:52 pm    Post subject: Reply with quote

Hi,

have a look here: http://rglinuxtech.com/?p=1728

it looks like, you need to add the dtb file for booting as well.

greets, bb
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Sat Nov 04, 2017 6:11 am    Post subject: Reply with quote

actually, late last night I did that too, same behavior.
I suspect that latest uboot and kernel 3.14.x aren't compatible... is this possible?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Sat Nov 04, 2017 8:40 am    Post subject: Reply with quote

Hi,

i dont know whether there is a compatibilty issue with kernel and u-boot versions. Can you try a more recent kernel. Maybe if you extract one from the arch or ubuntu archives.

if this board wouldnt be this expensive, i would directly buy one to test out by myself :D

greets, bb
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Sat Nov 04, 2017 5:56 pm    Post subject: Reply with quote

there is support for the board from kernel 4.10 and one if I'm not mistaken but it is partial at best.
for example, there is no real support for the gpu.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Mon Nov 06, 2017 6:27 am    Post subject: Reply with quote

Yeah, that like on the cubietruck. It just depends on what you are using the system for. I used my cubietruck as print/scanserver in the past, so no graphic needed. But for testing it should be good. You could even try to compile an older version of u-boot, which can do tftp and can handle older kernels ;)

greet, bb
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum