-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newbie friendly, DRM-only opengles, /init tutorial #2
Comments
Greetings @habemus-papadum ! 😃 Yeah, I'll try to put in place several tutorials concerning the installation, and the use of the Mali user-space binary drivers with :
I also have to document how to use the cross-compilation script. Though, the script is now set up to use the default cross-compiler installed on Debian/Ubuntu systems when you do : The hardest part being how to copy the files on your system and boot the new kernel. Generally this involves creating a tarball and send it to your board through SSH, using export YOUR_BOARD_IP=10.100.0.55
cd /tmp/RockMyy-Build
tar cJpvf kernel.tar.xz *
scp kernel.tar.xz $YOUR_BOARD_IP:/tmp
ssh $YOUR_BOARD_IP And then install the files in the tarball, from the board : # On the board, through SSH
cd /tmp
tar Jxpvf kernel.tar.xz
cp -r lib/* /lib/
cp -r usr/* /usr/ Then, for the boot/ files, you'll have to understand how your bootloader is setup. With my setup, I only do : cp boot/* /boot But that only works because I have an extlinux.conf that boots Now my setup is generally incompatible with U-boot scripts, so the user looking to install and test that new kernel will have to tinker the boot files installations depending on the bootloader configuration of its distribution, or forget about kernel updates provided by its distribution. Now, any user wishing to do install a new custom kernel will have to understand how to get a serial connection to the board, and use it to debug issues when the board does not boot anymore. Because that will happen and is generally a source of panic for many users. So better understand how to do that BEFORE attempting to install new kernels that way. For the board, at the moment, I can only recommend using a MiQi, since it's the only board I own and can test thoroughly. I'll try to get my hands on other boards. The Armbian team tried to get some ASUS Tinkerboard samples for me, but ASUS never replied to their requests 😕 . Also, this board requires patches to reboot the system correctly so... yeah... Meanwhile, I've never tested the SDCard boot. It might work on a MiQi but I frankly don't how it will fare. Anyway, yeah, I'm interested in building a documentation and good for collaboration, as long as the documentation stays CC0 or CC-BY 🐱 |
@Miouyouyou I was thinking a little more about this, and here are my latest thoughts linaro tool chain comes with a sysroot, and works well enough on my centos box, and for this project I don't mind being lazy... so the steps would be:
this bzImage is fully self contained and ready to go some questions I'm not sure about --
I plan to play around with things on my end and keep posting notes here. on my todo:
|
ToolchainAs long as the aarch64 toolchain can compile armv7 (32 bits) executables, it's fine. Else, you'll have to also get the usual armv7 (generally named "arm") toolchain from linaro too. Compilation of user-space programsNow, you don't really need to copy the Mali libraries to compile projects. This is nice. But you can also use the Mesa ones, if these are easier to obtain. You could even put placeholders libraries containing only the "right" symbols names with no actual code in them. Note that when you compile, the main purpose of specifying the libraries names is to generate a list of files that will be put in the ELF executable. The whole point of that diatribe is to understand that, the libraries during the compilation and the libraries during the execution can be entirely different, as long as they share the same symbols names. So, you can compile against Mesa libraries and execute with Mali libraries and everything should be fine. Of course, if you can use the Mali ones for both, this will avoid any potential symbol mismatch issue. Kernel compilationNow, I wonder if you can't specify an initrd file to use directly through environment variables interpreted during the kernel compilation itself (Meaning, through environment variables setup by the kernel developers themselves). MAKE_CONFIG=menuconfig bash ./GetPatchAndCompileKernel.sh To get access to menuconfig when compiling with my script. BootingNow, for the boot part... it's always an issue when beginning. DocumentationAnyway, yeah, this will require some trial and error and a documentation, or at least some notes, of these "trials", "errors" and "solutions". Documentation of the potential errors is required to avoid letting new comers in a broken state, which lead people to panic and/or disgust. |
aarch64 -> uh, yeah, I was spacing out, sorry. Will use 32 bit toolchain
fun fact, Apple no longer provides any binaries in the sysroots for all its devices it bundles with Xcode. instead there is a yaml file for each shared lib listing symbols names etc that the system linker knows how to process (each sysroot is still several 100MB...) I thought to use the libmali drivers because it seemed like a pain to to install mesa! -- too big, too many pieces that I don't need (X support, proper opengl, etc) -- Copying over a few libmali libs and headers and wrangling a few symlinks felt much easier... Funny how people see the same thing in almost opposite terms... 😄 initrd -> I don't know about env variables, but I was going to menuconfig because from there you can form the initrd in two parts -- 1) a 'script' which can do things like properly layout /dev devices (/dev/null, etc) without having to call sudo, and 2) path to a local dir (containing app and shared libs) which will be cpio'd into one nice package booting -- ah, booting -- that might be a pain... I should start recording steps sometime next week. |
Well, that makes things clearer and easier to maintain 😃. Yeah, using the mali drivers and just creating symlinks can be way faster than getting the whole Mesa artillery, indeed. Just wanted to clear some potential misconceptions. Concerning the /boot/extlinux/extlinux.conf, it's defined like this :
It's a pretty standard extlinux.conf. As long as the right zImage and dtb files are copied in /boot, it should boot just fine. I'll give it a try this week-end. |
Cool -- So I have very little knowledge about uboot/extlinux.conf at this point. but my basic plan for tinkerboard was to use a variant of the steps here to create a uboot image ont which I would add your extlinux.conf from above (with the tinker.dtb and kernel from this repo) hopefully it will work! |
also -- to be clear, my intention is to combine the initrd into the zImage as well as compile all modules statically into the kernel, so no initrd entry on the boot command line -- I guess this would be "classic, embedded style" as opposed to what distros do to provide the possibility for varied hardware and easy upgrade of the kernel... I don't know if this is possible with the dtb as well, but if it is, I will bundle that into the zImage as well |
It should be possible to include everything inside the kernel. That basically what I was doing at first, until a few people asked me to include support for various hardware. Beside a few modules (mali_kbase and some Rockchip HDMI CEC modules), you can remove most the modules without any problem. Note that some "staging" modules actually include the WiFi driver of the Tinkerboard though. |
I'm not following... what are "staging modules"? In any case I was thinking of leaving all hardware support enabled, but just statically built. that way the final work flow is that you build the kernel once. and then when you iterate your app, you build it and then have kbuild redo the ziImage bunding, and deploy to device (initially via flash, but via tftp asap) |
What happens when a touch screen is added to the board? (I don't have one). Does it show up as a second monitor or is video mirrored between the hdmi and touchscreen? Does the egl demo need to be updated to support users that may have different video configurations (touch screen only, etc)? |
@Tonymac32 tested a touch screen on a Tinkerboard, and it seemed to act as a secondary screen at first. However, I'm pretty sure that you can configure how your display system (X11 or DRM) uses the screen afterwards. If you intend to choose the screen (crtc + encoder) on which you want to display the demo, yes, you'll have to modify the EGL demo. More importantly, you'll have to change the DRM part of the demo. EGL doesn't really care about screens anyway. Concerning the "staging" modules, there is a "staging drivers" section in the kernel that contain drivers which are integrated but are terribly written. The Realtek Wifi driver used by the Tinkerboard is currenty in that "staging drivers" section, so take a look at that section if you're looking for the WiFi drivers of your Tinkerboard. For input support, you'll have to deal either evdev (low level), libinput (a bit higher level, using evdev) or maybe SDL if it works for you. The last one being more interesting if you intend to use Gamepads afterwards. |
Here's the thread about touch screen tests : https://forum.armbian.com/topic/4793-tinker-board-and-the-rpi-7-touchscreen/ |
Ok --- So I'm hoping to start working on things during the down time of the holidays. A couple of questions:
thanks! |
Hey !
|
Thanks -- all very good to know!
…On Sun, Dec 17, 2017 at 1:53 PM, Miouyouyou ***@***.***> wrote:
Hey !
-
I'm still waiting for some SDCard to arrive before testing the
Tinkerboard. I'll try ARMbian at the moment, in order to be "on-par" with
the MiQi. However, since it works with MicroSD cards, I might be able to
generate one with TinkerOS and see how it fares.
-
The Tinkerboard has several issues regarding reboot, since the MMC
hardware gets disabled during the reboot phase and it seems that a software
reboot can't enable the MMC hardware back. I'm pretty sure the Rockchip
chip guys have a special reboot mode that triggers a real power cycle,
instead of a "soft" reboot and that reboot should be used but... Since I
didn't have any Tinkerboard to test that idea, I just ported the patch
provided by the ASUS team on their 4.4 kernel.
Still, fixing this issue was a real pain to fix : Miouyouyou/MyyQi#8
<Miouyouyou/MyyQi#8>
Note, that the Bluetooth driver also is not ported. There are a few
bits in "staging" section that might help get the chip working, but I
haven't been able to get this work at the moment.
-
Concerning UART, I'm currently using a USB to UART (pins) cable so I
guess it's a USB to GPIO pins. Not absolutely sure but it's clearly not
connected to the USB ports of the MiQi, that's for sure.
Now, the serial output are described in the RK3288 reference manuals.
The one I currently use to debug my MiQi when serious issues happen is
/dev/ttyS2 . But deducing the port name was more a bit of trial and error
than anything.
-
Right off the bat, I don't remember any issue that could happen if
everything is built inside the kernel, instead of building things as
modules. I'll have to check my Git logs though.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG5hK8WLQEyC9-XH8aFIYo4QDTTF_ITks5tBWMWgaJpZM4QUveu>
.
|
Hi -- Happy new year! So, still not made much progress on this on my end -- no real good excuse. I did work on it a little during the holidays; it's not much but here is what I did and noticed:
---> So now I have a sane dev enviroment -- yeah!
At this point I stopped with the tinkeros kernel and started looking into yours.
It's not clear to me that trying to statically link in drivers into the kernel is that important. Aesthetically it felt important, but I don't know how much complexity it would add (right now, your one kernel config supports many boards, but switching to static drivers would mean more complexity.) Still I thought I would be worthwhile to try to carefully diff tinker's kernel config vs yours -- it would be educational for me if nothing else -- but time ran out and I haven't had a chance. Stupidly, I did not get around to just trying out the opengl stuff. Cheers, nehal |
The first kernels I cross-compiled for MiQi devices had almost everything in static. There were still a few modules for USB Wifi dongles and NFS support, but that's it. Then I had requests to support more and more things "Out-of-the-box", so I added the modules but it should not be too hard to compile the strict necessary statically. Try to remove unwanted features (Like DVB, webcams, USB network adapters support, ...) and compile the rest as static and see how it fares. I'll still try to compile everything in static this week-end and see how it fares. |
Thanks -- makes sense that you transitioned to modules. i'll let you know how it goes. nehal |
Hi Miouyouyou, I compile the kernel 4.15-rc8 for MIQI . I change the device tree for rk3288-miqi.dts for adding I2S and SPDIF. The board can start up normal, but no sound to play. root@linaro-alip:~# aplay 250Hz_44100Hz_16bit_30sec.wav The SPDIF port is normal. I had tested it in other ways. Now I don't know how to test it. Do you have any suggestions? Thank you. |
Greetings @tiandaozhang, Quite recently, @Tonymac32 was able to get some nice sound output on its Tinkerboard and provided me some instructions on how to get the sound output working on these boards. Still, you can give it a try and see how it fares. Here's the configuration files you'll have to modify and the modifications you'll have to bring. /etc/asound.conf
/etc/pulse/default.pa
|
Thanks for you help. The dts file #include <dt-bindings/input/input.h> / {
...... &i2s { &spdif { .....` |
Anything in dmesg regarding SPDIF ? I'm looking at that SPDIF driver, spdif-dit, but it's quite light... Are you driving the SPDIF through GPIO or through the HDMI interface ? |
Also did you try with the |
Yes , I had try sound-dai = <&rockchip_spdif>. |
The dmesg log is below: |
Could you retry with the rockchip_spdif one more time and provide the dmesg output ? |
OK
|
Almost there isn't difference between the two log files about SPDIF. |
Could you try to also replace |
I have test it , and there isn't sound card found in this way. |
In order to output audio to hdmi and I2S(GND,I2S_SCLK,I2S_LRCK_TX,I2S_SDO0) at the same time. When I play sound, there isn't data in I2S port. I don't know why? @Miouyouyou |
I'll try to see how sound work on MiQi devices this evening. Meanwhile, try to do this instead, for the sound output :
Remove the spdif_out nodes but keep the i2s node. Example rk3288-miqi.dts in this case.
|
OK I try your suggestion.
There isn't soud in the I2S port. I think 'rockchip,tinker-codec' just is a driver's name . After I add below info in your file. &hdmi {
}; When I play music , no data output from I2S port. |
I test I2S and SPDIF port in real environment with DAC codecs. |
Nice setup ! Hmm, I'll try to understand what's going on in the driver tonight. As a last try, could you try to replace the Also, could you provided the output of :
? |
I test replaced dts file. The output log is below: Expect your test result..... |
So, I've checked both drivers and indeed the simple-audio driver just output nothing at all, while the rk3288-analog-hdmi just cannot work correctly using the setup provided in their documentation. I always get a The setup outputting nothing with simple-audio was this one :
The thing is that the simple-audio driver is so generic that it clearly needs the right configuration to work correctly. Unfortunately, I don't have a good setup for testing GPIO and I2S, nor do I have a scope for that, so this will have to wait a bit until I receive at least some cables and hardware to check how things perform... And some time to dwelve into the ALSA internals. Currently, I have no idea what drives the I2S clocks and how to "play with the I2S" without creating yet another driver. So, until I find what's wrong, the only things I can suggest is to try playing with the simple-audio configuration and try hitting a few other places like :
If the same issue can also be reproduced on Linux 4.4 kernels provided by rockchip, you could also open an issue on Rockchip's kernel Github page. Meanwhile, I'll provide the solution once I find it... This can take a while... |
With changed miqi dts's file ,I tested MIQI kernel worked normal in I2S port and SPDIF port. The kernel link website is below: https://github.com/mqmaker/linux-rockchip/tree/miqi/release-4.4 , and the kernel version is 4.4. Thank you for your help, I will continue to explore this problem. |
@Miouyouyou @tiandaozhang This is a regression. I am working on a fix. Will keep you posted. |
@Miouyouyou @tiandaozhang Fixed here: I'll send this upstream soon. |
Alright, I'll give this a test when I get home. Thanks for you hard work 😃 |
Hi Miouyouyou!
I was wondering if you would consider the following idea for a tutorial at some point; it is a followup from my comments at your gist:
Create a wiki page detailing the steps required to build a minimal system image that boots and runs your opengles example as an /init script. From some of your writings, I think you have an interest in android; this tutorial would have a slightly different target audience: people interested creating absolute minimal devices in which they can control and understand nearly every part of the process and nevertheless can access the full power of the cpu/gpu (e.g. have proper Mali drivers). I'm not sure how interesting this would be for you, but if you have questions I can try to flesh out more details and provide better explanations. (and as you pointed out in your comment on the gist, the remaining black box/proprietary stuff would be the Mali drivers themselves, which for me is something I can live with....)
For the time being, I was thinking: Since most of the complicated details are worked out (RockMyy, the opengl gist, etc), it might be good to make the tutorial newbie friendly:
If you are interested we could do a collaboration where you document the hard parts and I document the newbie parts.
Thanks!
The text was updated successfully, but these errors were encountered: