RobertCNelson / bb-kernel

MIT License
130 stars 102 forks source link

sgx-startup.sh problem with bone-debian-8.7-iot-armhf-2017-03-19-4gb image #40

Closed LucaVs closed 7 years ago

LucaVs commented 7 years ago

I'm using the latest Debian image: bone-debian-8.7-iot-armhf-2017-03-19-4gb image

I followed the instruction from: http://elinux.org/BeagleBoardDebian#SGX_BeagleBone.2FBeagleBone_Black to get SGX available. 1) I installed the latest 4.4 kernel (--bone-kernel --lts-4_4) 2) I installed GFX_5.01.01.02.tar.gz .

It seems there's a problem with sgx-startup.sh . When I reboot the BBB I can't find omaplfb module loaded.

LucaVs commented 7 years ago

After rebooting I executed the following command:

root@beaglebone:~# lsmod | grep omaplfb
(no result)
root@beaglebone:~# sh /etc/init.d/sgx-startup.sh  start
sgx: Starting PVR
/usr/local/bin/pvrsrvctl: SrvInit failed (already initialized?) (err=129)
root@beaglebone:~# lsmod | grep omaplfb
omaplfb                12142  0 
tilcdc                 26645  1 omaplfb
pvrsrvkm              155855  1 omaplfb

now it works. It seems at boot time it can't start itself.

LucaVs commented 7 years ago

I can get SGX properly running by disabling startup execution of sgx-startup.sh

chmod -x sgx-startup.sh

and by adding the following lines to rc.local

sleep 5
sh /etc/init.d/sgx-startup.sh  start

without the sleep it doesn't starts. It probably start too fast at boot time while it should wait for some services to start before...

RobertCNelson commented 7 years ago

this really needs to be converted to a systemd startup script, i bet it's waiting for rootfs to load.. ;)

LucaVs commented 7 years ago

I create a simple service:

[Unit]
  Description=SGX
  [Service]
  ExecStart=/bin/sh /etc/init.d/sgx-startup.sh start
  ExecStop=/bin/sh /etc/init.d/sgx-startup.sh stop
  Restart=on-failure
  RestartSec=10
  User=root
  [Install]
  WantedBy=multi-user.target

but it doesn't load at startup. I get the same error. If I disable service and run it after login

systemctl start sgx-startup.service

it works... what should it wait for?

RobertCNelson commented 7 years ago

in the unit:

After=local-fs.target

Regards,

LucaVs commented 7 years ago

Same error. But I added some log and I get:

modprobe: ERROR: could not insert 'omaplfb': No such device
LucaVs commented 7 years ago

Could it depend on /dev/fb0 not ready at boot time?

LucaVs commented 7 years ago

I confirm, when script execute at boot time there isn't /dev/fb0 available. How can I wait for /dev/fb0 ?

LucaVs commented 7 years ago

I solved by adding a "while" before modprobe :

while [ ! -e /dev/fb0 ]
do
  echo "wait fb0"
  sleep 1
done
modprobe omaplfb
RobertCNelson commented 7 years ago

@LucaVs thanks! merged that (and tested it)

LucaVs commented 7 years ago

:+1: Thanks for your work!

tderensis commented 7 years ago

I just tried following the instructions here: http://elinux.org/BeagleBoardDebian#SGX_BeagleBone.2FBeagleBone_Black

When I check for omaplfb using lsmod, I don't see it. However, I do see pvrsrvkm.

lsmod | grep pvrsrvkm
pvrsrvkm        4379100 0

Looking at the startup script, it looks like you also wait for pvrsrvkm.

while [ ! -d  /sys/class/pvr/pvrsrvkm/ ]
 do
    echo "wait pvrsrvkm"
    sleep 1
 done

It doesn't look like that path exists on my device, so the startup script gets stuck there.

RobertCNelson commented 7 years ago

@tderensis probally didn't install teh bone kernel:

http://elinux.org/BeagleBoardDebian#Mainline_.284.4.x_lts.29

Regards

tderensis commented 7 years ago

Ah, I didn't realize I needed the bone kernel. I currently am using:

Linux beaglebone 4.4.52-ti-r92 #1 SMP Sat Mar 11 01:40:33 UTC 2017 armv7l GNU/Linux

What are the differences between these kernels? I am currently using the Beaglebone Green Wireless and using sleep modes along with an RGB display. Does that kernel still support these features?

RobertCNelson commented 7 years ago

@tderensis the 4.4.x-ti kernel has the new SGX driver stack. It's EGL only, FBDEV got removed. to use it:

sudo apt install ti-sgx-ti335x-modules-`uname -r`
sudo depmod -a `uname -r`
sudo update-initramfs -uk `uname -r`

then this userspace:

git clone -b ti-img-sgx/1.14.3699939 git://git.ti.com/graphics/omap5-sgx-ddk-um-linux.git --depth=1

cd omap5-sgx-ddk-um-linux/

sudo su
export DISCIMAGE=/
export TARGET_PRODUCT=ti335x
make install
exit

#fix: libgbm.so.2 (one line:)
sudo ln -s /usr/lib/arm-linux-gnueabihf/libgbm.so.1 /usr/lib/arm-linux-gnueabihf/libgbm.so.2

sudo modprobe pvrsrvkm
sudo /usr/bin/pvrsrvctl --start --no-module

and that's as far as i've gotten.. your on your own.

tderensis commented 7 years ago

These steps worked to get the pvrsrvkm module installed and the pvrsrvctl program starts. If the new SGX driver stack only supports EGL, then should I be using weston if I want accelerated video using EGL? Or should I be able to use lxqt?

I tried weston, but it fails to start unless I run it with --use-pixman.

tderensis commented 7 years ago

I tried the same way that @LucaVs tried (following this) but the module fails to load on boot. The log output doesn't show much:

Apr 21 15:24:33 beaglebone systemd[1]: Starting LSB: Start daemon at boot time...
Apr 21 15:24:33 beaglebone sgx-startup.sh[716]: sgx: Starting PVR
Apr 21 15:24:34 beaglebone sgx-startup.sh[716]: /usr/local/bin/pvrsrvctl: SrvInit failed (already initialized?) (err=4)
Apr 21 15:24:35 beaglebone systemd[1]: sgx-startup.service: Control process exited, code=exited status=1
Apr 21 15:24:35 beaglebone systemd[1]: Failed to start LSB: Start daemon at boot time.
Apr 21 15:24:35 beaglebone systemd[1]: sgx-startup.service: Unit entered failed state.
Apr 21 15:24:35 beaglebone systemd[1]: sgx-startup.service: Failed with result 'exit-code'.

Starting it afterwards also does not work either. At that point the kernel starts spewing messages. One small difference I noticed is that my GFX that I created is named differently: GFX_5.01.01.02_es8.x.tar.gz. Also running the update_kernel script automatically installs ti-sgx-es8-modules-4.4.61-bone17. I believe this is needed, but I am not entirely sure.