This is an unofficial port of the mainline Linux kernel to the Technologics TS-7400/TS-7670 industrial single-board computers. It is incomplete, may have significant and damaging defects, and is provided with ABSOLUTELY NO WARRANTY to the extent permitted by law.
What works:
What is detected, but not tested:
What hasn't even been touched yet:
These need transceivers that are all separately controlled with GPIOs, in the case of the RS-232 ports and a PWM channel for RS-485. The PWM is to supply the RS-485 transceiver with a clock, which it inexplicably needs. It should be a 50% duty cycle, and a frequency equal to the baud rate.
Since kernel 4.4.1, support has been added to the auart-mxs driver drive the PWM channel for the RS-485 port. Handling of other GPIO signals is on the TODO list.
These too, have a GPIO that turns on the transceivers. However, the FlexCAN driver knows about this, and will turn the transceivers on automatically when the can0 or can1 interfaces are brought up. No testing has been done to see if the CANbus actually works, but it's seen, and can be brought up using iproute2.
This implements a watchdog, amongst other things. The ts-wdt.c driver from the Technologic Systems' 3.14.28 kernel tree has been ported to both U-Boot and the Linux kernel, allowing both to function on newer TS-7670 boards.
There might be a kernel driver for this somewhere, I haven't checked. Worst case though, it should be accessible via /dev/i2c-0 at address 0x57 using i2cdump, i2cget and i2cset.
stuartl@rikishi ~/vrt/projects/arm/u-boot $ make ts7400_config Configuring for ts7400 - Board: ts7400, Options: ENV_IS_IN_MMC stuartl@rikishi ~/vrt/projects/arm/u-boot $ make u-boot.sb \ CROSS_COMPILE=arm-unknown-linux-gnueabi- [... much output ...] CC spl/lib/vsprintf.o LD spl/lib/built-in.o LDS spl/u-boot-spl.lds LD spl/u-boot-spl OBJCOPY spl/u-boot-spl.bin MKIMAGE u-boot.sb
This should give you a u-boot.sb, which is a Freescale bytestream. To convert this to a SD card partition:
stuartl@rikishi ~/vrt/projects/arm/u-boot $ tools/mxsboot sd u-boot.sb \ u-boot.sd
u-boot.sd is your SD-card partition image.
stuartl@rikishi ~/vrt/projects/arm/linux-stable $ make ts7400_defconfig \ ARCH=arm # # configuration written to .config # stuartl@rikishi ~/vrt/projects/arm/linux-stable $ make zImage modules \ tar-pkg dtbs ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi-
This will leave you with:
Standard Linux fdisk is sufficient for creating the image. You can either do it with a real SD card or with a loopback device (this is how I created the image here).
All steps here need to be done as root.
To create a loopback image file, do the following:
rikishi tmp # dd if=/dev/zero of=sd.dd bs=1M seek=2048 count=1 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.0022172 s, 473 MB/s
A gotcha: ensure the size isn't bigger than your SD card. It may be helpful to make it much smaller, and just edit the partition table and grow the partition when you do the actual flash to the SD card. This is how things are done in the Raspberry Pi community for example.
Next, partition the image or SD card. Here, we'll create a 1MB partition for u-boot, a 15MB partition for the kernel and device tree, and the rest for the root.
rikishi tmp # fdisk sd.dd Welcome to fdisk (util-linux 2.24.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x46245b98. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-4196351, default 2048): (press enter to accept default) Last sector, +sectors or +size{K,M,G,T,P} (2048-4196351, default 4196351): +1M Created a new partition 1 of type 'Linux' and of size 1 MiB. Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (4096-4196351, default 4096): (press enter to accept default) Last sector, +sectors or +size{K,M,G,T,P} (4096-4196351, default 4196351): +15M Created a new partition 2 of type 'Linux' and of size 15 MiB. Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (3,4, default 3): 3 First sector (34816-4196351, default 34816): (press enter to accept default) Last sector, +sectors or +size{K,M,G,T,P} (34816-4196351, default 4196351): (press enter to accept default) Created a new partition 3 of type 'Linux' and of size 2 GiB. Command (m for help): t Partition number (1-3, default 3): 1 Hex code (type L to list all codes): 53 Changed type of partition 'Linux' to 'OnTrack DM6 Aux3'. Command (m for help): t Partition number (1-3, default 3): 2 Hex code (type L to list all codes): c If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information. Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'. Command (m for help): p Disk sd.dd: 2 GiB, 2148532224 bytes, 4196352 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x46245b98 Confirm that your partition table looks like this. Device Boot Start End Blocks Id System sd.dd1 2048 4095 1024 53 OnTrack DM6 Aux3 sd.dd2 4096 34815 15360 c W95 FAT32 (LBA) sd.dd3 34816 4196351 2080768 83 Linux Command (m for help): w The partition table has been altered. Syncing disks.
If you're doing this with an image file, now we tell the kernel about it so we can perform the remaining steps. If you're doing this with a real SD card, you can skip this bit:
rikishi tmp # losetup -f -P sd.dd rikishi tmp # losetup NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE /dev/loop0 0 0 0 0 /tmp/sd.dd
You should see /dev/loop0, and also the partitions /dev/loop0p1, /dev/loop0p2, /dev/loop0p3.
Load on the boot-loader:
rikishi tmp # dd if=~stuartl/vrt/projects/arm/u-boot/u-boot.sd of=/dev/loop0p1 940+1 records in 940+1 records out 481776 bytes (482 kB) copied, 0.0485369 s, 9.9 MB/s
Format the partition for the kernel and device tree, then copy those files in.
rikishi tmp # mkdosfs /dev/loop0p2 mkfs.fat 3.0.26 (2014-03-07) unable to get drive geometry, using default 255/63 rikishi tmp # mount /dev/loop0p2 /mnt/floppy/ rikishi tmp # cp ~stuartl/vrt/projects/arm/linux-stable/arch/arm/boot/zImage \ ~stuartl/vrt/projects/arm/linux-stable/arch/arm/boot/dts/imx28-technologic-ts7400.dtb \ /mnt/floppy/ rikishi tmp # umount /mnt/floppy
Finally, format your root partition, populate it with your root FS and copy in the modules.
rikishi tmp # mkfs.ext4 /dev/loop0p3 mke2fs 1.42.7 (21-Jan-2013) Discarding device blocks: done Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 130048 inodes, 520192 blocks 26009 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=532676608 16 block groups 32768 blocks per group, 32768 fragments per group 8128 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done rikishi tmp # mount /dev/loop0p3 /mnt/floppy rikishi tmp # # copy your root FS to /mnt/floppy (e.g. rsync from your # existing SD card image or perhaps this) rikishi tmp # tar -C /mnt/floppy -xvf \ ~stuartl/vrt/projects/arm/linux-stable/linux-3.15.5-vrt-ts7670-00005-g8c4e6cb-arm.tar lib lib/modules/ lib/modules/3.15.5-vrt-ts7670-00005-g8c4e6cb/ ... etc ... rikishi tmp # umount /mnt/floppy
Voila, your SD card or image is complete.
-- Stuart Longland <stuartl@vrt.com.au>