commit bfe582374d3031adca7efaa59322785f18b3f605
parent 1f74ea05eb8be30bebaf3ba2b854e1cd97356bac
Author: parazyd <parazyd@dyne.org>
Date: Tue, 10 Oct 2017 19:22:07 +0200
add doc and arm-ramdisk.html
Diffstat:
8 files changed, 159 insertions(+), 3 deletions(-)
diff --git a/config.mk b/config.mk
@@ -1,4 +1,5 @@
MARKDOWN = smu
+#MARKDOWN = python -m markdown
WEBHOST = jakku.parazyd.cf
WEBROOT = public_html/www.parazyd.cf
@@ -6,4 +7,7 @@ WEBROOT = public_html/www.parazyd.cf
PAGES = \
index.html \
contact.html \
- projects.html
+ projects.html \
+ \
+ doc/index.html \
+ doc/arm-ramdisk.html
diff --git a/doc/arm-ramdisk.html.md b/doc/arm-ramdisk.html.md
@@ -0,0 +1,138 @@
+Setting up a sunxi board with a ramdisk and ATA over Ethernet rootfs boot
+=========================================================================
+
+This setup has been tested with the Olimex A20 Lime2 and microsd cards.
+
+
+Creating and filling the ramdisk
+--------------------------------
+
+First let's create our initial ramdisk that will be 8M big. Format it,
+and mount it:
+
+ # dd if=/dev/zero of=initrd.img bs=1k count=8192
+ # mke2fs -vm0 initrd.img 8192
+ # tune2fs -c 0 initrd.img
+
+ # mkdir mnt
+ # mount -o loop initrd.img ./mnt
+
+After we've done this, let's setup the fs hierarchy we'll be using:
+
+ # cd mnt
+ # mkdir -p bin dev/etherd etc mnt/root proc sys tmp usr
+ # chmod 1777 tmp
+ # touch etc/fstab
+
+We also need /dev nodes inside it.
+
+ # cp -a /dev/console /dev/null /dev/random /dev/tty /dev/urandom dev/
+
+And let's add add a statically linkedbusybox:
+
+ # cp /bin/busybox bin
+ # busybox --install -s ./bin
+
+Add more files as needed. To boot AoE, we need aoetools. Find them here:
+[https://github.com/OpenAoE/aoetools](https://github.com/OpenAoE/aoetools)
+
+
+Finally, we need an init script that will set up the things needed and
+switch root once mounted. The following scripts implies an available AoE
+mount at `/dev/etherd/e0.1p1`. It also implies having a directory called
+`old_root` in that rootfs.
+
+<hr>
+ #!/bin/busybox sh
+
+ rescue_shell() {
+ echo "$@"
+ echo " * dropping to a shell"
+ exec /bin/sh
+ }
+
+ ifconfig eth0 up || rescue_shell
+
+ mount -t sysfs none /sys
+ mount -t proc none /proc
+ echo 0 > /proc/sys/kernel/printk
+ sleep 2
+
+ echo " * discovering AoE block devices"
+ /usr/sbin/aoe-discover
+ sleep 3
+ /usr/sbin/aoe-discover
+ sleep 3
+
+ echo " * mounting AoE root"
+ mount -t ext4 -o ro /dev/etherd/e0.1p1 /mnt/root || rescue_shell
+
+ echo " * mounting to /mnt/root"
+ mount -t devtmpfs none /mnt/root/dev
+ mount -t sysfs none /mnt/root/sys
+ mount -t proc none /mnt/root/proc
+
+ echo 1 > /proc/sys/kernel/printk
+
+ echo " * pivoting root"
+ cd /mnt/root
+ pivot_root . old_root || rescue_shell "Failed pivoting"
+ umount /old_root/proc /old_root/sys /old_root/dev
+
+ echo " * exec-ing init"
+ exec /sbin/init 3 || rescue_shell "init failed"
+<hr>
+
+Kernel config
+-------------
+
+To use this setup, our kernel needs the following:
+
+ #
+ # General setup
+ #
+ ...
+ CONFIG_BLK_DEV_INITRD=y
+ CONFIG_INITRAMFS_SOURCE=""
+ ...
+
+ #
+ # UBI - Unsorted block images
+ #
+ ...
+ CONFIG_BLK_DEV_RAM=y
+ CONFIG_BLK_DEV_RAM_COUNT=1
+ CONFIG_BLK_DEV_RAM_SIZE=8192
+ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
+ ...
+
+
+U-Boot
+------
+
+For u-boot, we have to make an uInitrd out of the initrd.img we've previously
+created. This can be achieved with the following:
+
+ # mkimage -A arm -T ramdisk -C none -n uInitrd -d /path/to/initrd.img /path/to/uInitrd
+
+Copy this to the microsd card or push it in FEL mode.
+
+If we're doing the microsd card boot, we can use a boot.scr like the following:
+
+ setenv bootargs console=ttyS0,115200 root=/dev/ram0 ro rootwait
+ load mmc 0 0x43000000 ${fdtfile}
+ load mmc 0 0x41000000 zImage
+ load mmc 0 0x50000000 uInitrd
+ #setenv initrd_high 0xffffffff
+ bootz 0x41000000 0x50000000 0x43000000
+
+Convert to boot.scr:
+
+ # mkimage -A arm -T script -C none -d boot.cmd boot.scr
+
+
+Resources
+---------
+
+* [http://processors.wiki.ti.com/index.php/Initrd](http://processors.wiki.ti.com/index.php/Initrd)
+* [http://linux-sunxi.org/Initial_Ramdisk](http://linux-sunxi.org/Initial_Ramdisk)
diff --git a/doc/footer.html b/doc/footer.html
@@ -0,0 +1 @@
+../footer.html+
\ No newline at end of file
diff --git a/doc/header.html b/doc/header.html
@@ -0,0 +1 @@
+../header.html+
\ No newline at end of file
diff --git a/doc/index.html.md b/doc/index.html.md
@@ -0,0 +1,5 @@
+Knowledgebase
+=============
+
+* [Setting up a sunxi board with a ramdisk and ATA over Ethernet rootfs
+ boot](arm-ramdisk.html)
diff --git a/doc/nav.html b/doc/nav.html
@@ -0,0 +1 @@
+../nav.html+
\ No newline at end of file
diff --git a/doc/static b/doc/static
@@ -0,0 +1 @@
+../static+
\ No newline at end of file
diff --git a/nav.html b/nav.html
@@ -1,10 +1,11 @@
<div id="menu">
<ul>
<li><a href="/">home</a></li>
- <li><a href="projects.html">projects</a></li>
+ <!-- <li><a href="/doc">doc</a></li> -->
+ <li><a href="/projects.html">projects</a></li>
<li><a href="http://git.parazyd.cf">git</a></li>
<li><a href="http://pub.parazyd.cf">pub</a></li>
- <li><a href="contact.html">contact</a></li>
+ <li><a href="/contact.html">contact</a></li>
</ul>
</div>