OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

[/] [amber/] [trunk/] [sw/] [vmlinux/] [README.txt] - Blame information for rev 69

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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
# Create the Linux build directory
45
test -e ${LINUX_WORK_DIR} || mkdir ${LINUX_WORK_DIR}
46
cd ${LINUX_WORK_DIR}
47
 
48
# Download the kernel source
49
wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.27.tar.gz
50
tar zxf linux-2.4.27.tar.gz
51
ln -s linux-2.4.27 linux
52 55 csantifort
cd ${LINUX_WORK_DIR}/linux
53 22 csantifort
 
54
#Apply 2 patch files
55
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-vrs1.bz2 .
56
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-amber2.bz2 .
57
bzip2 -d patch-2.4.27-vrs1.bz2
58
bzip2 -d patch-2.4.27-amber2.bz2
59
patch -p1 < patch-2.4.27-vrs1
60
patch -p1 < patch-2.4.27-amber2
61
 
62
# Build the kernel and create a .mem file for simulations
63
make dep
64
make vmlinux
65
 
66
cp vmlinux vmlinux_unstripped
67
${AMBER_CROSSTOOL}-objcopy -R .comment -R .note vmlinux
68
${AMBER_CROSSTOOL}-objcopy --change-addresses -0x02000000 vmlinux
69
$AMBER_BASE/sw/tools/amber-elfsplitter vmlinux > vmlinux.mem
70 48 csantifort
 
71 22 csantifort
# Add the ram disk image to the .mem file
72 48 csantifort
# You can use one of the provided disk images or generate your own (see below)
73
$AMBER_BASE/sw/tools/amber-bin2mem ${AMBER_BASE}/sw/vmlinux/initrd-200k-hello-world 800000 >> vmlinux.mem
74
${AMBER_CROSSTOOL}-objdump -C -S -EL vmlinux_unstripped > vmlinux.dis
75 22 csantifort
cp vmlinux.mem $AMBER_BASE/sw/vmlinux/vmlinux.mem
76
cp vmlinux.dis $AMBER_BASE/sw/vmlinux/vmlinux.dis
77
 
78
# Run the Linux simulation to verify that you have a good kernel image
79
cd $AMBER_BASE/hw/sim
80 55 csantifort
./run vmlinux
81 22 csantifort
 
82
 
83
# +++++++++++++++++++++++++++++++++++++++++++
84
# How to create your own initrd file
85
# +++++++++++++++++++++++++++++++++++++++++++
86
This file is the disk image that Linux mounts as
87
part of the boot process. It contains a bare bones Linux directory
88 24 csantifort
structure and an init file (which is just hello-world renamed).
89 22 csantifort
 
90
# Set the location on your system where the Amber project is located
91
export AMBER_BASE=/proj/opencores-svn/trunk
92
 
93
# Pick a directory on your system where you want to build Linux
94
export LINUX_WORK_DIR=/proj/amber2-linux
95
 
96
 
97 48 csantifort
# Create the Linux build directory
98
test -e ${LINUX_WORK_DIR} || mkdir ${LINUX_WORK_DIR}
99 22 csantifort
cd ${LINUX_WORK_DIR}
100 48 csantifort
 
101 22 csantifort
# Need root permissions to mount disks
102 49 csantifort
sudo dd if=/dev/zero of=initrd bs=200k count=1
103 55 csantifort
#sudo dd if=/dev/zero of=initrd bs=800k count=1
104 49 csantifort
sudo mke2fs -F -m0 -b 1024 initrd
105 22 csantifort
 
106
mkdir mnt
107 49 csantifort
sudo mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
108 22 csantifort
 
109
# Add files
110 49 csantifort
sudo mkdir ${LINUX_WORK_DIR}/mnt/sbin
111
sudo mkdir ${LINUX_WORK_DIR}/mnt/dev
112
sudo mkdir ${LINUX_WORK_DIR}/mnt/bin
113
sudo mkdir ${LINUX_WORK_DIR}/mnt/etc
114
sudo mkdir ${LINUX_WORK_DIR}/mnt/proc
115
sudo mkdir ${LINUX_WORK_DIR}/mnt/lib
116 22 csantifort
 
117 49 csantifort
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/console c 5 1
118
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/tty2 c 4 2
119
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/null c 1 3
120
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
121
sudo chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
122 22 csantifort
 
123 49 csantifort
sudo cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
124
#sudo cp $AMBER_BASE/sw/dhry/dhry.flt ${LINUX_WORK_DIR}/mnt/sbin/init
125
sudo chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
126 22 csantifort
 
127
# Check
128
df ${LINUX_WORK_DIR}/mnt
129
 
130
# Unmount
131 49 csantifort
sudo umount ${LINUX_WORK_DIR}/mnt
132 55 csantifort
sudo rm -rf ${LINUX_WORK_DIR}/mnt
133 22 csantifort
 
134 48 csantifort
cp initrd $AMBER_BASE/sw/vmlinux/initrd-
135 55 csantifort
#cp initrd $AMBER_BASE/sw/vmlinux/initrd-800k-busybox
136 48 csantifort
 
137
---
138
 
139
If 200k is not large enough, you can change the size as follows.
140
You'll need to change a couple of values in the ATAG data structure defined in the
141
boot loader. Specifically the ATAG_RAMDISK_SIZE parameter and the ATAG_INITRD_SIZE
142
parameter in file $AMBER_BASE/sw/boot-loader/start.S. Then create an initrd image
143
with a different bs number, for example;
144
dd if=/dev/zero of=initrd bs=400k count=1
145
 
146
The initrd image size gets picked up automatically by the kernel, as long as the
147
ram disk defined in the ATAG data is large enough to contain it.
148
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.