From 60eb2616ed83209b8e46aba14c19814ab4f4c1c6 Mon Sep 17 00:00:00 2001 From: ficus Date: Thu, 4 Oct 2012 16:13:54 +0200 Subject: sd card refactor --- doc/sd_card.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ doc/uboot.txt | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 doc/sd_card.txt create mode 100644 doc/uboot.txt (limited to 'doc') diff --git a/doc/sd_card.txt b/doc/sd_card.txt new file mode 100644 index 0000000..25a2d65 --- /dev/null +++ b/doc/sd_card.txt @@ -0,0 +1,44 @@ + +torouter is intended to boot and run from an SD. it could theoretically also +run from an internal microSD card, a USB stick, or an eSATA drive, but +specifying use of the SD card makes support, development, and documentation +easier. the SD card can easily be popped out of the router and reflashed with a +new image. + +The SD card should be at least 2GB in size and support reasonable read/write +speeds, so probably a "class 6" quality card, which can be ########## + +you really should get a decent card: there can be an order of magnitude +difference in performance between a cheap card and a fast card. + +quick (but shady?) way to check read and write card performance on a +high-performance machine: + + $ # unmount the card for read test + $ hdparm -t /dev/sdb # iff /dev/sdb is the card + $ # mount the card for write test + $ dd count=10 bs=1M if=/dev/urandom of=/mnt/disktest + + +HOWTO Prepare an SD Card for building (using debian) +-------------------------------------------------------- + +Insert a 4GB+ SD card into to your dev computer (using an adapter if necessary). + +Use lsblk to figure out which block device the card is (eg, /dev/sdc). + +Use gparted (as root) to create two logical paritions: first, a 128MB FAT32 +(msdos) boot partition, and second an ext4 root partition using the remainder +of the space. + +Once the paritions are created, and you have confirmed that the partitions +exist and are in the correct order (eg, small boot on /dev/sdc1, rootfs on +/dev/sdc2), you are ready to copy over a fresh build using +freedom-maker/copy2card.sh and then create an image file using +freedom-maker/copy2img.sh. + +Optionally, follow these directions to generate block-aligned partitions for +better write performance: + +http://linux-howto-guide.blogspot.de/2009/10/increase-usb-flash-drive-write-speed.html +http://www.olpcnews.com/forum/index.php?topic=4993.0 diff --git a/doc/uboot.txt b/doc/uboot.txt new file mode 100644 index 0000000..8904980 --- /dev/null +++ b/doc/uboot.txt @@ -0,0 +1,45 @@ + +Factory-configured DreamPlugs need their internal u-boot firmware updated and +re-configured to boot from the SD card. + +You may want to remove the internal microSD card for the sake of simplicity. +This will result in u-boot and linux boot warnings, but these can be ignored. + +The desired u-boot configuration is: + + baudrate=115200 + bootargs=console=ttyS0,115200 root=/dev/sdb2 rootdelay=10 + bootcmd=${x_bootcmd_usb}; ${x_bootcmd_kernel}; ${x_bootcmd_initrd}; setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm 0x6400000 0x6900000; + x_bootargs=console=ttyS0,115200 + x_bootargs_root=root=/dev/sdb2 rootdelay=10 + x_bootcmd_initrd=fatload usb 1:1 0x6900000 uInitrd + x_bootcmd_kernel=fatload usb 1:1 0x6400000 uImage + x_bootcmd_usb=usb start + +HOWTO: flash and configure u-boot +----------------------------------- + +The default SD card images include the u-boot firmware required to boot from +the card. Insert a flashed SD card into the DreamPlug and connect with screen: + + $ screen /dev/ttyUSB0 115200 + +Power up the DreamPlug and quickly press enter in the screen session to +interrupt boot. Then enter the following commands into the running u-boot +session (change the last argument of the 'sf write' line, in hex, if the .kwb +file size changes from exactly 196076 bytes): + + usb start + fatload usb 1 0x6400000 uboot.2012.04.01-2_armel.kwb + sf probe 0 + sf erase 0x0 0x80000 + sf write 0x6400000 0x0 0x2fdec + setenv baudrate 115200 + setenv bootcmd '${x_bootcmd_usb}; ${x_bootcmd_kernel}; ${x_bootcmd_initrd}; setenv bootargs ${x_bootargs} ${x_bootargs_root} ${x_bootargs_console}; bootm 0x6400000 0x6900000;' + setenv x_bootargs_console 'ttyS0,115200' + setenv x_bootargs_root 'root=/dev/sdb2 rootdelay=10' + setenv x_bootcmd_initrd 'fatload usb 1:1 0x6900000 uInitrd' + setenv x_bootcmd_kernel 'fatload usb 1:1 0x6400000 uImage' + setenv x_bootcmd_usb 'usb start' + saveenv + reset -- cgit v1.2.3