Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
networking issue on a banana pi [SOLVED]
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Sun Nov 06, 2022 4:02 pm    Post subject: Reply with quote

Okay, I've turned on all the options I can find that include "HDMI" with menuconfig, recompiled, and still a blank screen. I checked the timestamp on spl/u-boot-spl.bin, and it was rebuilt.

This article is interesting but confusing

http://linux-sunxi.org/U-Boot#Boot

The section on SD cards refers to boot.cmd and boot.scr, which didn't come with tarball from the tutorial. It's the section on NAND installation that talks about uEnv.txt, however based on context and experimentation it seems like uEnv.txt is needed regardless of the installation media.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Sun Nov 06, 2022 6:19 pm    Post subject: Reply with quote

I may have found something :o
uEnv.txt:
#Uncomment/set below if in u-boot you need to input something and kerboard not working.
## usb start
#Below enable uboot hdmi device
video-mode=sunxi:1024x768-24@60,monitor=hdmi,hpd=0,edud=1
stdout=serial,vidconsole
stdin=serial,usbkbd
...
...
...


I think the keys are video-mode, that tell u-boot use sunxi driver for a monitor and stdout which direct output to video.

The different between uEnv.txt and script.bin(boot.cmd) is
  • uEnv.txt -- set u-boot runtime environment variables that can be reference by u-boot commands.
  • script.bin(boot,cmd) -- record u-boot execution sequence steps.
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Mon Nov 07, 2022 12:10 am    Post subject: Reply with quote

I added those lines to uEnv.txt. The new kernel still gave me a blank screen, and the old working kernel booted as normal, but the first lines I saw were from the kernel. I never saw the uboot screen, or any uboot info.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Mon Nov 07, 2022 11:52 am    Post subject: Reply with quote

jyoung wrote:
I added those lines to uEnv.txt. The new kernel still gave me a blank screen, and the old working kernel booted as normal, but the first lines I saw were from the kernel. I never saw the uboot screen, or any uboot info.

This is under mainline u-boot? My post are for mainline u-boot.

EDIT: please also share your u-boot's .config content
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Tue Nov 08, 2022 1:39 am    Post subject: Reply with quote

I tried both the working and the mainline uboot. Here's the .config for uboot.

https://pastebin.com/XH7vPupy
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Tue Nov 08, 2022 10:34 am    Post subject: Reply with quote

jyoung wrote:
I tried both the working and the mainline uboot. Here's the .config for uboot.

https://pastebin.com/XH7vPupy
This pastebin seems expired or is wrong.

Thanks
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Thu Nov 10, 2022 3:22 am    Post subject: Reply with quote

Hmm, weird, pastbin doesn't want to let me share this unless I'm logged in. This should work

http://pastebin.com/Xv8NYX7R
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Thu Nov 10, 2022 1:57 pm    Post subject: Reply with quote

jyoung wrote:
Hmm, weird, pastbin doesn't want to let me share this unless I'm logged in. This should work

http://pastebin.com/Xv8NYX7R
I got it. I will review it and let you know,
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Thu Nov 10, 2022 4:21 pm    Post subject: Reply with quote

One item that I've spotted that might be a cause is

Code:
CONFIG_SYS_BOOTM_LEN=0x800000


I think that is this is the maximum allowed size of the kernel in bytes. If that's correct, this could be the cause, since the kernel I've been using is around 11MB.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Thu Nov 10, 2022 5:22 pm    Post subject: Reply with quote

OK, thanks for the information.

Currently I am reviewing u-boot source, I am guessing the Banadapi_defconfig may having missing something critical.

Beside u-boot, linux configuration is yet another separated issues.

This is what I thinking, there are two issues,
  1. u-boot not function correct
  2. linix kernel not function correct


It is possible linux kernel not function correctly because u-boot does not passion right information, therefor I am first checking u-boot. however if you wish to get just old u-boot work with gentoo kernel, please let me know. for this it is possible you need to use an older kernel code.

Did you purchase a USB to serial cable? because so far it looks to me if the u-boot mainline configured correctly something should display on the hdmi device. I guess it is because u-boot is not actually start that is reason we not seeing anything. It would be nice to see something from u-boot to understand where it hung.
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Thu Nov 10, 2022 8:30 pm    Post subject: Reply with quote

I have purchased the serial cable, and it should arrive in several days.

