File in this directory:
|
File in this directory:
|
initrd A disk image needed if you want to build the
|
initrd A disk image needed if you want to build the
|
Amber Linux kernel from sources
|
Amber Linux kernel from sources
|
patch-2.4.27-amber2.bz2 Amber Linux patch file
|
patch-2.4.27-amber2.bz2 Amber Linux patch file
|
patch-2.4.27-vrs1.bz2 ARM Linux patch file
|
patch-2.4.27-vrs1.bz2 ARM Linux patch file
|
README.txt This file
|
README.txt This file
|
vmlinux Kernel executable file
|
vmlinux Kernel executable file
|
vmlinux.dis Kernel disassembly file
|
vmlinux.dis.bz2 Kernel disassembly file, bzip2 compressed
|
vmlinux.mem Kernel .mem file for Verilog simulations
|
vmlinux.mem.bz2 Kernel .mem file for Verilog simulations, bzip2 compressed
|
If you build the kernal from source these 2 files
|
If you build the kernal from source these 2 files
|
get replaced.
|
get replaced.
|
|
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# How to run Amber Linux kernel on a development board
|
# How to run Amber Linux kernel on a development board
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# +++++++++++++++++++++++++++++++++++++++++++
|
1. Download the bitfile to configure the FPGA using Impact ir Chipscope
|
1. Download the bitfile to configure the FPGA using Impact ir Chipscope
|
2. Connect HyperTerminal to the serial port on the FPGA to connect to the boot loader
|
2. Connect HyperTerminal to the serial port on the FPGA to connect to the boot loader
|
3. Download the disk image
|
3. Download the disk image
|
> b 800000
|
> b 800000
|
Then select the file $AMBER_BASE/sw/vmlinux/initrd to transfer
|
Then select the file $AMBER_BASE/sw/vmlinux/initrd to transfer
|
4. Download the kernel image
|
4. Download the kernel image
|
> l
|
> l
|
Then select the file $AMBER_BASE/sw/vmlinux/vmlinux to transfer
|
Then select the file $AMBER_BASE/sw/vmlinux/vmlinux to transfer
|
5. Execute th ekernel
|
5. Execute th ekernel
|
> j
|
> j
|
|
|
|
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# How to build Amber Linux kernel from source
|
# How to build Amber Linux kernel from source
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# If you also want to create your own initrd disk image,
|
# If you also want to create your own initrd disk image,
|
# then follow that procedure (below) first.
|
# then follow that procedure (below) first.
|
|
|
# Set the location on your system where the Amber project is located
|
# Set the location on your system where the Amber project is located
|
export AMBER_BASE=/proj/opencores-svn/trunk
|
export AMBER_BASE=/proj/opencores-svn/trunk
|
|
|
# Pick a directory on your system where you want to build Linux
|
# Pick a directory on your system where you want to build Linux
|
export LINUX_WORK_DIR=/proj/amber2-linux
|
export LINUX_WORK_DIR=/proj/amber2-linux
|
|
|
export AMBER_CROSSTOOL=arm-none-linux-gnueabi
|
export AMBER_CROSSTOOL=arm-none-linux-gnueabi
|
|
|
|
|
# Create the Linux build directory
|
# Create the Linux build directory
|
test -e ${LINUX_WORK_DIR} || mkdir ${LINUX_WORK_DIR}
|
test -e ${LINUX_WORK_DIR} || mkdir ${LINUX_WORK_DIR}
|
cd ${LINUX_WORK_DIR}
|
cd ${LINUX_WORK_DIR}
|
|
|
# Download the kernel source
|
# Download the kernel source
|
wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.27.tar.gz
|
wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.27.tar.gz
|
tar zxf linux-2.4.27.tar.gz
|
tar zxf linux-2.4.27.tar.gz
|
ln -s linux-2.4.27 linux
|
ln -s linux-2.4.27 linux
|
cd linux
|
cd linux
|
|
|
#Apply 2 patch files
|
#Apply 2 patch files
|
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-vrs1.bz2 .
|
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-vrs1.bz2 .
|
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-amber2.bz2 .
|
cp ${AMBER_BASE}/sw/vmlinux/patch-2.4.27-amber2.bz2 .
|
bzip2 -d patch-2.4.27-vrs1.bz2
|
bzip2 -d patch-2.4.27-vrs1.bz2
|
bzip2 -d patch-2.4.27-amber2.bz2
|
bzip2 -d patch-2.4.27-amber2.bz2
|
patch -p1 < patch-2.4.27-vrs1
|
patch -p1 < patch-2.4.27-vrs1
|
patch -p1 < patch-2.4.27-amber2
|
patch -p1 < patch-2.4.27-amber2
|
|
|
# Build the kernel and create a .mem file for simulations
|
# Build the kernel and create a .mem file for simulations
|
make dep
|
make dep
|
make vmlinux
|
make vmlinux
|
|
|
cp vmlinux vmlinux_unstripped
|
cp vmlinux vmlinux_unstripped
|
${AMBER_CROSSTOOL}-objcopy -R .comment -R .note vmlinux
|
${AMBER_CROSSTOOL}-objcopy -R .comment -R .note vmlinux
|
${AMBER_CROSSTOOL}-objcopy --change-addresses -0x02000000 vmlinux
|
${AMBER_CROSSTOOL}-objcopy --change-addresses -0x02000000 vmlinux
|
$AMBER_BASE/sw/tools/amber-elfsplitter vmlinux > vmlinux.mem
|
$AMBER_BASE/sw/tools/amber-elfsplitter vmlinux > vmlinux.mem
|
# Add the ram disk image to the .mem file
|
# Add the ram disk image to the .mem file
|
$AMBER_BASE/sw/tools/amber-bin2mem ${AMBER_BASE}/sw/vmlinux/initrd 800000 >> vmlinux.mem
|
$AMBER_BASE/sw/tools/amber-bin2mem ${AMBER_BASE}/sw/vmlinux/initrd 800000 >> vmlinux.mem
|
${AMBER_CROSSTOOL}-objdump -C -S -EL vmlinux_unstripped > vmlinux.dis
|
${AMBER_CROSSTOOL}-objdump -C -S -EL vmlinux_unstripped > vmlinux.dis
|
cp vmlinux.mem $AMBER_BASE/sw/vmlinux/vmlinux.mem
|
cp vmlinux.mem $AMBER_BASE/sw/vmlinux/vmlinux.mem
|
cp vmlinux.dis $AMBER_BASE/sw/vmlinux/vmlinux.dis
|
cp vmlinux.dis $AMBER_BASE/sw/vmlinux/vmlinux.dis
|
|
|
# Run the Linux simulation to verify that you have a good kernel image
|
# Run the Linux simulation to verify that you have a good kernel image
|
cd $AMBER_BASE/hw/sim
|
cd $AMBER_BASE/hw/sim
|
run vmlinux
|
run vmlinux
|
|
|
|
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# How to create your own initrd file
|
# How to create your own initrd file
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# +++++++++++++++++++++++++++++++++++++++++++
|
This file is the disk image that Linux mounts as
|
This file is the disk image that Linux mounts as
|
part of the boot process. It contains a bare bones Linux directory
|
part of the boot process. It contains a bare bones Linux directory
|
structure and an init file (which is just hello-world renamed).
|
structure and an init file (which is just hello-world renamed).
|
|
|
# Set the location on your system where the Amber project is located
|
# Set the location on your system where the Amber project is located
|
export AMBER_BASE=/proj/opencores-svn/trunk
|
export AMBER_BASE=/proj/opencores-svn/trunk
|
|
|
# Pick a directory on your system where you want to build Linux
|
# Pick a directory on your system where you want to build Linux
|
export LINUX_WORK_DIR=/proj/amber2-linux
|
export LINUX_WORK_DIR=/proj/amber2-linux
|
|
|
|
|
cd ${LINUX_WORK_DIR}
|
cd ${LINUX_WORK_DIR}
|
# Need root permissions to mount disks
|
# Need root permissions to mount disks
|
su root
|
su root
|
dd if=/dev/zero of=initrd bs=200k count=1
|
dd if=/dev/zero of=initrd bs=200k count=1
|
mke2fs -F -m0 -b 1024 initrd
|
mke2fs -F -m0 -b 1024 initrd
|
|
|
mkdir mnt
|
mkdir mnt
|
mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
|
mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
|
|
|
# Add files
|
# Add files
|
mkdir ${LINUX_WORK_DIR}/mnt/sbin
|
mkdir ${LINUX_WORK_DIR}/mnt/sbin
|
mkdir ${LINUX_WORK_DIR}/mnt/dev
|
mkdir ${LINUX_WORK_DIR}/mnt/dev
|
mkdir ${LINUX_WORK_DIR}/mnt/bin
|
mkdir ${LINUX_WORK_DIR}/mnt/bin
|
mkdir ${LINUX_WORK_DIR}/mnt/etc
|
mkdir ${LINUX_WORK_DIR}/mnt/etc
|
mkdir ${LINUX_WORK_DIR}/mnt/proc
|
mkdir ${LINUX_WORK_DIR}/mnt/proc
|
mkdir ${LINUX_WORK_DIR}/mnt/lib
|
mkdir ${LINUX_WORK_DIR}/mnt/lib
|
|
|
mknod ${LINUX_WORK_DIR}/mnt/dev/console c 5 1
|
mknod ${LINUX_WORK_DIR}/mnt/dev/console c 5 1
|
mknod ${LINUX_WORK_DIR}/mnt/dev/tty2 c 4 2
|
mknod ${LINUX_WORK_DIR}/mnt/dev/tty2 c 4 2
|
mknod ${LINUX_WORK_DIR}/mnt/dev/null c 1 3
|
mknod ${LINUX_WORK_DIR}/mnt/dev/null c 1 3
|
mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
|
mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
|
chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
|
chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
|
|
|
cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
|
chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
|
|
|
# Check
|
# Check
|
df ${LINUX_WORK_DIR}/mnt
|
df ${LINUX_WORK_DIR}/mnt
|
|
|
# Unmount
|
# Unmount
|
umount ${LINUX_WORK_DIR}/mnt
|
umount ${LINUX_WORK_DIR}/mnt
|
rm -rf ${LINUX_WORK_DIR}/mnt
|
rm -rf ${LINUX_WORK_DIR}/mnt
|
exit
|
exit
|
|
|
cp initrd $AMBER_BASE/sw/vmlinux
|
cp initrd $AMBER_BASE/sw/vmlinux
|
|
|