4 4
MitchD

Buildroot realtime image for nanopi neo

Recommended Posts

I'm not sure if anyone is interested in a very small distro without gcc, but I spent some time the last week using buildroot and armbian's source files to create a 3.4.112-rt image for the nanopi neo. It is going to be part of a realtime audio project (think synth or guitar pedal) that I'm working on and it demands a quick boot, among other things. 

 

There is also a mainline version, but it doesn't have all the fixings you folks like, so I don't know if you'd want to use that. 

 

You can find the build scripts and config files on my github. I'll be posting the legacy image in a zip file tonight, once I verify everything is reproducible. 

 

I would like to thank the Armbian developers for all their time and energy doing what they do. Their code and guides have helped me understand how one would even attempt something like this, and I'm very grateful. If you ever use my image, please donate to the Armbian community. 

 

The screenshot is proof that the system works, and how much ram it uses while forwarding a puredata session over X-forwarding. 

 

I'm open to any questions. Thanks. 

Selection_002.png

Share this post


Link to post
Share on other sites

Hi MitchD :

Your work is awesome. What I need to change to work in my orange pi zero?

I trying to make a rt kernel distro for my orange pi zero but  your solution is very cool.

Very Thanks!

Share this post


Link to post
Share on other sites

Thanks @gatinho!

I'm using the configuration of the older armbian commit for 3.4.112 from November 2, 2016. In this commit the orange pi zero wasn't released yet. I'm not sure it'll work without any modifications. Do you have the H2+ version of the orange pi zero? I have one at home and I can definitely try the rt kernel on it and see what needs tweaking. 

 

There shouldn't be all that much to change, assuming the wireless drivers were in november. The main point of contention would be the fex file which sets up everything.

 

I'll look into when the orange pi zero was supported by armbian and fork the branch at that date and see what I can come up with. 

 

Are there any programs you'd like installed on the buildroot image? In buildroot, there is no apt-get install, and no gcc compiler. It's meant to basically be a fully cooked system with no unnecessary overhead. 

 

 

Share this post


Link to post
Share on other sites

Thanks @MitchD . I only need python and ssh. I want to make a sound software in python. 

What audio software your use? JackD (jack audio connection kit) or Pulseaudio? you have good latency?

 

I make a buildroot image and patch it whit kernel-rt patch from kernel.org and put the final .img in mi microsd card but mi orange pi zero don't display nothing in the vga port (tv out). I don't know if the system is running because I try to connect my host pc with windows 10 with a www.dhcpserver.de to the ethernet por of the orange pi zero but nothing happen :(

If you can try on your orange pi zero and run please tell me :)

 

