Sunday, January 10, 2010

HOWTO build NetBSD for ARM platform

HOWTO build NetBSD on Fedora Core 9

1. Downloading sources for a NetBSD stable branch

[ ]# mkdir -p /home/NetBSD/src
[ ]# cd /home/NetBSD/src
[ ]# ftp -i ftp.NetBSD.org

ftp> cd /pub/NetBSD/NetBSD-release-4-0/tar_files/src/
ftp> mget *.tar.gz
ftp> quit

2. Decompress all tarballs
Run the following bash script:
---------------------------------------------------------------
#!/bin/sh

mkdir -p /home/NetBSD/build

for file in *.tar.gz; do
echo "untar $file"
tar -xzf $file -C /home/NetBSD/build
done
---------------------------------------------------------------

3. Compile toolchain for ARM platform

[ ]# cd /home/NetBSD/build/src
[ ]# ./build.sh -m evbarm tools

patch for compile error
(1) vi /home/NetBSD/build/src/tools/compat/../../lib/libc/gen/glob.c
---------------------------------------------------------------
#ifndef ARG_MAX
#define ARG_MAX (sysconf(_SC_ARG_MAX))
#endif
---------------------------------------------------------------

4. apply patch file for XXXXXX platform

[ ]# cd /home/NetBSD/build/src
[ ]# patch -p0 < /home/NetBSD/xxxxxx.patch
[ ]# ./build.sh -m evbarm kernel=XXXXXX
[ ]# ls -al /home/NetBSD/build/src/sys/arch/evbarm/compile/obj/XXXXXX/netbsd

5. Build File System
[ ]# cd /home/NetBSD/build/src/

6. Build NetBSD (Binary)
[ ]# nbmakefs -s 10M ramdisk.img rootfs
[ ]# arm--netbsdelf-mdsetimage -sv netbsd ramdisk.img
[ ]# arm--netbsdelf-objcopy -S -O binary netbsd netbsd.bin


Resource:
[ ]# wget ftp://ftp.tw.netbsd.org/pub/NetBSD/iso/4.0/sourcecd-4.0.iso
[ ]# wget hftp://iso.tw.netbsd.org/pub/NetBSD/iso/4.0/evbarmcd-4.0.iso

Reference:
1. Porting NetBSD to a new ARM SoC
2. http://wiki.netbsd.se/How_to_create_bootable_NetBSD_image

Saturday, December 12, 2009

Tuesday, October 27, 2009

Notification Chains

Notification Chains

For Network subsystem: example code
For System reboot: example code

Monday, October 26, 2009

Gigabit Ethernet Controller

Pseudo Linux Network Device Driver (tar.gz)

Monday, October 12, 2009

Another Beginning

Timestamp

Tuesday, September 29, 2009

Linux Timer

  • Low-Resolution Timer

  • Time Stamp: Jiffy

  • High-Resolution Timer

  • Time Stamp: Nanosecond
    Clock Base: (1) Monotonic Clock (2) Real Time Clock

  • Dynamic Tick

  • Power Management

    Objects for Time Management
    Clock Sources
    Clock Event Devices
    Tick Devices

    Saturday, September 12, 2009

    Linux IO Scheduler

    The IO Schedulers

  • No-op Scheduler

  • This scheduler only implements request merging.

  • Anticipatory IO Scheduler (AS)

  • This scheduler implements request merging, a one-way elevator, read and write request batching, and attempts some anticipatory reads by holding off a bit after a read batch if it thinks a user is going to ask for more data.

    This is optimised for the single disk systems.

  • Deadline Scheduler

  • The scheduler implements request merging, a one-way elevator, and imposes a deadline on all operations to prevent resource starvation.

  • Complete Fair Queueing Scheduler (CFQ)

  • The scheduler implements both request merging and the elevator, and attempts to give all users of a particular device the same number of IO requests over a particular time interval.

    References:
    Linux I/O Schedulers