Line 39... |
Line 39... |
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
|
|
|
|
|
|
# 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_WORK_DIR}/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
|
Line 78... |
Line 75... |
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
|
# +++++++++++++++++++++++++++++++++++++++++++
|
# +++++++++++++++++++++++++++++++++++++++++++
|
Line 101... |
Line 98... |
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}
|
|
|
# Need root permissions to mount disks
|
# Need root permissions to mount disks
|
sudo dd if=/dev/zero of=initrd bs=200k count=1
|
sudo dd if=/dev/zero of=initrd bs=200k count=1
|
#sudo dd if=/dev/zero of=initrd bs=400k count=1
|
#sudo dd if=/dev/zero of=initrd bs=800k count=1
|
sudo mke2fs -F -m0 -b 1024 initrd
|
sudo mke2fs -F -m0 -b 1024 initrd
|
|
|
mkdir mnt
|
mkdir mnt
|
sudo mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
|
sudo mount -t ext2 -o loop initrd ${LINUX_WORK_DIR}/mnt
|
|
|
Line 123... |
Line 120... |
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
|
sudo mknod ${LINUX_WORK_DIR}/mnt/dev/loop0 b 7 0
|
sudo chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
|
sudo chmod 600 ${LINUX_WORK_DIR}/mnt/dev/*
|
|
|
sudo cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
sudo cp $AMBER_BASE/sw/hello-world/hello-world.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
#sudo cp $AMBER_BASE/sw/dhry/dhry.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
#sudo cp $AMBER_BASE/sw/dhry/dhry.flt ${LINUX_WORK_DIR}/mnt/sbin/init
|
#sudo cp /proj/amber2-linux/busybox-1.18.5/busybox ${LINUX_WORK_DIR}/mnt/sbin/init
|
|
sudo chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
|
sudo chmod +x ${LINUX_WORK_DIR}/mnt/sbin/init
|
|
|
# Check
|
# Check
|
df ${LINUX_WORK_DIR}/mnt
|
df ${LINUX_WORK_DIR}/mnt
|
|
|
# Unmount
|
# Unmount
|
sudo umount ${LINUX_WORK_DIR}/mnt
|
sudo umount ${LINUX_WORK_DIR}/mnt
|
rm -rf ${LINUX_WORK_DIR}/mnt
|
sudo rm -rf ${LINUX_WORK_DIR}/mnt
|
|
|
cp initrd $AMBER_BASE/sw/vmlinux/initrd-
|
cp initrd $AMBER_BASE/sw/vmlinux/initrd-
|
#cp initrd $AMBER_BASE/sw/vmlinux/initrd-400k-busybox
|
#cp initrd $AMBER_BASE/sw/vmlinux/initrd-800k-busybox
|
|
|
---
|
---
|
|
|
If 200k is not large enough, you can change the size as follows.
|
If 200k is not large enough, you can change the size as follows.
|
You'll need to change a couple of values in the ATAG data structure defined in the
|
You'll need to change a couple of values in the ATAG data structure defined in the
|