avafinger / nanopi-m4-ubuntu-base-minimal

Nanopi M4 RK3399 base minimal image for development (mali fbdev / gbm) - Camera support
53 stars 10 forks source link

after flash sd and reboot then can't see anything on screen with hdmi #1

Closed oiramario closed 5 years ago

oiramario commented 5 years ago

at first, thanks for your work! my nanopi M4 was working with firefly fireware. i followed your steps, and flash is fine, but the screen(hdmi) is black after reboot. pls give your advice. thanks!

avafinger commented 5 years ago

Do you see the heartbeat on the board? The screen video enters in sleep mode if nothing is typed on the keyboard.

Try this:

a) Hit ENTER twice right after boot

b) Use this DTB (rk3399-nanopi4-rev01.dtb attached) The reason for this new dtb is that on v1.1 you have a dual header monitor and HDMI is the second monitor, even if eDP LCD is not attached. So the main screen is the LCD which is not attached.

rk3399-nanopi4-rev01.dtb.zip

overwritte the one in your /boot

oiramario commented 5 years ago

Only one HDMI screen I have. I cannot see the heartbeat on the board after boot. a) is no useful. b) I tried to overwrite the file attached, still not work. I even tried v1.0. :(

avafinger commented 5 years ago

If you don't see the heartbeat I strongly suggest you try with another SD card. It means the kernel was not loaded. Chances are you have a BAD sd card.

oiramario commented 5 years ago

I flash firefly fireware back with the same SD card, it's worked. I tried flash with SD card and emmc, cannot work both of them. :( anything wrong with it?

oiramario commented 5 years ago

could you please make an img with them? so i can use win32diskimager with it.

avafinger commented 5 years ago

ok. i will.

Just a question, do you try to boot from SD card with eMMC attached?

oiramario commented 5 years ago

M4 boot first with SD card, second with eMMC. I tried both of them without another attached.

avafinger commented 5 years ago

hmm, looks weird.. you should boot with no eMMC attached. The boot sequence is for the SD card. I will provide the IMG asap but this scenario does not look promising.

If you are an experienced user/developer you could attach a USB-debug (minicom 1500000 8N1 | NOR | Minicom 2.7 | VT102 | Offline) and grab the boot log.

BTW, don't know about yout firefly fireware

oiramario commented 5 years ago

Oops... it's firmware. just like this: rk3399-sd-friendlydesktop-bionic-4.4-arm64-YYYYMMDD.img.zip

avafinger commented 5 years ago

Can you tell how did you flash sd card and eMMC?

oiramario commented 5 years ago

1 2 3 Screenshots attached.

avafinger commented 5 years ago

Ok, it's fine, but this snapy thing that ubuntu 18.04 creates (/dev/loopxx everywhere ) is something to blame, but since you say img works, let's try that then and hope it will work.

avafinger commented 5 years ago

Just to be clear about the snap mention. /boot should be /dev/sdc1 and not /dev/loop17

While img is not ready and if you can try to flash it in another Linux box (without the snap & /dev/loopxx) woul be great.

oiramario commented 5 years ago

Yesterday I'm working on VMware workstation. And now it's worked when I flash it to SD card on another Linux box. Great!!! However I tested to flash to eMMC that cannot work yet. I think IMG is necessary.

avafinger commented 5 years ago

How did you try to flash to eMMC? I think there is a special partition to load the BSP kernel (BSP u-boot and BSP kernel from the manufacturer) and that needs to be wiped out, but if you do you will not be able to boot with the manufacturer img again without restoring this bootloader part and for that, you need Rockchip tool.

Here is the img you can try out: https://mega.nz/#!YLZhlYJb!uqvCIjpeBoGyfhaNYPJwb67kma7wmGTn5ZObe-CPrb4

Technically there is no difference in using the ,/flash_sd.sh and img, with some advantages to the flash_sd.sh that writes only 800MB and img will write 800MB plus 7.2GB of zeros, that means the script is 3x faster and burn less. (in theory only).

You can try the img and see how it goes. If it does not work and you decide to wipe out the eMMC you should be sure you can see the eMMC partitions from a clean sd boot before you wipe out eMMC contents.

oiramario commented 5 years ago

Boot Linux from SD card and flash it to eMMC attached on nanopi M4. sudo ./flash_sd.sh /dev/mmcblk1 (on M4, SD card is mmcblk0, eMMC is mmcblk1).

Before try flash the img, one more thing... Without the rk3399-nanopi4-rev01.dtb you attached above, screen shows double shift when run glesmark. My suggestion is update it within next release. 191568143 924891083

avafinger commented 5 years ago

I did this to Release v1.3 , there is Kodi already installed.

One more thing to note is /etc/fstab, rootfs points to /dev/mmcblk0p2 , maybe you flash again to eMMC as you did and before reboot, you edit the file (in eMMC partition) and change it to /dev/mmcblk1p2 and then sync and reboot. I think it will work!

oiramario commented 5 years ago

Using the ,/flash_sd.sh and img for Kodi v1.3 and minimalI v1.1 I tested that is work only to SD card. But I cannot see the eMMC attached when type df -h. I will try the method you suggested.

One more thing... Would you please provide the GBM/DRM to me? I need them to cross-compile for implement zero-copy in ogles.

avafinger commented 5 years ago

But I cannot see the eMMC attached when type df -h.

what you see on : ls /dev/mmcblk* ? when booted with v1.1 and v1.3?

v1.3 has mali with support for gbm, i did not build any gbm / drm support at all, it is all in mali (closed source). If you want to get into that level you can try Panfrost but seems you will need to compile that specific kernel with their mesa driver.

egl_winsys_get_implementation_gbm
gbm_device_get_fd
gbm_device_get_backend_name
gbm_device_is_format_supported
gbm_create_device
gbm_device_destroy
gbm_bo_create
gbm_bo_import
gbm_bo_get_width
gbm_bo_get_height
gbm_bo_get_stride
gbm_bo_get_format
gbm_bo_get_device
gbm_bo_get_handle
gbm_bo_get_fd
gbm_bo_write
gbm_bo_set_user_data
gbm_bo_get_user_data
gbm_bo_ref
gbm_bo_unref
gbm_bo_destroy
gbm_surface_create
gbm_surface_lock_front_buffer
gbm_surface_nolock_front_buffer
gbm_surface_release_buffer
gbm_surface_has_free_buffers
gbm_surface_destroy

if you need them it is in /usr/rk3399-libs/lib64 (v1.3)

oiramario commented 5 years ago

How did you compile the kmscube from https://github.com/robclark/kmscube.git? Some macro do not defined in the gbm.h in rk3399.

[build] Starting build [proc] Executing command: /usr/local/bin/cmake --build /home/oiram/program/arm_ogles/build --config Debug --target all -- -j 6 [build] [ 9%] Building C object CMakeFiles/armogles.dir/cube-tex.c.o [build] /home/oiram/program/arm_ogles/cube-tex.c: In function ‘get_fd_rgba’: [build] /home/oiram/program/arm_ogles/cube-tex.c:230:67: error: ‘GBM_BO_USE_LINEAR’ undeclared (first use in this function); did you mean ‘GBM_BO_USE_WRITE’? [build] bo = gbm_bo_create(gl.gbm->dev, texw, texh, GBM_FORMAT_ABGR8888, GBM_BO_USE_LINEAR); [build] ^~~~~ [build] GBM_BO_USE_WRITE [build] /home/oiram/program/arm_ogles/cube-tex.c:230:67: note: each undeclared identifier is reported only once for each function it appears in [build] /home/oiram/program/arm_ogles/cube-tex.c:232:8: warning: implicit declaration of function ‘gbm_bo_map’; did you mean ‘gbm_bo_ref’? [-Wimplicit-function-declaration] [build] map = gbm_bo_map(bo, 0, 0, texw, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data); [build] ^~~~~~ [build] gbm_bo_ref [build] /home/oiram/program/arm_ogles/cube-tex.c:232:41: error: ‘GBM_BO_TRANSFER_WRITE’ undeclared (first use in this function); did you mean ‘GBM_BO_USE_WRITE’? [build] map = gbm_bo_map(bo, 0, 0, texw, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data); [build] ^~~~~ [build] GBM_BO_USE_WRITE [build] /home/oiram/program/arm_ogles/cube-tex.c:238:2: warning: implicit declaration of function ‘gbm_bo_unmap’; did you mean ‘gbm_bo_unref’? [-Wimplicit-function-declaration] [build] gbm_bo_unmap(bo, map_data); [build] ^~~~ [build] gbm_bo_unref [build] /home/oiram/program/arm_ogles/cube-tex.c: In function ‘get_fd_y’: [build] /home/oiram/program/arm_ogles/cube-tex.c:265:46: error: ‘GBM_FORMAT_R8’ undeclared (first use in this function); did you mean ‘GBM_FORMAT_C8’? [build] bo = gbm_bo_create(gl.gbm->dev, texw, texh, GBM_FORMAT_R8, GBM_BO_USE_LINEAR); [build] ^~~~~ [build] GBM_FORMAT_C8 [build] /home/oiram/program/arm_ogles/cube-tex.c:265:61: error: ‘GBM_BO_USE_LINEAR’ undeclared (first use in this function); did you mean ‘GBM_BO_USE_WRITE’? [build] bo = gbm_bo_create(gl.gbm->dev, texw, texh, GBM_FORMAT_R8, GBM_BO_USE_LINEAR); [build] ^~~~~ [build] GBM_BO_USE_WRITE [build] /home/oiram/program/arm_ogles/cube-tex.c:267:41: error: ‘GBM_BO_TRANSFER_WRITE’ undeclared (first use in this function); did you mean ‘GBM_BO_USE_WRITE’? [build] map = gbm_bo_map(bo, 0, 0, texw, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data); [build] ^~~~~ [build] GBM_BO_USE_WRITE [build] /home/oiram/program/arm_ogles/cube-tex.c: In function ‘get_fd_uv’: [build] /home/oiram/program/arm_ogles/cube-tex.c:300:50: error: ‘GBM_FORMAT_GR88’ undeclared (first use in this function); did you mean ‘GBM_FORMAT_BGR888’? [build] bo = gbm_bo_create(gl.gbm->dev, texw/2, texh/2, GBM_FORMAT_GR88, GBM_BO_USE_LINEAR); [build] ^~~~~~~ [build] GBM_FORMAT_BGR888 [build] /home/oiram/program/arm_ogles/cube-tex.c:300:67: error: ‘GBM_BO_USE_LINEAR’ undeclared (first use in this function); did you mean ‘GBM_BO_USE_WRITE’? [build] bo = gbm_bo_create(gl.gbm->dev, texw/2, texh/2, GBM_FORMAT_GR88, GBM_BO_USE_LINEAR); [build] ^~~~~ [build] GBM_BO_USE_WRITE [build] /home/oiram/program/arm_ogles/cube-tex.c:302:45: error: ‘GBM_BO_TRANSFER_WRITE’ undeclared (first use in this function); did you mean ‘GBM_BO_USE_WRITE’? [build] map = gbm_bo_map(bo, 0, 0, texw/2, texh/2, GBM_BO_TRANSFER_WRITE, &stride, &map_data); [build] ^~~~~ [build] GBM_BO_USE_WRITE [build] CMakeFiles/armogles.dir/build.make:88: recipe for target 'CMakeFiles/armogles.dir/cube-tex.c.o' failed [build] make[2]: [CMakeFiles/armogles.dir/cube-tex.c.o] Error 1 [build] make[1]: [CMakeFiles/armogles.dir/all] Error 2 [build] make: *** [all] Error 2 [build] CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/armogles.dir/all' failed [build] Makefile:105: recipe for target 'all' failed [build] Build finished with exit code 2

avafinger commented 5 years ago

It is not implemented in Mali. Remove (comment) the code.

Can you post the **ls /dev/mmcblk*** result? so i can try to write the script for eMMC.

oiramario commented 5 years ago

I'll post the results tomorrow asap.

avafinger commented 5 years ago

To be able to run kmscube:

wget https://github.com/avafinger/nanopi-m4-ubuntu-base-minimal/releases/download/kmscube_gbm_v1/kmscube sudo chmod +x kmscube

then: ./kmscube

oiramario commented 5 years ago

kodi v1.3 running on 16G SD card and 16G eMMC attached.

shot

avafinger commented 5 years ago

Okay, you could try this:

You could do it with v1.1 which is lighter than v1.3..

avafinger commented 5 years ago

All instructions above assume you booted from SD CARD with eMMC attached, and not using an emmc adapter. If you use emmc adapter just edit the /etc/fstab on the emmc and changed it.

oiramario commented 5 years ago

x

avafinger commented 5 years ago

Ok, unfortunately, bootloader looks for Android /boot style. We need to clean eMMC to get rid of that 3d partition but if something goes wrong you end up needing the RK tools to recover. Let me brush up the process and you could try again.

oiramario commented 5 years ago

The firmware of friendlyarm could be download here: http://download.friendlyarm.com/NanoPiM4. Write the img to SD card with win32diskimager. Insert this card into your board's boot slot and power on. Then it will flash to eMMC. After board has booted I checked etc/fstab in SD card however it's empty. FYI.

oiramario commented 5 years ago

kmscube print "undefined symbol:gbm_create_device" with nanopi-m4-ubuntu-base-minimal v1.1.

oiramario commented 5 years ago

Here is an eMMC flasher images for you: https://drive.google.com/drive/folders/1p02hbz2ongMLnv5fTraKQYtm3VwYVK2e/emmc-flasher-images.tgz

emmc-flasher-images

avafinger commented 5 years ago

you need to setup gbm. the kmscube runs on gbm

Refer: https://github.com/avafinger/nanopi-m4-ubuntu-base-minimal/releases/tag/v1.2.1

sudo apt-get install libjpeg-turbo8 libjpeg8 libpng16-16 libegl1 libegl-mesa0 libpng-dev libjpeg-dev
sudo apt-get install libglu1-mesa libglapi-mesa libgles2-mesa-dev libglu1-mesa-dev libegl1-mesa-dev

sudo apt-get install libgbm-dev

cd /usr/rk3399-libs/lib64/ sudo chmod +x mali-config.sh sudo ./mali-config.sh and set gbm sudo shutdown -h now (wait and power cicle the borad)

Once you setup the gbm mali support you can only run gbm apps and not fbdev only anymore.

2018-12-24-105315_579x387_scrot

oiramario commented 5 years ago

Thanks, I'll try. URL above is https://drive.google.com/drive/folders/1p02hbz2ongMLnv5fTraKQYtm3VwYVK2e and you can download emmc-flasher-images.tgz.

oiramario commented 5 years ago

Now i make everything fine. This issue has been solved. Thanks for your work. :+1:

avafinger commented 5 years ago

How this was solved?

oiramario commented 5 years ago

I wrote my own egl + gbm code test it's worked on your kodi v1.3. While I can do that on mini v1.1 with some apt-get install / dpkg -i / ln -s. I make a cross-compile tool chain in ubuntu 18.04 on x86_64, write code using vscode + cmake + gdbserver for rk3399. Thanks for your work again.

avafinger commented 5 years ago

Glad it worked for you. And how about the eMMC flashing?

avafinger commented 5 years ago

The eMMC booting issue has been fixed!

OS Image and Kodi 18.0 RC5 will be in the v1.8 release.

avafinger commented 5 years ago

Install to eMMC is available at https://github.com/avafinger/nanopi-m4-ubuntu-base-minimal/releases/tag/v1.8

oiramario commented 5 years ago

Awesome! I have successfully burned v1.8 to eMMC. Thanks for your work. :+1: Happy new year! :-)