Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/embedded/conf add mkimage config for generatin...



details:   https://anonhg.NetBSD.org/src/rev/864605357a89
branches:  trunk
changeset: 783987:864605357a89
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Jan 14 11:32:40 2013 +0000

description:
add mkimage config for generating beagleboard images

diffstat:

 distrib/utils/embedded/conf/beagleboard.conf |  120 +++++++++++++++++++++++++++
 1 files changed, 120 insertions(+), 0 deletions(-)

diffs (124 lines):

diff -r d8f0da3d7286 -r 864605357a89 distrib/utils/embedded/conf/beagleboard.conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/utils/embedded/conf/beagleboard.conf      Mon Jan 14 11:32:40 2013 +0000
@@ -0,0 +1,120 @@
+# $NetBSD: beagleboard.conf,v 1.1 2013/01/14 11:32:40 jmcneill Exp $
+# BeagleBoard customization script used by mkimage
+#
+board=beagleboard
+kernelconf=BEAGLEBOARD
+kernelimg=netbsd.ub
+loadaddr=81000000
+image=$HOME/${board}.img
+
+sets="base etc comp games man misc modules tests text"
+setsdir=$obj/evbarm/media
+kerneldir=$src/sys/arch/evbarm/compile/${kernelconf}
+specialdirs="/kern /proc"
+
+swap=512
+size=2048
+overhead=8
+boot=112
+init=8
+msdosid=12
+
+tmp=/tmp/${board}.disklabel.$$
+
+make_filesystems() {
+
+       local asize=$(( ${size} * 1024 ))
+       local swapsize=$(( ${swap} * 1024 ))
+       local bootsize=$(( ${boot} * 1024 ))
+
+       local bootoffset=$((${init} * 1024 ))
+       local swapoffset=$(( ${bootoffset} + ${bootsize} ))
+       local aoffset=$(( ${swapoffset} + ${swapsize} ))
+
+       local totalsize=$(( ${asize} + ${swapsize} + ${bootsize} + ${bootoffset} ))
+       local bps=512
+       local spt=32
+       local tpc=64
+       local spc=2048
+       local cylinders=$(( ${totalsize} / ${spc} ))
+
+       cat > ${tmp} << EOF
+type: SCSI
+disk: STORAGE DEVICE
+label: fictitious
+flags: removable
+bytes/sector: ${bps}
+sectors/track: ${spt}
+tracks/cylinder: ${tpc}
+sectors/cylinder: ${spc}
+cylinders: ${cylinders}
+total sectors: ${totalsize}
+rpm: 3600
+interleave: 1
+trackskew: 0
+cylinderskew: 0
+headswitch: 0           # microseconds
+track-to-track seek: 0  # microseconds
+drivedata: 0 
+
+8 partitions:
+#     size         offset        fstype [fsize bsize cpg/sgs]
+ a:   ${asize}     ${aoffset}    4.2BSD   2048 16384     0  # 
+ b:   ${swapsize}  ${swapoffset} swap                       #
+ d:   ${totalsize} 0             unused      0     0        #
+ e:   ${bootsize}  ${bootoffset} MSDOS                      #
+EOF
+       ${sudo} disklabel -R ${vnddev} ${tmp}
+       ${sudo} fdisk -f -u -0 -s ${msdosid}/${bootoffset}/${bootsize} -F ${image}
+       ${sudo} newfs /dev/r${vnddev}a
+       ${sudo} newfs_msdos /dev/r${vnddev}e
+       ${sudo} mount /dev/${vnddev}a ${mnt}
+       ${sudo} mkdir ${mnt}/boot
+       ${sudo} mount_msdos /dev/${vnddev}e ${mnt}/boot
+}
+
+make_fstab() {
+${sudo} cat > ${mnt}/etc/fstab << EOF
+# NetBSD /etc/fstab
+# See /usr/share/examples/fstab/ for more examples.
+/dev/ld0a      /               ffs     rw,log  1 1
+/dev/ld0b      none            swap    sw      0 0
+/dev/ld0e      /boot           msdos   rw      1 1
+kernfs         /kern           kernfs  rw
+ptyfs          /dev/pts        ptyfs   rw
+procfs         /proc           procfs  rw
+EOF
+}
+
+customize() {
+
+       ${sudo} cat >> ${mnt}/etc/rc.conf << EOF
+hostname=${board}
+sshd=YES
+dhcpcd=YES
+mdnsd=YES
+EOF
+
+       ${sudo} cat > ${mnt}/boot/uEnv.txt << EOF
+loaduimage=fatload mmc 0 ${loadaddr} ${kernelimg}; bootm ${loadaddr} root=ld0a
+EOF
+
+       if [ ! -f ${kerneldir}/${kernelimg} ]; then
+               echo ${PROG}: Missing ${kerneldir}/${kernelimg} 1>&2
+               exit 1
+       fi
+       echo "${bar} installing kernel ${bar}"
+       ${sudo} cp ${kerneldir}/${kernelimg} ${mnt}/boot
+
+       if [ ! -f ${mnt}/dev/MAKEDEV ]; then
+               echo ${PROG}: Missing ${mnt}/dev/MAKEDEV 1>&2
+               exit 1
+       fi
+       echo "${bar} running MAKEDEV ${bar}"
+       (cd ${mnt}/dev && ${sudo} sh MAKEDEV all)
+}
+
+cleanup() {
+    rm -f ${tmp}
+    ${sudo} umount ${mnt}/boot
+}



Home | Main Index | Thread Index | Old Index