README for Linux Device Tree kernels on FoxG20 ============================================== In this directory and below, there are several Linux kernels and associated support files for the FoxG20 by Acme Systems, see: http://www.acmesystems.it/foxg20 These kernels use Device Tree (DT) configuration which is relatively new at the time of writing, at least for ARM processors and Atmel's AT91 family. They are based on work by Robert Nelson (RN) at this site: http://www.eewiki.net/dashboard.action and specifically this page: http://www.eewiki.net/display/linuxonarm/AT91SAM9G20 The author uses a 1 GB microSD card (ATP industrial grade) +++ with three partitions: - partition1: dos or vfat format, at least 32 MB in size - partition2: ext4 (Linux) [most of the space] - partition3: Linux swap [optional, 64 MB ?] Following Acme's partition naming: - partition1: kernel - partition2: rootfs - partition3: swap *+* There is a copy of the contents of my first partition in the partition1 directory under each kernel version (e.g. 310/partition1 ). At boot the AT91SAM9G20 SoC tries to execute code in Dataflash on the Netus CPU board (i.e. the 40x40 mm plug in board to the FoxG20 motherboard). This logic assumes Acme's "AcmeBoot" loader is on the Dataflash. AcmeBoot executes a file called "uImage" on the first partition of the microSD card (dos or vfat format required). There is no provision in AcmeBoot to load DT blobs (e.g. at91-foxg20.dtb) so this is appended onto the zImage style kernel produced by RN's tree. The concatenated file is then placed in a uImage container so AcmeBoot is happy. That uImage file needs to be placed in partition 1 (the dos or vfat file system) of the microSD card. AcmeBoot takes care of the eth0's MAC address. Whether a watchdog is activated or not depends on which version of AcmeBoot is used. Note that the kernel boot line is in at91-foxg20.dtb; to change it at91-foxg20.dts needs to be edited and the blob rebuilt. "dtb" files are called Device Tree Blobs and they are compiled by dtc from source files with extensions like "dts" or "dtsi". For the ARM these magic configuration files are found in the /arch/arm/boot/dts directory. As of lk 3.10 the mainline kernel contains an at91-foxg20.dts file. Best not to try to write dts/dtsi files from scratch, use what is suggested, get it working on a FoxG20 board, and only then try to modify it. And the best place to start modifications is with the at91-foxg20.dts file itself, for example the uart1 serial port can be unconfigured by commenting out its status like this: uart1: serial@fffd8000 { status = "okay"; }; changed to this: uart1: serial@fffd8000 { # status = "okay"; }; This works because an earlier included file (namely at91sam9260.dtsi) contained this line for uart1: 'status = "disabled";'. The latter status (in at91-foxg20.dts) overrides the former one. Watchdog support is a little tricky since once it is turned off, then it remains disabled until the next power cycle. One can see from the kernel boot up message (see dmesg) whether the watchdog is activated or not. If not and it is needed, hound Acme about AcmeBoot :-) Follow RN's instructions to build a root file system. In my experiments Debian 6.0 boots faster than Debian 7.0 . YMMV Don't forget to modify /etc/fstab , /etc/network/interfaces and /etc/inittab as directed. The root file systems provided by Acme (lk 2.6.38 vintage) don't seem to work with RN's DT kernels, don't know why, typically freezing during the "loading Linux kernel" step. With Debian 7.0 root fs the new systemd is an option to replace the old and relatively slow SysV based init scripts. With a Debian 7 root fs and systemd, the author got boot times about the same, or a little faster than with a Debian 6 root fs. When RN's infrastructure is used to build kernels (and after the first build), 'cd ..../armv5_devel ; tools/rebuild.sh' will save you time); the results are placed in the deploy directory. For the lk 3.10 kernel these are important files: 3.10.0-armv5-x0.16 - 3.10.0-armv5-x0.16.zImage [first arg to fox_mkuimage.sh] - 3.10.0-armv5-x0.16-modules.tar.gz ['cd / ; tar xzf '] - 3.10.0-armv5-x0.16-dtbs.tar.gz [includes at91-foxg20.dtb] - at91-foxg20.dtb [second arg to fox_mkuimage.sh] - fox_mkuimage.sh [script to build uImage container] - partition1/uImage [this is what AcmeBoot wants to find] The system.sh script file provided reflects that the author has an up to date git source tree from Linus Torvalds in his /home/dougg/linux-stable directory. It can be periodically updated with 'git pull'. The defconfig file becomes to kernel's ".config" file which configures the kernel build. In RN's tree defconfig should be placed in the armv5_devel/patches directory. Once there is is probably a good idea to overwrite the kernel's live .config file with: cd /patches touch defconfig cp -p defconfig ../KERNEL/.config If building the kernel from source, there may be patches to apply, look for a file on my site with the extension ".patch". If patches are needed then after following RN's kernel instructions and running './build_kernel.sh' at least once then check then apply the patch and rebuild. Assume a file called g20_390rc5dg3.patch is in the 390rc5 directory, do something like this: cd KERNEL patch -p1 --dry-run < /tmp/g20_390rc5dg3.patch and if that is okay do: patch -p1 < /tmp/g20_390rc5dg3.patch cd .. tools/rebuild.sh In the case of the lk 3.10 kernel, there are no patches to apply. Note RN's build logic applies patches found in armv5_devel/patches/* directories. Since RN's infrastructure is made of several parts, doing something like 'cd armv5_devel/KERNEL; git pull' will update the Linux kernel part of his infrastructure _but_ not his patches and other scripts ***. That can lead to confusion as some have found. The author just starts again producing a series of directories that look like: ..../310/armv5_devel Storage is cheap ... Note that these kernels are based on DT configuration files (e.g. at91-foxg20.dts and the files it includes). This is quite different from the patched kernels based on lk 2.6.38 that Acme Systems provided with the FoxG20 ****. Device Tree is also known as Open Firmware and because is it very new in the Linux kernel (and for Atmel SoCs), good general documentation seems to be scarce. For DT syntax and some examples see: http://devicetree.org/Device_Tree_Usage There are kernel documentation files under the /Documentation/devicetree/bindings directory (e.g. look for files containing "atmel" or "at91"). As always documentation is "work in progress". Recently Atmel updated their Linux4Sam pages, see: http://www.at91.com/linux4sam/bin/view/Linux4SAM/ and they are now based on lk 3.6.9 . That is right at the infancy of DT for at91 devices. There have been lots of recent changes in DT support within the kernel and the dust is yet to settle; so unless Atmel have backported a lot of DT changes, then lk 3.6.9 is either DT less or has minimal DT support for the at91sam9g20 SoC. Make a uImage for the FoxG20 ============================ After RN's instructions are followed to build the kernel then do the following: cd deploy cp /fox_mkuimage.sh . chmod +x fox_mkuimage.sh mkdir dtbs tar xzf 3.10.0-armv5-x0.16-dtbs.tar.gz -C dtbs ./fox_mkuimage.sh 3.10.0-armv5-x0.16.zImage dtbs/at91-foxg20.dtb cp uImage The live DT source file is in KERNEL/arch/arm/boot/dts/at91-foxg20.dts and the dtsi files it includes are in that directory. If that is changed, or the kernel is changed then from the armv5_devel directory do: tools/rebuild.sh then repeat the procedure at the beginning of this section. Networking problems =================== Sometimes when changing the Ethernet Mac address you can run into problems with the interface number. Due to the /etc/udev/rules.d/70-persistent-net.rules file the previous MAC address is remembered and the eth0 interface is reserved for the older MAC address while your new MAC address gets eth1. Since the root file systems expects only one Ethernet wired device at eth0 then wired Ethernet will appear not to work. One solution is to delete that file. Actually that file is such a pest that making an /etc/rc.local entry to delete it may be useful! Which system ============ 'cat /proc/cpuinfo' doesn't differentiate between AriaG25, FoxG20 and various other 9x5 sub-family SoCs and those closely related. Try 'cat /proc/device-tree/model' instead. See the at91-foxg20.dts config file to see where that comes from. Shifting kernel gpio numbers ============================ Beware: round about lk 3.3 the kernel GPIO pin numbering changed. Prior to that the origin was 32, so PA0 was kernel GPIO pin 32. Since lk 3.3 (including all kernels held hereunder) the origin is now 0, so PA0 is now kernel GPIO pin 0. This can be a major problem on the G20. A kernel gpio pin number that was previously PB31 and set for output (say low) is no big issue. But on recent kernels (due to this renumbering) that becomes a set to PC31 and on the G20 that is (memory/ram) data line 31. Expect to see the kernel crash (with no oops) and RomBoot to appear on the console very soon after that. I found out the hard way. So existing applications may need to be changed! Same microSD card for the FoxG20 and AriaG25 ============================================ Yes currently that works for me. Using the method described here on the FoxG20 only a uImage file is needed. The existing AcmeBoot or equivalent is looking for a file called uImage in the top directory of the first partition which must be a dos/vfat partition. The Aria G25 is looking for boot.bin which in turn loads u-boot.bin . u-boot-bin reads uEnv.txt which instructs it to load zImage and dtbs/at91-ariag25.dtb . So no files overlap between the two boot sequences. The root file system is "armv5" based for both the G20 and G25 so it will boot for both. Obviously the GPIOs are different but programs can detect which SoC they are running on by examining /proc/device-tree/model . ag25g20_utils ============= This is a package of Linux user space utilities for the FoxG20 and AriagG25 boards. More generally it should work on AT91SAM9G20 and AT91SAM9G25 (perhaps other members of the At91SAM9x5 sub-family) based systems. See: http://sg.danny.cz/foxg20/ag25g20_utils/readme.txt The most recent tarball is: http://sg.danny.cz/foxg20/ag25g20_utils-0.96r10.tgz and the corresponding Debian binary package: http://sg.danny.cz/foxg20/ag25g20-utils_0.96-1_armel.deb In order to distinguish which SoC (G20 or G25) code is running on, users may find the is_foxg20 and is_ariag25 utilities helpful. There is even a is_foxlx utility to detect Fox LX832 which seems to have re-appeared on Acme's site. D. Gilbert 20130708 Please send corrections and additions to dgilbert@interlog.com +++ it has been observed that larger microSD cards (e.g. some "HC" models) are flakier during boot. It seems various bootstrap programs read data from the SD card at the maximum allowable speed, and contain virtually no error recovery code; not a good combination *+* Acme formatted SD cards sometimes don't have swap, but should *** RN's infrastructure has two git trees: the main tree whose root is the armv5_devel directory, and the second tree whose root is the armv5_devel/KERNEL directory **** Acme Systems is in the process of upgrading to DT kernels