This is something that I’m still coming to grips with, but today I learned that the cross compile toolchains that Technologic Systems provides for at least some of their products come from CodeSourcery.com. A quick blurb from their website:
CodeSourcery, in partnership with ARM, Ltd., develops improvements to the GNU Toolchain for ARM processors and provides regular, validated releases of the GNU Toolchain. Sourcery G++ Lite Edition supports ARM, Thumb, and Thumb-2 compilation for all architectures in active use, including Version 7 of the ARM Architecture.
For example, today I needed a newer version of the g++ cross compiler targeted towards EABI and glibc, so I took a look around the website at http://www.codesourcery.com/sgpp/lite/arm and found the release in the downloads section here: http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite
A short term goal for myself is to figure out what goes into creating a cross compile environment. I think this would be a valuable skill in the embedded Linux market. For now, this was a shock to learn about how simple it really is to be able to simply download the toolchain and that there wasn’t any other trickery or knowledge required.
This guide will help you understand the very basics of setting up a TFTP server. This was written using Fedora 12 and tested with SELinux disabled. I have not yet confirmed if SELinux needs to be disabled, but I have confirmed that the firewall needs to be configured to allow port 69 (TFTP port). Let’s get to it…
read more…
Here are the steps that I have taken in the past to fix the “public key is not available:” message while trying to use apt-get:
1.) Use apt-get to install debian-archive-keyring
apt-get install debian-archive-keyring
2.) Try using apt-get again. Additional information will be provided.
3.) Use additional information from last attempt with gpg commands.
Replace the KEYNUMBER with the actual keynumber that you should now have from running apt-get again.
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys KEYNUMBER
gpg --armor --export KEYNUMBER | sudo apt-key add -
4.) Update apt-get to resynchronize the package index files.
apt-get update
5.) You should be good to go!
Keep in mind you may need to run apt-get update a couple of times. Also, make sure your date is set correctly.
This tidbit intends on helping folks running Linux in an embedded environment to setup a static IP address. This is also applicable to full fledge desktop installations of Linux as well. It has been tested on Debian Linux, but I suspect the process is identical for most distributions. Let’s get to it…
Edit “/etc/network/interfaces” to reflect the changes you’d like to make to your IP address. For example, I would like to setup my Debian box with the IP address 192.168.1.100. I have filled in all of the important information as well as seen below:
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.100
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
Then, edit the “/etc/resolv.conf” file to reflect your DNS servers (or simply use OpenDNS addresses below):
nameserver 208.67.222.222
nameserver 208.67.220.220
Now, reset the eth0 interface by using the command:
ifdown eth0; ifup eth0
Test the connection using the command:
ping google.com
As an additional tidbit, you can simply get an IP address via DHCP using the ‘dhclient’ or ‘pump’ command.
Today I was asked to compile a program for one of the SBCs that I work with. The difficulty was in trying to choose the correct cross-compiling toolchain. Since there were several different toolchains each with a different version of gcc and glibc, I wanted to know what other utilities like ‘ls’ were compiled with so I had a good idea of which toolchain to use. I found several different methods of finding a suitable toolchain.
A good place to start is on the target system itself, and if it has ldd and gcc installed, then it’s as easy as using:
ldd --version
gcc --version
Another not-so-obvious method to find all information including gcc and glibc versions is simply using (may not work on all systems):
/lib/libc.so.6
If the above doesn’t work, there is yet another solution and that is to actually compile this short program and run it so that it spits out the glibc version used:
#include <stdio .h>
#include <gnu /libc-version.h>
int main (void) { puts (gnu_get_libc_version ()); return 0; }
It may not be as common, but if a binary has not yet been stripped of it’s comments and extras you can use objdump and objcopy to view information about that file. For example, the following command will use objcopy to spit out the section named .comment within the /bin/ls binary to the /tmp/foobar file. The strings command will then spit out readable text from which you can derive the glibc and/or gcc version that was used to compile the binary. Again, keep in mind that this may not work for every binary. Use the objdump command to see which other fields are available.
objcopy -j .comment /bin/ls /tmp/foobar; strings /tmp/foobar
If you have any more methods for extracting this sort of information out of an already-compiled binary, I’d love to hear about it in the comments.