-*- text -*- On compiling the arm-linux cross-toolchain: Follow the directions closely. Use gcc-2.95.3. Don't use 3.0 yet. (as-of 29 May 2001) Here's the basics of what I did: DECISION: put toolchain in /usr/local/yopy mkdir /usr/local/yopy mkdir /usr/local/yopy/arm-linux ln -s /mnt/video/yopy/2.2.14-yopy5/ /usr/local/yopy/arm-linux/linux ## /mnt/video/yopy/2.2.14-yopy5/ is where I put my kernel source, for ## reasons that are obscure cd /usr/local/yopy tar zxvf binutils-2.11.tar.gz cvs -d binutils: configure --prefix=/usr/local/yopy --target=arm-linux make make install # ran (/usr/local/conf/symlink/localfix) ## This is as script that does something like GNU stow. ## In other words, it grows forests of symlinks so everything appears ## to be installed in the same place. For most people this isn't ## important. gcc: # (applied the -Dinhibit_libc hack) ./configure --target=arm-linux --prefix=/usr/local/yopy --with-headers=/usr/local/yopy/arm-linux/linux/include --enable-languages=c --disable-threads cd gcc; ln -s config/arm arm; cd .. make -k make -k install ## A bunch of bits will fail on those steps, but that's probably okay. ## We don't have glibc yet, so some stuff isn't ready yet. (/usr/local/conf/symlink/localfix) glibc: tar zxvf glibc-2.1.3.tar.gz cd glibc-2.1.3 tar zxvf /usr/local/build/glibc-linuxthreads-2.1.3.tar.gz tar zxvf /usr/local/build/glibc-localedata-2.0.6.tar.gz tar zxvf /usr/local/build/glibc-crypt-2.1.tar.gz export CC=arm-linux-gcc mkdir /usr/local/yopy/glibc-2.1.3-build cd /usr/local/yopy/glibc-2.1.3-build ../glibc-2.1.3/configure arm-linux --build=i686-linux --prefix=/usr/local/yopy/arm-linux --enable-add-ons NOTE: prefix isn't what I normally use. --- On configuring the kernel: Note: To get the MTD option in the top-level config, you need to enable "Kernel-mode alignment trap handler" under "General setup". Q: According to http://www.yopydeveloper.org/documentation/documentation_07-05-1.html, the YOPY has 32 bit wide bus to the flash, and has 2 chips per bank. Does this mean that 2-chip flash interleave is the right kernel option? A: Apparently. That was the default, and when I eventually got 2.4.2-yopy1 to build sucessfully, that seemed to work. Q: The 2.2.14-yopy5 kernel source (arch/arm/kernel/yopy.c, for example) seems to indicate that the YOPY uses a UCB1200. In 2.4.4-rmk3-np1, there is support for UCB1200 touchscreen, audio, and ADC(?). Will this stuff work on the YOPY? Partial Answer: the -yopy1 patches change this code, but it still uses the UCB1200. Probably in the future the yopy code should be reviewed to integrate it into the rmk or np series. Q: Is there any reason not to use JFFS2 exclusively? How do I load the jffs2 image onto the device? (At what address?) How do I tell the kernel to use that as the root? (What is it's proper device name?) (Answers are probably in the MTD docs that I haven't read yet.) A: (Success!) JFFS2 works fine as sole filesystem. Load the jffs2 image using 'flash fsm' in the bootloader, which will start the filesystem image at 0x00100000. Change drivers/mtd/sa1100-flash.c so that the address of a partition (I used "root") in the YOPY section is 0x00100000 and length is 0x01f00000 (or whatever you want these numbers to be). Boot using root=/dev/mtdblock3, where 3 is the partition with the correct address/length (counting from zero). I wonder if anyone is actually working on XIP (eXecute In Place) for ARM... it's mentioned as a TODO for the MTD guys. I've seen some other projects that mentioned XIP on MIPS, but not for ARM. What kind of partition types are appropriate for the YOPY, if any? Is this covered completely by the "MTD partitioning support" option? Q: Will the SA-1100 LCD support in 2.4.4-rmk3-np1 work as the framebuffer device, or do I need something different? A: The YOPY doesn't use the SA-1100 LCD support. I need a kernel with the YOPY screen driver. Note: I built 2.4.2-yopy1 myself. I twiddled the config options slightly, and now I can't adjust the brightness of the backlight. Q: What did I change that caused this? A: I mis-diagnosed the cause of the problem. You can't adjust the backlight after sleeping and resuming. As it turns out, building a kernel with MTD support compiled in and totaling less than a megabyte of space turns out to be hard. Almost everything else you might want to do needs to be turned off or built as modules. There are three fixes: 1. Port the bzip decompressor to the ARM. This is probably beyond my ken, but would be the most useful. 2. Figure out how to set aside more flash for the kernel. The bootloader (as shipped) is 37772 bytes. The space reserved for it is 262144 bytes. (0x00040000). If we just start the kernel earlier, we're golden. But I don't know how MTD decides where the flash partitions are... 3. Just go ahead and turn everything off except MTD, and JFFS2. I don't know if it's okay to turn some of this stuff off. For instance, can I turn off SA1100 LCD support? The YOPY doesn't use the SA1100 LCD hardware... or not for oerating the LCD, at least. Solution: it wasn't as hard as I thought. I'm not sure what I had turned on that made it so big. I went back to the stock config from the 2.4.2-yopy1 tarball, and then adjusted that, and came in under a half-megabyte without much problem. Note: the "power" button won't work if the gpio module isn't loaded. make ARCH=arm CROSS_COMPILE=arm-linux- config --- On building the kernel: arm-linux-ld: cannot open drivers/net/pcmcia/pcmcia_net.o: No such file or directory I had to turn on ext2 and a pcmcia_net driver to get the kernel to build properly. This may have been due to a earlier failed compile. (I think I didn't 'make clean'.) --- On the boot loader: Boot Loader: target mach_type 40 (rev 0000, serial 00000000:00000000) kernel entry 0x00080000, command line "" initrd off, offset 0x00100000, start 0xc0800000, size 3072KB monitor base 0xc0010000 Flash: 2 units of 'Intel 3V StrataFlash 28F128J3A' detected at 0x00000000. Total size is 32MB(128Mb * 2) RAM: 16MB(16384KB) detected. Memory: text 0xc0010000 - 0xc0018c40 35904B data 0xc0018c40 - 0xc001937c 1852B bss 0xc001a000 - 0xc0024668 42600B stack 0xc001a000 - 0xc0022000 32768B user 0xc0025000 - 0xc1000000 16236KB [zboot] set mach_type 0x0028 mach_revision 0x0000 mach_serial 00000000:00000000 root 104,0(68:00): /dev/fsma fsm_offset 0x00100000 jffs_offset 0x00400000 jffs_size 0x01000000 initrd_load false initrd_offset 0x00100000 initrd_size 0x00300000 initrd_start 0xc0800000 kernel_entry 0x00080000 kernel_cmdline The difference between fsm_offset and kernel_entry is half a megabyte. Does this mean that the kernel can't be larger than that? [zboot] set root /dev/mtdblock2 root 31,2(1f:02): /dev/mtdblock2 --- On MTD : Start of the file system image: (according to YOPY docs) 0h0010 0000 0x0200 0000 (total flash) 0x01f0 0000 (difference) In order for the MTD modules to work properly, sa1100-flash must be loaded. (This was when I was using FSM, and I loaded the MTD modules) # cat /proc/mtd dev: size erasesize name mtd0: 00040000 00040000 "" mtd1: 000c0000 00040000 "" mtd2: 01f00000 00040000 "" Assume that mtd0 starts at 0x00000000 (and holds the bootloader) Then figure mtd1 starts at 0x00040000 (and holds the kernel image) and so thus mtd2 starts at 0x00100000 (and holds the filesystem) It checks that mtd2 is exactly the same address as zboot says fsm is. Cool, except that zboot says that the kernel entry point is 0x00080000 But the numbers do agree with http://www.yopydeveloper.org/documentation/documentation_07-07-1.html And plausibly, if we build mtd into the kernel, change the root device to mtd2, and use zboot to flash a jffs2 image there, things will work. But... (This was when I actually booted with JFFS2 the first time) (Which was with the image burned into jffs and root=/dev/mtdblock3 # cat /proc/mtd dev: size erasesize name mtd0: 00040000 00040000 "boot firmware" mtd1: 00080000 00040000 "kernel" mtd2: 00300000 00040000 "initrd" mtd3: 01000000 00040000 "root" EUREKA! As it turns out, these partition sizes are hard-coded into sa1100_flash.c crw-r--r-- 1 root root 90, 0 Dec 18 2000 /dev/mtd0 crw-r--r-- 1 root root 90, 1 Dec 18 2000 /dev/mtd1 crw-r--r-- 1 root root 90, 2 Dec 18 2000 /dev/mtd2 crw-r--r-- 1 root root 90, 3 Dec 18 2000 /dev/mtd3 brw-r--r-- 1 root root 31, 0 Dec 18 2000 /dev/mtdblock0 brw-r--r-- 1 root root 31, 1 Dec 18 2000 /dev/mtdblock1 brw-r--r-- 1 root root 31, 2 Dec 18 2000 /dev/mtdblock2 brw-r--r-- 1 root root 31, 3 Dec 18 2000 /dev/mtdblock3 brw-r--r-- 1 root root 104, 0 Jan 29 2000 /dev/fsma brw-r--r-- 1 root root 104, 16 Jan 29 2000 /dev/fsmb -- On JFFS2: To make the full-blown system, I had to: 1. make a jffs2 image 2. make a kernel image with jffs2 support and correct partition map 3. install them on the yopy I did (1) by using yopy-diskfiles-1.2.tar.gz and mkfs.jffs2. I customized the filesystem on the dev host before I made the jffs2 image; installing X, busybox 0.51, etc. I did (2) by turning on the right stuff in the kernel (which I annotated elsewhere in these notes) and changing sa1100_flash.c to have the partition map that I wanted, which was this: static struct mtd_partition yopy_partitions[] = { { name: "boot firmware", offset: 0x00000000, size: 0x00040000, mask_flags: MTD_WRITEABLE, /* force read-only */ }, { name: "kernel", offset: 0x00080000, size: 0x00080000, }, { name: "initrd", offset: 0x00100000, size: 0x00300000, }, { name: "root", offset: 0x00100000, size: 0x01F00000, }, }; The thing that is different is the offset and size of "root". Note that "root" and "initrd" overlap! To install the jffs2 filesystem on the yopy, I used the bootloader to copy the jffs2 image into the right memory addresses. I didn't take notes on how I did this, and it was two weeks ago, and I've forgotten the details. I *think* all I needed to do was 'flash fsm' in zboot. (The fsm offset in zboot is what I changed 'root' to in yopy_partitions, above). --- On running diff: diff -urNw -X dontdiff 2.4.4-rmk3-np1/arch/arm/boot/ 2.4.2-yopy1/arch/arm/boot/ |less -u is for favored diff notation -r is recursive -N is treat missing files as empty -w is ingore whitespace -X loads file with patterns of filenames to ignore --- On waking from sleep: On sa1100-linux mailing list, (archived at "http://www.lart.tudelft.nl/list/list.php3?arc=sa1100-linux"), the claim is made that wake from sleep requires bootloader support. Is this true? Does zboot include the required functionality? (I have the source. I should go look.) If not, is it possible to use a different bootloader (e.g. blob)? More importantly, how do I do it? i.e. How does a user-mode program tell the YOPY to wake up at a specific time? http://handhelds.org/SourceForge/projects/sa1100rtc/ Eureka! the bootloader doesn't matter... the kernel supports it via the above module (sa1100-rtc). With that module, if you set an alarm using the correct ioctl() on /dev/rtc, when the alarm goes off, the yopy wakes itself up! Slick! --- On building perl: perl doesn't use autoconf, so it's not trivial to cross compile it. If you just set CC=arm-linux-gnu, the configure script fails when trying to run a test program. I tried to build it natively on the skiff cluster. Early attempts failed with error in the compiler, and a later attempt locked up skiffcluster5. Obviously it's possible to build perl because it's already installed on the skiffcluster machines. --- On Video RAM: I'm amused to note that according to the hardware docs, the yopy has 2MB of SDRAM as the video RAM at 0x4800000. That's enough for 1024x1024 16-bit pixels. Considering that the screen is 240x320, there's a lot of video RAM left over. It would be a slick hack to use this memory for something else. Quite possibly the X server already does this. --- On building busybox: 0.48 (which ships with the YOPY) has bugs. Recommend upgrade to 0.51. The trick is... make CROSS=arm-linux- --- On making a jffs2 image: (cd /lib/modules/; tar cf - 2.4.2-yopy1) | (cd /home/magnus/yopy/yopy-diskfiles/lib/modules; tar xvf -) cd /home/magnus/yopy /mnt/video/yopy/mtd/util/mkfs.jffs2 -e 262144 -p --root=yopy-diskfiles -o yopy-jffs2.img It might be important to fix /etc/fstab in the image. --- INSTALL_MOD_PATH=/home/magnus/yopy/yopy-diskfiles/lib/modules make modules_install linux console=ttyS0,115200 root=/dev/mtdblock3,ro --- Stock 2.4.2-yopy1 configuration: development drivers loadable modules, no symbols SA1100-based No angel hot pluggable PCMCIA modules, SA1100-support networking sysV IPC Sysctl NWFPE Power Management Alignment trap handler UCB1200 support (not module) MTD as module CFI support Intel extended StrongARM mapping Char access Block access No PnP Loopback Unix Domain TCP/IP PPP SLIP NE2000 compatible PCMCIA support IrDA IrLAN SA1100 Internal IR ATA/IDE etc ATA disk PCMCIA IDE SA1100 serial Console on SA1100 serial 115200 baud Support YOPY frame buffer Support mobile console driver No UCB1200 touchscreen! Unix98 PTY (32 max) DOS FAT MSDOS FS VFAT YOPY FSM <*> Simple RAM-based /proc /dev/pts ext2 <*> No nfs! Advanced partitions PC BIOS partitions Codepage 437 Sound Assabet... SA-1100 SSP Verbose kernel 452252 bytes Try: UCB1200 support ? (this probably won't work) no ext2, MTD+JFFS2: 488084 bytes same with no NWFPE, FastFPE instead and MTD/JFFS2 debug: 472792 bytes --- TODO: JFFS2 (done!) wake-from-sleep IR XIP