I think it would be fine to use the old u-boot if it can work with a new kernel.

I'm going to try rebuilding u-boot with an increased SYS_BOOTM_LEN=0x800000, and see if that helps. If not, I'm going to recompile the new kernel with some options turned off in menuconfig, in order to get it under 8MB. Any suggestions on which options would produce the biggest gains in size without affecting a BPI?
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Fri Nov 11, 2022 12:35 am    Post subject: Reply with quote

I need to stop and will resume tomorrow, just share finding so far,

This is for mainline u-boot.

It looks like you need to change uEnv.txt to boot.env. Based on your .config at line #972.

I am not yet sure if boot.scr is needed for your mainline u-boot build. this is because line #460 in your .config have CONFIG_BOOTCOMMAND="run distro_bootcmd" which is a predefined way of boot sequence. So may be try to rename boot.scr to boot.scr.orig to test if without this file make any difference.

the boot,env maybe only need this line "video-mode=sunxi:1024x768-24@60,monitor=hdmi,hpd=0,edud=1" reset should be remove. it is possible even video-mode need not be set.

I hope tomorrow I can gain more clarity in u-boot code to be able to give more coherence instructions. Currently too much information overload my mind, I may have missing something important that I should mention.

p.s. unless you build a uImage size larger than 8MB you don't need to change CONFIG_SYS_BOOTM_LEN
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Fri Nov 11, 2022 10:23 pm    Post subject: Reply with quote

The mainline kernel uImage that I've been working with is around 11MB, so this may be an issue. However, when I went into menuconfig to rebuild u-boot with a larger SYS_BOOTM_LEN, I saw a note that this value actually 800000, and also that it is in hex. 0x800000 translates to 8388608 bytes. I've rebuilt the mainline kernel after switching off several components to get it down to 7553600 bytes, but still only a blank screen.

I also tried renaming boot.scr, with both the mainline u-boot and also with the u-boot from the working setup but with the new kernel. Both gave me a blank screen.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Fri Nov 11, 2022 10:47 pm    Post subject: Reply with quote

quick update,

the video-mode line should be
Code:
video-mode=sunxi_de:1024x768-24@60,monitor=hdmi,hpd=0,edud=1


You will also need to reconfigure and rebuild mainine u-boot. The specific configuration need to enable is CONFIG_DM_VIDEO. It is under "Graphics support" menu and the prompt is "Enable driver model support for LCD/video", This will enable bunch of additional options, but most importantly is it will enable use of "vidconsole".
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Sat Nov 12, 2022 5:32 am    Post subject: Reply with quote

Hmm, I updated the video mode line, and the working setup still works, but it doesn't display a u-boot screen. Then, I recompiled u-boot with that option enabled, burned it to the disk, and was left with the blank screen again.

I'm hoping that we can learn something once the serial adapter arrives.
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Mon Nov 14, 2022 12:40 am    Post subject: Reply with quote

At last, some progress! I found this github, which seems to be a more updated version of uboot.

https://github.com/andy-shev/u-boot

It compiled fully without errors, and produced u-boot-sunxi-with-spl.bin (among other items). This is different, since the tutorial I've mostly been working from

http://wiki.gentoo.org/wiki/Banana_Pi_the_Gentoo_Way#U-Boot

references u-boot-sunxi-with-spl.bin. Previously, I've been writing u-boot-spl.bin to the boot sector, assuming that that file was equivalent,but I'm wondering now if that was actually true. Now, when I write u-boot-sunxi-with-spl.bin to the boot sector

Code:
dd if= u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8


and reboot, I actually get a uboot prompt through the HDMI! Ironically, the USB adapter arrived in the mail today, so we can still access the old uboot through the serial port as we'd planned, if that would provide useful information.

Now that I can actually see what's going on, here is the error that uboot is producing:

Code:
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...


Apparently this new version of uboot needs an environment file, which is not uEnv.txt. The github page doesn't explain this, as far as I can tell, and the general state of other documentation is scattered. For example, there is no mention of this in the tutorial, presumably because it's working from an older version of uboot. I tried a couple of things, but eventually hit up on this page

http://bootlin.com/blog/mkenvimage-uboot-binary-env-generator/

Okay, so uboot.env is a binary that's generated from a configuration file. I setup my own uboot-env.txt configuration file based on the contents of uEnv.txt

