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

Subversion Repositories amber

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

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
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
su root
106
dd if=/dev/zero of=initrd bs=200k count=1
107
mke2fs -F -m0 -b 1024 initrd
108
 
109
mkdir mnt
110
mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
111
 
112
# Add files
113
mkdir ${LINUX_WORK_DIR}/mnt/sbin
114
mkdir ${LINUX_WORK_DIR}/mnt/dev
115
mkdir ${LINUX_WORK_DIR}/mnt/bin
116
mkdir ${LINUX_WORK_DIR}/mnt/etc
117
mkdir ${LINUX_WORK_DIR}/mnt/proc
118
mkdir ${LINUX_WORK_DIR}/mnt/lib
119
 
120
mknod ${LINUX_WORK_DIR}/mnt/dev/console c 5 1
121
mknod ${LINUX_WORK_DIR}/mnt/dev/tty2 c 4 2
122
mknod ${LINUX_WORK_DIR}/mnt/dev/null c 1 3
123
mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
124
chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
125
 
126 43 csantifort
cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
127 48 csantifort
#cp $AMBER_BASE/sw/dhry/dhry.flt ${LINUX_WORK_DIR}/mnt/sbin/init
128 22 csantifort
chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
129
 
130
# Check
131
df ${LINUX_WORK_DIR}/mnt
132
 
133
# Unmount
134
umount ${LINUX_WORK_DIR}/mnt
135 43 csantifort
rm -rf ${LINUX_WORK_DIR}/mnt
136 48 csantifort
exit # from being root
137 22 csantifort
 
138 48 csantifort
cp initrd $AMBER_BASE/sw/vmlinux/initrd-
139
 
140
---
141
 
142
If 200k is not large enough, you can change the size as follows.
143
You'll need to change a couple of values in the ATAG data structure defined in the
144
boot loader. Specifically the ATAG_RAMDISK_SIZE parameter and the ATAG_INITRD_SIZE
145
parameter in file $AMBER_BASE/sw/boot-loader/start.S. Then create an initrd image
146
with a different bs number, for example;
147
dd if=/dev/zero of=initrd bs=400k count=1
148
 
149
The initrd image size gets picked up automatically by the kernel, as long as the
150
ram disk defined in the ATAG data is large enough to contain it.
151
 

powered by: WebSVN 2.1.0

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