Help! How do I get I2C support with cross compiler?
- 
					
					
					
					
 I used the "Cross-Compiling for the Omega" article to set up a cross compiler environment in Ubuntu, and I was able to get a HelloWorld executable to run on the Omega 2+. I want to move on to some more challenging territory and create an executable to talk to I2C devices, but I can't figure out how to get I2C support in my cross compiler environment. Any hints/tips would be greatly appreciated! Thanks, 
 Bryan
 
- 
					
					
					
					
 You need to link against libonioni2c. My cross-compiled library for an I2C WiiClassic controller uses exactly that. (here)
 
- 
					
					
					
					
 Okay, now we're getting somewhere! I don't have any libonionXXX libraries in my cross compiler toolchain. How do I get them in my toolchain? 
 
- 
					
					
					
					
 Either use my compiled version in the repository I linked to or cross-compile them yourself from the source at https://github.com/OnionIoT/i2c-exp-driver. I found that you can't link against the binary file provided by the package for the onion (e.g. installable by opkg update && opkg install libonioni2c), due to some weird errors / symbol stripping whatever. So I compiled my own repo of header and library files at https://github.com/gamer-cndg/omega2-libs. Note that for your cross-compiled program to be able to run on an Omega, it will have to have all dependencies installed, such aslibonioni2c.
 
- 
					
					
					
					
 Thank you Maximilian for your help! I found more information in another post, and I don't know why they haven't included this information in the Cross-Compiling for the Omega documentation. José Luis Cánovas included these instructions in his Docker SDK post: You must add the onion feeds (work in progress for my docker image, in the meantime do it manually) to the file feeds.conf.default (check WereCatf's first_time_setup.sh), update the feed and add the onion packages: 
 scripts/feeds update -a
 scripts/feeds install -a
 Then, frommake menuconfigselect the onion libraries (Onion -> Libraries/Utilities -> select as [M]odule).
 ...
 [runmakehere to compile the toolchain]
 ...
 Whenmakefinishes, anls staging_dir/target-mipsel_24kc_musl/usr/lib/(note the penultimate/usr/directory) shows:omega@dee42fad6a75:/lede$ ls staging_dir/target-mipsel_24kc_musl/usr/lib/ [...] liboniondebug.so [...] libonioni2c.so [...] libonionspi.so [...]and many more onion and non-onion libraries. And inside staging_dir/target-mipsel_24kc_musl/usr/include/: omega@dee42fad6a75:/lede$ ls staging_dir/target-mipsel_24kc_musl/usr/include/ [...] onion-spi.h [...] onion-debug.h [...] onion-i2c.h [...]Note: I didn't need to add the Onion feeds to the feeds.conffile - thescripts/feedsscript worked without any modifications.I wish it were a little more clear about which libraries, etc. to select on the make menuconfig, because I found multiple items that were related to I2C. So I just picked the ones that looked right...hopefully that doesn't mess me up too much.
 
- 
					
					
					
					
 Thank you @Bryan-Hilterbrand that was exactly what I was looking for! 
 You're right, this update procedure should be added to the reference documentation.