Code:
bootargs=console=ttyS0,115200 console=tty0 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
bootcmd=tftp 40008000 uImage; bootm


And generated uboot.env with

Code:
mkenvimage -s 0x4200 -o uboot.env uboot-env.txt


Note the -s 0x4200. I'm not sure what to put here. The site describes it as
Quote:
The -s option allows to specify the size of the image to create. It must match the size of the flash area reserved for the U-Boot environment.


Anyhow, it seems that uboot detects and partly accepts this uboot.env file, but something's still not right, since it's now producing the error message

Code:
Loading Environment from FAT... *** Warning - bad CRC, using default environment


Websearching this message produces a few hits, most of which seem to suggest that I abort the auto-load in uboot, configure the environment by hand, and then save the configuration. However, I'm not finding much consistent documentation for the commands available in the uboot shell, and also I don't know what I'd configure differently than is already set in the uboot-env.txt file.

I have tried the old (working) kernel and the modern mainline kernel with this new version of uboot. The results are the same.

Any thoughts?
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Mon Nov 14, 2022 1:31 am    Post subject: Reply with quote

uboot.env does not need to binary.

I just realise I made mistake in my previous port, I have stated that
pingtoo wrote:
It looks like you need to change uEnv.txt to boot.env. Based on your .config at line #972.
The boot.env should be uboot.env.

I have just finish setting of cross compile tool chain and try to build mainline u-boot to see what is necessary and in progress getting missing config options.

The uboot,env content need to change,[quote="jyoung"]
Code:
bootargs=console=ttyS0,115200 console=tty0 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
bootcmd=tftp 40008000 uImage; bootm
have some error in it, The "bootcmd=tftp 40008000 uImage; bootm" need some work, using tftp you will need to setup network prior to issue that tftp command, and the "bootm" mising argument for where loaded kernel memory address.
the "bootargs=..." most likely will work for your old kernel, Most likely will not work for new kernel.

For your old kernel with new u-boot code, you can try put below in to uboot.env
uboot.env:
bootargs=console=ttyS0,115200 console=tty0 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
aload_script=fatload mmc 0 0x43000000 script.bin;
aload_kernel=fatload mmc 0 0x40008000 uImage; bootm 0x40008000;
bootcmd=run aload_script aload_kernel


I am not convince this will work, however I think it might give you more information.

The "script.bin" is actual Allwinner's version of Device tree (fdt/dt for modern linux)
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Mon Nov 14, 2022 2:09 am    Post subject: Reply with quote

Okay, I've tried taking that content from uEnv.txt and using it for uboot-env.txt, and generating a uboot.env file from there. The same error messaging about a bad CRC up, so no new information.

Should we be using the script.bin that came from the tutorial? A new copy of it wasn't built with the new uboot.

What is a CRC?
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Mon Nov 14, 2022 2:49 am    Post subject: Reply with quote

CRC is https://en.wikipedia.org/wiki/Cyclic_redundancy_check

jyoung wrote:
Should we be using the script.bin that came from the tutorial? A new copy of it wasn't built with the new uboot.
Which tutorial?

What I refer to script.bin is one you used in "old" setting that you were able to boot in to linux. I think it was originally referred in uEnv.txt.

My previous post is just to try using new u-boot but with old setting. that is why I suggest create a new uboot.env (just text file)
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Mon Nov 14, 2022 3:14 am    Post subject: Reply with quote

I think uboot.env needs to be a binary, either generated by mkenvimage or saved from the uboot prompt. I just tried copying the uEnv.txt text file to uboot.env, and it generated the same message about a bad CRC. Based on the fact that uboot is responding the same way to a binary and a text file suggests to me that it's either not reading them or that it's not getting very far before it decides that they're nonsense.

This is the tutorial I've mostly been working from

http://wiki.gentoo.org/wiki/Banana_Pi_the_Gentoo_Way#U-Boot
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Mon Nov 14, 2022 3:21 am    Post subject: Reply with quote

Also, thanks for identifying what CRC means. But, I don't think that that message means much aside from the uboot.env file isn't correct.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Mon Nov 14, 2022 10:47 pm    Post subject: Reply with quote

I feel very silly :oops: it turn out the external env file need to be in binary format. I am sorry I provide wrong infomration.

And the CRC error is just because the uboot.env need a CRC header, when it is text only it miss that CRC header. Also you cannot just calulate a CRC and prepend to the text file because u-boot expect each line seperater is '\0' not '\n' so you do need to use tools/mkenvimage to create a binary file.

