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

Subversion Repositories amber

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

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 22 csantifort
vmlinux.dis                 Kernel disassembly file
9
vmlinux.mem                 Kernel .mem file for Verilog simulations
10
                            If you build the kernal from source these 2 files
11
                            get replaced.
12
 
13 40 csantifort
# +++++++++++++++++++++++++++++++++++++++++++
14
# How to run Amber Linux kernel on a development board
15
# +++++++++++++++++++++++++++++++++++++++++++
16
1. Download the bitfile to configure the FPGA using Impact ir Chipscope
17
2. Connect HyperTerminal to the serial port on the FPGA to connect to the boot loader
18
3. Download the disk image
19
> b 800000
20
Then select the file $AMBER_BASE/sw/vmlinux/initrd to transfer
21
4. Download the kernel image
22
> l
23
Then select the file $AMBER_BASE/sw/vmlinux/vmlinux to transfer
24
5. Execute th ekernel
25
> j
26 22 csantifort
 
27 40 csantifort
 
28 22 csantifort
# +++++++++++++++++++++++++++++++++++++++++++
29
# How to build Amber Linux kernel from source
30
# +++++++++++++++++++++++++++++++++++++++++++
31
# If you also want to create your own initrd disk image,
32
# then follow that procedure (below) first.
33
 
34
# Set the location on your system where the Amber project is located
35
export AMBER_BASE=/proj/opencores-svn/trunk
36
 
37
# Pick a directory on your system where you want to build Linux
38
export LINUX_WORK_DIR=/proj/amber2-linux
39
 
40
export AMBER_CROSSTOOL=arm-none-linux-gnueabi
41
 
42
 
43
# Create the Linux build directory
44
test -e ${LINUX_WORK_DIR} || mkdir ${LINUX_WORK_DIR}
45
cd ${LINUX_WORK_DIR}
46
 
47
# Download the kernel source
48
wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.27.tar.gz
49
tar zxf linux-2.4.27.tar.gz
50
ln -s linux-2.4.27 linux
51
cd linux
52
 
53
#Apply 2 patch files
54
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-vrs1.bz2 .
55
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-amber2.bz2 .
56
bzip2 -d patch-2.4.27-vrs1.bz2
57
bzip2 -d patch-2.4.27-amber2.bz2
58
patch -p1 < patch-2.4.27-vrs1
59
patch -p1 < patch-2.4.27-amber2
60
 
61
# Build the kernel and create a .mem file for simulations
62
make dep
63
make vmlinux
64
 
65
cp vmlinux vmlinux_unstripped
66
${AMBER_CROSSTOOL}-objcopy -R .comment -R .note vmlinux
67
${AMBER_CROSSTOOL}-objcopy --change-addresses -0x02000000 vmlinux
68
$AMBER_BASE/sw/tools/amber-elfsplitter vmlinux > vmlinux.mem
69
# Add the ram disk image to the .mem file
70
$AMBER_BASE/sw/tools/amber-bin2mem ${AMBER_BASE}/sw/vmlinux/initrd 800000 >> vmlinux.mem
71
${AMBER_CROSSTOOL}-objdump -C -S -EL vmlinux_unstripped > vmlinux.dis
72
cp vmlinux.mem $AMBER_BASE/sw/vmlinux/vmlinux.mem
73
cp vmlinux.dis $AMBER_BASE/sw/vmlinux/vmlinux.dis
74
 
75
# Run the Linux simulation to verify that you have a good kernel image
76
cd $AMBER_BASE/hw/sim
77
run vmlinux
78
 
79
 
80
# +++++++++++++++++++++++++++++++++++++++++++
81
# How to create your own initrd file
82
# +++++++++++++++++++++++++++++++++++++++++++
83
This file is the disk image that Linux mounts as
84
part of the boot process. It contains a bare bones Linux directory
85 24 csantifort
structure and an init file (which is just hello-world renamed).
86 22 csantifort
 
87
# Set the location on your system where the Amber project is located
88
export AMBER_BASE=/proj/opencores-svn/trunk
89
 
90
# Pick a directory on your system where you want to build Linux
91
export LINUX_WORK_DIR=/proj/amber2-linux
92
 
93
 
94
cd ${LINUX_WORK_DIR}
95
# Need root permissions to mount disks
96
su root
97
dd if=/dev/zero of=initrd bs=200k count=1
98
mke2fs -F -m0 -b 1024 initrd
99
 
100
mkdir mnt
101
mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
102
 
103
# Add files
104
mkdir ${LINUX_WORK_DIR}/mnt/sbin
105
mkdir ${LINUX_WORK_DIR}/mnt/dev
106
mkdir ${LINUX_WORK_DIR}/mnt/bin
107
mkdir ${LINUX_WORK_DIR}/mnt/etc
108
mkdir ${LINUX_WORK_DIR}/mnt/proc
109
mkdir ${LINUX_WORK_DIR}/mnt/lib
110
 
111
mknod ${LINUX_WORK_DIR}/mnt/dev/console c 5 1
112
mknod ${LINUX_WORK_DIR}/mnt/dev/tty2 c 4 2
113
mknod ${LINUX_WORK_DIR}/mnt/dev/null c 1 3
114
mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
115
chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
116
 
117 43 csantifort
cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
118 22 csantifort
chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
119
 
120
# Check
121
df ${LINUX_WORK_DIR}/mnt
122
 
123
# Unmount
124
umount ${LINUX_WORK_DIR}/mnt
125 43 csantifort
rm -rf ${LINUX_WORK_DIR}/mnt
126 22 csantifort
exit
127
 
128
cp initrd $AMBER_BASE/sw/vmlinux

powered by: WebSVN 2.1.0

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