I also made a rootfs-overlay, and assign a static ip to the board, line in (http://free-electrons.com/doc/training/buildroot/buildroot-labs.pdf --page 15--), but cant connect to it (using ubuntu now).  

Very thanks! P.S: I attach the image made with buildroot

sdcard.img.tar.gz

Share this post


Link to post
Share on other sites

I'm using puredata with alsa, and i have a latency of about 8ms. I haven't dug down and messed with drivers yet, but I hope to reduce that. I may add Jack in the future. 

 

I'm gonna guess you built it from linux 3.4 sources, right? In your boot partition, there is no script.bin. You'll need that instead of the dtb for the legacy images. I would also suggest getting a USB to serial device and plugging directly into the board via the headers to get boot output. It is extremely useful in cases like these. 

 

I will try with my orange pi zero tonight. 

Share this post


Link to post
Share on other sites

Hi @MitchD. Thanks for your answer. No, I am using the 4.11.9 source, and the rt patch for this. The boot partition was made with the image of the otput of buildroot. I have changed some settings, but still nothing happens.  Where do you get the script.bin file?

 

Thanks.

 

I attach the new Image, and rootfs.

 

https://drive.google.com/file/d/0By8yhoPcOmZKQ0JUWEhZbUJ1TVE/view?usp=sharing

 

 

https://drive.google.com/file/d/0By8yhoPcOmZKNnR6RVJ5OWtzQ1U/view?usp=sharing

 

Share this post


Link to post
Share on other sites

The first link boots for me. How are you copying this to the SD card? I use Etcher.

 

It complains about not having eth0, which leads me to believe something is not correct in the dtb. There is also no wifi driver in this build, so you will not get wifi to work.  Looks like ethernet support isn't until 4.13, as you can see on the sunxi mainlining effort page. 

 

The output of `uname -a` is: Linux OrangePi_Zero 4.11.9-rt7 #1 SMP Sat Jul 15 20:00:03 CLT 2017 armv7l GNU/Linux

 

This tells me its SMP, not PREEMPT RT. Thats a flag you might want to enable in make linux-menuconfig.

 

Since it does not boot for you, I would recommend trying a better power supply. If that changes nothing, try a different SD card. 

 

I imagine you're going to want to have ethernet enabled. I have these patches, which add support for ethernet into a mainline kernel. Add them, and you should be good to go.

 

Share this post


Link to post
Share on other sites

Thanks @MitchD, I will surely try what you sayd. Did you plug a monitor through the TV out?.

For copying the SD card, I am using this command: sudo dd.

The eth0 might be, beause I changed the etc/network/interfaces, to get an static ip, I will change it back and see what happends.

 

I will try what you say tomorrow, and comment back.

Thanks

Share this post


Link to post
Share on other sites

The kernel you supplied has no drivers, so I'm willing to bet there will be nothing in the TV out. 

 

The ethernet doesn't exist in the dtb, so it will not load it in the kernel. 

 

I have created a legacy image for you, which has basically everything working but the wifi. It has python and ssh like you wanted. The login is root,  password is root. 

 

For TV output, you'll want to change the fex file, as described here. Since there is no xserver, I'm not sure what you're going to be displaying on the TV. 

 

I hope this helps. 

 

https://drive.google.com/file/d/0B42tAZ6A-UbDV3dFTHhlQnVsdVE/view?usp=sharing

Share this post


Link to post
Share on other sites
35 minutes ago, gatinho said:

For copying the SD card, I am using this command: sudo dd.


This guy is experiencing the same exact detailed issue as you.

  • Attempted to create kernel.
  • Kernel doesn't boot.
  • Kernel complains of Ethernet missing.
  • End user wrote image with `dd` command. 

 

The only difference is that OP is using OPi Zero Plus, not OPi Zero.... big woop. Simply try with Etcher, report back. That might be hard though without a UART adapter... get MitchD to do it for ya xD


Sup MitchD? Keep up the good work. :P

Share this post


Link to post
Share on other sites

Very thanks @MitchD. I wrote the image to my sd card. How you configure ethernet in the orange pi zero?. I the past I connect my pc to orange with ssh via wifi. Dietpi have a txt file that indicates that orange pi zero auto-connect to a wifi with an specific SSID. I read and try to edit the file: "etc/network/interfaces" of the orange pi zero with the following configuration but nothing happen:

auto eth0
iface eth0 inet static
address 192.0.2.7 <-this is an static Ip
netmask 255.255.255.0
gateway 192.0.2.254  <-this is the Ip of my Laptop ?

pd: I read in an other forum that if I simply put a cable between both machines in Windows, I only need to share wifi over ethernet and windows assign an ip via DHCP to the orange and I can view the ip with "arp -a" but nothing happen :\

Share this post


Link to post
Share on other sites

It is set up to a dynamic IP right now. If you try `nmap -sP 192.0.2.0/24` on your laptop before `arp -a` you might be able to find it. If at all possible, find another ethernet cable, and plug the orange pi directly into the router. Its the easiest method. 

 

You should be able to bridge the wireless and ethernet connections, but this is outside the scope of the help I'm able to provide. Its different for every system. The kernel I provided does not have any wifi support, so a cable is going to be the easiest thing to manage. 

Share this post


Link to post
Share on other sites

@MitchD thanks a lot!

We put your image on sd and boot, connect a ethernet cable between ubuntu and opizero (with your image). by the moment everithing great.

one question please: How do you install the drivers , with the linux menu-config, overlays or copying directly in the filestystem of the sd card? (.ko files? )

 

Thank you very much!

 

Share this post


Link to post
Share on other sites

I think you would have to copy directly to the filesystem, but I'm not sure. I've never added drivers after the kernel is compiled. You're going to need to look under /lib/modules and figure out what do there. 

Share this post


Link to post
Share on other sites

Ethernet drivers exist in my image. I tested it before I uploaded it.  Your image uses a mainline image, and I provided ethernet patches for that in a post above.  Apply the patches and enable them in the defconfig and your own kernel should have them. 

 

You set the ethernet driver by doing `make linux-menuconfig`, going to Device Drivers,  Network Device Support, Ethernet Driver Support, and selecting "SUNXI Platform Network device drivers", and the three options below that.

 

The only way I know to add drivers to a linux kernel is to build them when you build the kernel. There is no need to download my github and try it, because I gave you the compiled kernel with the drivers in it. If you meant wifi drivers, then you would download mine and patch the kernel to add the drivers, and select those drivers from the `make linux-menuconfig` command, and build the kernel that way. 

 

When I put the project together initially, I had a working mainline vanilla boot for the nanopi neo, and I modified armbian's sources to create a legacy buildroot image with realtime capabilities for the nanopi neo. Any use outside of that is up to the end user.

 

I'm not familiar with wireless drivers and I really don't want to spend the time to get them working.  The only way I would get them working is if  @Igor decided there should be a minimal buildroot image for every board Armbian supports, and I don't think that is likely.  

 

If you can't find your device on your subnet, you can try Wake Me On Lan for windows.  It will show you every device your computer can ping. If you use linux, nmap and arp should do just fine. 

 

 

 

Share this post


Link to post
Share on other sites

Very thanks Mitch, We download your patches and try but no connection to the ethernet :/. We don't see "SUNXI Platform Network device drivers" in the linux-menuconfig.

I attach the images, do you see any error in our process?prezero.png.8f30c3d385785416876e3771303d180b.png

cerooo.png

cinco.png

cuatro.png

dos.png

seis.png

tres.png

uno.png

Share this post


Link to post
Share on other sites

It looks like your patches applied correctly, comparing your images to my make menuconfig shows its the same. I'm not sure why you're not getting ethernet. Once your board boots up, if you type "ifup eth0" it should come up. Also check the /etc/network/interfaces file to make sure eth0 is define, like this:

 

auto eth0

iface eth0 inet dhcp

       wait-delay 15

 

I tested my mainline image on an orangepi zero and it booted right away with ethernet, so I'm not sure what is wrong. If you change out your SD card and power supply or USB cable you may have luck.

 

 

Share this post


Link to post
Share on other sites

Hi Mitch.

 

I am trying to get the on board audio on my neo to work. Can you point me in the right direction with what I should be selecting in buildroot?

Also, I amn try to get USB storage to work so i can plug in a USB stick - any hints on this one?

Thanks.

J.

Share this post


Link to post
Share on other sites

I haven't needed the onboard audio to work, but I'll bet your answer lies in the device tree overlay stuff in linux/arch/arm/boot/dts, where you may need to check  the bindings in sunxi-h3-h5.dtsi and sun8i-h3-nanopi-neo.dts. You should create a patch that turns the status = "disabled"; line to status = "okay";

That might solve an issue with it enumerating correctly on boot. You may want to copy over an alsa config from a known working image, since that is might be an issue after the DTS stuff.

 

The USB storage means you should probably install udev and support for FAT and NTFS storage under the USB drivers in the make linux-menuconfig 

Share this post


Link to post
Share on other sites

This may help, at least for where to go and look.  I've only done this for the I2S as described for the NanoPi Neo.

 

I just saw this thread, I may have some questions to ask soon, I'd like to start giving compact RT / IOT builds a shot for several devices.

 

Share this post


Link to post
Share on other sites

Yeah, I2S is a whole other beast with the H3. I know support exists on mainline, but I'm not adept enough at the DTS stuff for enabling I2S sound cards. I have an oscope I can check the signals with, but the tedium isn't something I'm interested in right now. The built in analog codec would be a simple task, as it already is known working on friendlyarm's mainline kernel, and its a matter of using diff to get the goods. 

 

Please ask any questions, buildroot is really cool. I'm using it for a synth, guitar pedal, and a tiny pxeboot image server. 

Share this post


Link to post
Share on other sites

I can try to get the AP6212 drivers working tonight. I don't know if I can get the EMMC to work, since that seems rather tricky. 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
4 4