Ok, I made some progress towards roofs-on-SD-card.
I had to 'apt-get install gcc-mipsel-linux-gnu' so the script could build u-boot.
I made an initial SD card with:
CROSS_COMPILE=mipsel-linux-gnu- ./make-flash-card-ci20-sd.sh /dev/sdc rootfs_2016_06_02/boot/uImage-3.18.3-ci20-1 rootfs_2016_06_02.tar
However, it didn't boot. After hooking up a serial console, I saw this from u-boot:
Hit any key to stop autoboot: 0
** File not found /boot/uImage **
Wrong Image Format for bootm command
ERROR: can't get kernel image!
ci20#
I was able to list the root directory from the u-boot prompt:
ci20# ext4ls mmc 0:1 /
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 16384 lost+found
<DIR> 4096 bin
<DIR> 0 boot
<DIR> 4096 dev
<DIR> 0 etc
<DIR> 4096 home
<DIR> 0 lib
<DIR> 2492 media
<DIR> 0 mnt
<DIR> 5270623 opt
<DIR> 4096 proc
<DIR> 894 root
<DIR> 0 run
<DIR> 4096 sbin
<DIR> 0 srv
<DIR> 4096 sys
<DIR> 0 tmp
<DIR> 4096 usr
<DIR> 4096 var
ci20#
But notice: a lot of those directory entries are zero-size. That's not good.
And there's nothing in /boot:
ci20# ext4ls mmc 0:1 /boot
ci20#
I mounted the SD card in a linux box and double-checked: the files are in fact present:
$ ls -1 /boot
config-3.18.3-ci20-1
System.map-3.18.3-ci20-1
uImage
uImage-3.18.3-ci20-1
vmlinux.img
I tried the suggested work-around in that link by changing the mkfs.ext4 call in the script:
sudo mkfs.ext4 -E lazy_itable_init=0 ${device}1
but that didn't work.
What did work though, was changing the script to first format as ext2:
sudo mkfs.ext2 ${device}1
then make all of the filesystem changes, then unmount and convert to ext4:
echo "Converting from ext2 to ext4"
sudo umount ${sdMount}
unset sdMount
sudo tune2fs -O extents,uninit_bg,dir_index,has_journal ${device}1
Booting the CI-20 confirms the filesystem does get mounted correctly as ext4:
$ mount | grep mmc
/dev/mmcblk0p1 on / type ext4 (rw,relatime,data=ordered)
I then switched to using Gabriele's u-boot fork which includes the RAM timing fixes:
I now have a working CI-20, running the stock Debian image, using the SD-card as rootfs, with the RAM timing fixes.
Not bad!
I'll write up a github gist which documents this and publishes the modified script.