docs

a slatepencil documentail site

View on GitHub

create mini-linux file system

cross compiler

ls /usr/local/arm/arm-2009q3
# arm-none-linux-gnueabi  bin  lib  libexec  share

Busybox-1.22.1

cd ~/busybox-1.22.1
make menuconfig
# Busybox Settings => Build Options => Cross Compiler Prefix => `arm-none-linux-gnueabi-`
# Busybox Settings => Installation Options => BusyBox installation Prefix => `../minilinux`
make
make install
cd ~/minilinux
ls
# bin linuxrc sbin usr

create necessary files and folder

mkdir dev etc lib mnt proc sys tmp var
cd etc
mkdir init.d rc.d
cd rc.d
mkdir init.d
cd ~/minilinux/var
mkdir lib lock log run tmp
cd ~/minilinux/etc
IP=192.168.1.230
Mask=255.255.255.0
Gateway=192.168.1.1
DNS=192.168.1.1
MAC=08:90:90:90:90:90
root::0:0:root:/:/bin/sh
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/sbin:
nobody:*:99:99:Nobody:/:
# Ash profile
# vim: syntax=sh

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
PS1='[$USER@$HOSTNAME]# '
PATH=$PATH

HOSTNAME=`/bin/hostname`

export USER LOGNAME PS1 PATH
#!/bin/sh

echo -n Try to bring eth0 interface up......>/dev/ttySAC2

if [ -f /etc/eth0-setting ] ; then
        source /etc/eth0-setting

        if grep -q "^/dev/root / nfs " /etc/mtab ; then
                echo -n NFS root ... > /dev/ttySAC2
        else
                ifconfig eth0 down
                ifconfig eth0 hw ether $MAC
                ifconfig eth0 $IP netmask $Mask up
                route add default gw $Gateway
        fi

        echo nameserver $DNS > /etc/resolv.conf
else

        if grep -q "^/dev/root / nfs " /etc/mtab ; then
                echo -n NFS root ... > /dev/ttySAC2
        else
        /sbin/ifconfig eth0 192.168.253.12 netmask 255.255.255.0 up
        fi
fi

echo Done > /dev/ttySAC2
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel

#
#       Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
trap ":" INT QUIT TSTP
/bin/hostname iTOP-4412

#/bin/mount -n -t proc none /proc
#/bin/mount -n -t sysfs none /sys
#/bin/mount -n -t usbfs none /proc/bus/usb
#/bin/mount -t ramfs none /dev
[ -e /proc/1 ]    || /bin/mount -n -t proc  none /proc
[ -e /sys/class ] || /bin/mount -n -t sysfs none /sys
[ -e /dev/tty ]   || /bin/mount    -t ramfs none /dev

echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s
#/bin/hotplug
# mounting file system specified in /etc/fstab
mkdir -p /dev/pts
mkdir -p /dev/shm
/bin/mount -n -t devpts none /dev/pts -o mode=0622
/bin/mount -n -t tmpfs tmpfs /dev/shm
#/bin/mount -n -t ramfs none /tmp
#/bin/mount -n -t ramfs none /var
mkdir -p /var/empty
mkdir -p /var/log
mkdir -p /var/log/boa
mkdir -p /var/lock
mkdir -p /var/run
mkdir -p /var/tmp

ln -sf /dev/ttyS2 /dev/tty2
ln -sf /dev/ttyS2 /dev/tty3
ln -sf /dev/ttyS2 /dev/tty4

syslogd
/etc/rc.d/init.d/netd start
echo "                        " > /dev/tty1
echo "Starting networking..." > /dev/tty1
#sleep 1
#/etc/rc.d/init.d/httpd start
#echo "                        " > /dev/tty1
#echo "Starting web server..." > /dev/tty1
#sleep 1
#/etc/rc.d/init.d/leds start
#echo "                        " > /dev/tty1
#echo "Starting leds service..." > /dev/tty1
#echo "                        "
#sleep 1
mkdir /mnt/disk

sleep 1
/sbin/ifconfig lo 127.0.0.1
/etc/init.d/ifconfig-eth0
#!/bin/sh

base=inetd

# See how we were called.
case "$1" in
  start)
                /usr/sbin/$base
        ;;
  stop)
        pid=`/bin/pidof $base`
        if [ -n "$pid" ]; then
                kill -9 $pid
        fi
        ;;
esac

exit 0

use linux_tools.taz

create image

Creating filesystem with parameters:
  Size: 314572800
  Block size: 4096
  Blocks per group: 32768
  Inodes per group: 6400
  Inode size: 256
  Journal blocks: 1200
  Label: linux
  Blocks: 76800
  Block groups: 3
  Reserved block group size: 23
Created filesystem with 439/19200 inodes and 4624/76800 blocks
# system.img

flash to iTOP-4412

test

#include <stdio.h>

main()
{
        printf("Hello World!\n");
}