| 1 |
22 |
csantifort |
File in this directory:
|
| 2 |
|
|
initrd A disk image needed if you want to build the
|
| 3 |
|
|
Amber Linux kernel from sources
|
| 4 |
|
|
patch-2.4.27-amber2.bz2 Amber Linux patch file
|
| 5 |
|
|
patch-2.4.27-vrs1.bz2 ARM Linux patch file
|
| 6 |
|
|
README.txt This file
|
| 7 |
40 |
csantifort |
vmlinux Kernel executable file
|
| 8 |
45 |
csantifort |
vmlinux.dis.bz2 Kernel disassembly file, bzip2 compressed
|
| 9 |
|
|
vmlinux.mem.bz2 Kernel .mem file for Verilog simulations, bzip2 compressed
|
| 10 |
22 |
csantifort |
If you build the kernal from source these 2 files
|
| 11 |
|
|
get replaced.
|
| 12 |
|
|
|
| 13 |
48 |
csantifort |
|
| 14 |
40 |
csantifort |
# +++++++++++++++++++++++++++++++++++++++++++
|
| 15 |
|
|
# How to run Amber Linux kernel on a development board
|
| 16 |
|
|
# +++++++++++++++++++++++++++++++++++++++++++
|
| 17 |
48 |
csantifort |
1. Download the bitfile to configure the FPGA using Impact or Chipscope
|
| 18 |
40 |
csantifort |
2. Connect HyperTerminal to the serial port on the FPGA to connect to the boot loader
|
| 19 |
|
|
3. Download the disk image
|
| 20 |
|
|
> b 800000
|
| 21 |
48 |
csantifort |
Then select one of the provided disk image files to transfer, e.g.
|
| 22 |
|
|
$AMBER_BASE/sw/vmlinux/initrd-200k-hello-world
|
| 23 |
|
|
|
| 24 |
40 |
csantifort |
4. Download the kernel image
|
| 25 |
|
|
> l
|
| 26 |
|
|
Then select the file $AMBER_BASE/sw/vmlinux/vmlinux to transfer
|
| 27 |
22 |
csantifort |
|
| 28 |
48 |
csantifort |
5. Execute the kernel
|
| 29 |
|
|
> j 80000
|
| 30 |
40 |
csantifort |
|
| 31 |
48 |
csantifort |
|
| 32 |
22 |
csantifort |
# +++++++++++++++++++++++++++++++++++++++++++
|
| 33 |
|
|
# How to build Amber Linux kernel from source
|
| 34 |
|
|
# +++++++++++++++++++++++++++++++++++++++++++
|
| 35 |
|
|
# If you also want to create your own initrd disk image,
|
| 36 |
|
|
# then follow that procedure (below) first.
|
| 37 |
|
|
|
| 38 |
|
|
# Set the location on your system where the Amber project is located
|
| 39 |
|
|
export AMBER_BASE=/proj/opencores-svn/trunk
|
| 40 |
|
|
|
| 41 |
|
|
# Pick a directory on your system where you want to build Linux
|
| 42 |
|
|
export LINUX_WORK_DIR=/proj/amber2-linux
|
| 43 |
|
|
|
| 44 |
|
|
export AMBER_CROSSTOOL=arm-none-linux-gnueabi
|
| 45 |
|
|
|
| 46 |
|
|
|
| 47 |
|
|
# Create the Linux build directory
|
| 48 |
|
|
test -e ${LINUX_WORK_DIR} || mkdir ${LINUX_WORK_DIR}
|
| 49 |
|
|
cd ${LINUX_WORK_DIR}
|
| 50 |
|
|
|
| 51 |
|
|
# Download the kernel source
|
| 52 |
|
|
wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.27.tar.gz
|
| 53 |
|
|
tar zxf linux-2.4.27.tar.gz
|
| 54 |
|
|
ln -s linux-2.4.27 linux
|
| 55 |
|
|
cd linux
|
| 56 |
|
|
|
| 57 |
|
|
#Apply 2 patch files
|
| 58 |
|
|
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-vrs1.bz2 .
|
| 59 |
|
|
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-amber2.bz2 .
|
| 60 |
|
|
bzip2 -d patch-2.4.27-vrs1.bz2
|
| 61 |
|
|
bzip2 -d patch-2.4.27-amber2.bz2
|
| 62 |
|
|
patch -p1 < patch-2.4.27-vrs1
|
| 63 |
|
|
patch -p1 < patch-2.4.27-amber2
|
| 64 |
|
|
|
| 65 |
|
|
# Build the kernel and create a .mem file for simulations
|
| 66 |
|
|
make dep
|
| 67 |
|
|
make vmlinux
|
| 68 |
|
|
|
| 69 |
|
|
cp vmlinux vmlinux_unstripped
|
| 70 |
|
|
${AMBER_CROSSTOOL}-objcopy -R .comment -R .note vmlinux
|
| 71 |
|
|
${AMBER_CROSSTOOL}-objcopy --change-addresses -0x02000000 vmlinux
|
| 72 |
|
|
$AMBER_BASE/sw/tools/amber-elfsplitter vmlinux > vmlinux.mem
|
| 73 |
48 |
csantifort |
|
| 74 |
22 |
csantifort |
# Add the ram disk image to the .mem file
|
| 75 |
48 |
csantifort |
# You can use one of the provided disk images or generate your own (see below)
|
| 76 |
|
|
$AMBER_BASE/sw/tools/amber-bin2mem ${AMBER_BASE}/sw/vmlinux/initrd-200k-hello-world 800000 >> vmlinux.mem
|
| 77 |
|
|
${AMBER_CROSSTOOL}-objdump -C -S -EL vmlinux_unstripped > vmlinux.dis
|
| 78 |
22 |
csantifort |
cp vmlinux.mem $AMBER_BASE/sw/vmlinux/vmlinux.mem
|
| 79 |
|
|
cp vmlinux.dis $AMBER_BASE/sw/vmlinux/vmlinux.dis
|
| 80 |
|
|
|
| 81 |
|
|
# Run the Linux simulation to verify that you have a good kernel image
|
| 82 |
|
|
cd $AMBER_BASE/hw/sim
|
| 83 |
|
|
run vmlinux
|
| 84 |
|
|
|
| 85 |
|
|
|
| 86 |
|
|
# +++++++++++++++++++++++++++++++++++++++++++
|
| 87 |
|
|
# How to create your own initrd file
|
| 88 |
|
|
# +++++++++++++++++++++++++++++++++++++++++++
|
| 89 |
|
|
This file is the disk image that Linux mounts as
|
| 90 |
|
|
part of the boot process. It contains a bare bones Linux directory
|
| 91 |
24 |
csantifort |
structure and an init file (which is just hello-world renamed).
|
| 92 |
22 |
csantifort |
|
| 93 |
|
|
# Set the location on your system where the Amber project is located
|
| 94 |
|
|
export AMBER_BASE=/proj/opencores-svn/trunk
|
| 95 |
|
|
|
| 96 |
|
|
# Pick a directory on your system where you want to build Linux
|
| 97 |
|
|
export LINUX_WORK_DIR=/proj/amber2-linux
|
| 98 |
|
|
|
| 99 |
|
|
|
| 100 |
48 |
csantifort |
# Create the Linux build directory
|
| 101 |
|
|
test -e ${LINUX_WORK_DIR} || mkdir ${LINUX_WORK_DIR}
|
| 102 |
22 |
csantifort |
cd ${LINUX_WORK_DIR}
|
| 103 |
48 |
csantifort |
|
| 104 |
22 |
csantifort |
# Need root permissions to mount disks
|
| 105 |
49 |
csantifort |
sudo dd if=/dev/zero of=initrd bs=200k count=1
|
| 106 |
|
|
#sudo dd if=/dev/zero of=initrd bs=400k count=1
|
| 107 |
|
|
sudo mke2fs -F -m0 -b 1024 initrd
|
| 108 |
22 |
csantifort |
|
| 109 |
|
|
mkdir mnt
|
| 110 |
49 |
csantifort |
sudo mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
|
| 111 |
22 |
csantifort |
|
| 112 |
|
|
# Add files
|
| 113 |
49 |
csantifort |
sudo mkdir ${LINUX_WORK_DIR}/mnt/sbin
|
| 114 |
|
|
sudo mkdir ${LINUX_WORK_DIR}/mnt/dev
|
| 115 |
|
|
sudo mkdir ${LINUX_WORK_DIR}/mnt/bin
|
| 116 |
|
|
sudo mkdir ${LINUX_WORK_DIR}/mnt/etc
|
| 117 |
|
|
sudo mkdir ${LINUX_WORK_DIR}/mnt/proc
|
| 118 |
|
|
sudo mkdir ${LINUX_WORK_DIR}/mnt/lib
|
| 119 |
22 |
csantifort |
|
| 120 |
49 |
csantifort |
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/console c 5 1
|
| 121 |
|
|
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/tty2 c 4 2
|
| 122 |
|
|
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/null c 1 3
|
| 123 |
|
|
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
|
| 124 |
|
|
sudo chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
|
| 125 |
22 |
csantifort |
|
| 126 |
49 |
csantifort |
sudo cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
| 127 |
|
|
#sudo cp $AMBER_BASE/sw/dhry/dhry.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
| 128 |
|
|
#sudo cp /proj/amber2-linux/busybox-1.18.5/busybox ${LINUX_WORK_DIR}/mnt/sbin/init
|
| 129 |
|
|
sudo chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
|
| 130 |
22 |
csantifort |
|
| 131 |
|
|
# Check
|
| 132 |
|
|
df ${LINUX_WORK_DIR}/mnt
|
| 133 |
|
|
|
| 134 |
|
|
# Unmount
|
| 135 |
49 |
csantifort |
sudo umount ${LINUX_WORK_DIR}/mnt
|
| 136 |
43 |
csantifort |
rm -rf ${LINUX_WORK_DIR}/mnt
|
| 137 |
22 |
csantifort |
|
| 138 |
48 |
csantifort |
cp initrd $AMBER_BASE/sw/vmlinux/initrd-
|
| 139 |
49 |
csantifort |
#cp initrd $AMBER_BASE/sw/vmlinux/initrd-400k-busybox
|
| 140 |
48 |
csantifort |
|
| 141 |
|
|
---
|
| 142 |
|
|
|
| 143 |
|
|
If 200k is not large enough, you can change the size as follows.
|
| 144 |
|
|
You'll need to change a couple of values in the ATAG data structure defined in the
|
| 145 |
|
|
boot loader. Specifically the ATAG_RAMDISK_SIZE parameter and the ATAG_INITRD_SIZE
|
| 146 |
|
|
parameter in file $AMBER_BASE/sw/boot-loader/start.S. Then create an initrd image
|
| 147 |
|
|
with a different bs number, for example;
|
| 148 |
|
|
dd if=/dev/zero of=initrd bs=400k count=1
|
| 149 |
|
|
|
| 150 |
|
|
The initrd image size gets picked up automatically by the kernel, as long as the
|
| 151 |
|
|
ram disk defined in the ATAG data is large enough to contain it.
|
| 152 |
|
|
|