Please note, the uboot.env is not automatically loaded by the default bootcmd, it will require some effort in tp modify code to do auto load.

The good news you may not need the uboot.env binary because the default u-boot build included in environment variable of "bootcmd" which will perform as following
Code:
in uboot.bin
  bootcmd=run distro_bootcmd
  bootdelay=2
  preboot=usb start

  distro_bootcmd=scsi_need_init=; for target in ${boot_targets}; do run bootcmd_${target}; done
   boot_targets=fel mmc0 scsi0 usb0 pxe dhcp
    bootcmd_mmc0=devnum=0; run mmc_boot
     mmc_boot=if mmc dev ${devnum};\
              then devtype=mmc;\
                   run scan_dev_for_boot_part;\
              fi
      scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist;\
              env exists devplist || setenv devplist 1;\
              for distro_bootpart in ${devplist};\
               do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype;\
                   then run scan_dev_for_boot;\
                  fi;\
              done;\
              setenv devplist
       scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...;\
             for prefix in ${boot_prefixes};\
              do run scan_dev_for_extlinux;\
                 run scan_dev_for_scripts;\
             done;\
             run scan_dev_for_efi;
        scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf};\
                  then echo Found ${prefix}${boot_syslinux_conf};\
                   run boot_extlinux;\
                   echo SCRIPT FAILED:\
                   continuing...;\
                  fi
          boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
            boot_syslinux_conf=extlinux/extlinux.conf
        scan_dev_for_scripts=for script in ${boot_scripts};\
                 do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script};\
                     then echo Found U-Boot script ${prefix}${script};\
                     run boot_a_script;\
                     echo SCRIPT FAILED: continuing...;\
                   fi;\
                done
          boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script};\
                  source ${scriptaddr}


This default setting give you two options
  • Using a config file name extlinux/extlinux.conf
  • Use a script file name boot.scr.uimg or boot.scr


the boot.sct is binary can be in IMAGE_FORMAT_FIT (CONFIG_FIT=y) or IMAGE_FORMAT_LEGACY depend on CONFIG_LEGACY_IMAGE_FORMAT=y
can use mkimage -C none -A arm -T script -d boot.cmd boot.scr
boot.cmd:
setenv bootargs console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootwait panic=10
fatload mmc 0 ${kernel_addr_r} gentoo-5.15.74.uimg
fatload mmc 0 ${ramdisk_addr_r} gentoo-initrd-5.15.74.uimg
fatload mmc 0 ${fdt_addr_r} sun7i-a20-bananapi.dtb.uimg
bootm ${kernel_addr_r} [$ramdisk_addr_r}|-] [${fdt_addr_r}]


exlinux.conf example:
default Gentoo linux
prompt 0
timeout 3
label Gentoo linux
  menu title My Gentoo Linux kernel
  kernel gentoo-5.15.74.uimg
  initrd gentoo-initrd-5.15.74.uimg
  fdt sun7i-a20-bananapi.dtb.uimg
  append console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootwait panic=10
For more detail please see https://github.com/u-boot/u-boot/blob/v2022.10/doc/README.pxe#L101

EDIT: use tty1 instead tty0
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Tue Nov 15, 2022 3:02 am    Post subject: Reply with quote

Do you think this needs an initrd? I haven't generated one.
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 467

PostPosted: Tue Nov 15, 2022 3:48 am    Post subject: Reply with quote

What about sun7i-a20-bananapi.dtb.uimg? I have sun7i-a20-bananapi.dtb. This almost sounds like something we'd generate with mkimage, but it doesn't look like mkimage can generate dtb or fdt images.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Tue Nov 15, 2022 12:09 pm    Post subject: Reply with quote

jyoung wrote:
Do you think this needs an initrd? I haven't generated one.
You don't have to use one. I place there as example in case you are using.

jyoung wrote:
What about sun7i-a20-bananapi.dtb.uimg? I have sun7i-a20-bananapi.dtb. This almost sounds like something we'd generate with mkimage, but it doesn't look like mkimage can generate dtb or fdt images.
From the source code it looks to me it need a file in uimage format aka, mkimage ... but I am not very sure about that, you can try to start without place it directly, if kernel not able to boot then you can try to use mkimage to convert it.
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
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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