add versatilepb support to tim's script

Takeshi Taguchi taguchi at ff.iij4u.or.jp
Sun Feb 10 12:53:01 UTC 2013


Hi, all
Attached patch  add support versatilepb to tim's script:
  https://github.com/kientzle/freebsd-beaglebone

use:
  board_setup VersatilePB
in config.sh. and try to run:
  sh beaglebine/sh
then you will get following images:
  FreeBSD-VERSATILEPB.flash : kernel image
  FreeBSD-VERSATILEPB.img   : userland image

and then try to exec:
  qemu-system-arm -M versatilepb -m 128M \
    -kernel FreeBSD-VERSATILEPB.flash \
    -cpu arm1176 \
    -hda FreeBSD-VERSATILEPB.img

Thanks.
-
T.T


-------------- next part --------------
diff --git a/beaglebsd.sh b/beaglebsd.sh
index cc15c82..3ecba33 100644
--- a/beaglebsd.sh
+++ b/beaglebsd.sh
@@ -23,6 +23,16 @@ board_check_prerequisites ( ) {
 board_build_bootloader ( ) { }
 board_construct_boot_partition ( ) { }
 board_customize_freebsd_partition ( ) { }
+board_show_message ( ) {
+    echo "DONE."
+    echo "Completed disk image is in: ${IMG}"
+    echo
+    echo "Copy to a MicroSDHC card using a command such as:"
+    echo "dd if=${IMG} of=/dev/da0 bs=1m"
+    echo "(Replace /dev/da0 with the appropriate path for your SDHC card reader.)"
+    echo
+}
+
 
 # Empty definitions of functions to be overridden by user.
 customize_boot_partition ( ) { }
@@ -73,12 +83,12 @@ then
     if [ -d ${BOARDDIR}/overlay ]
     then
 	echo "Overlaying board-specific files from ${BOARDDIR}/overlay"
-	(cd ${BOARDDIR}/overlay; find . | cpio -p ${UFS_MOUNT})
+	(cd ${BOARDDIR}/overlay; find . | cpio -pmud ${UFS_MOUNT})
     fi
     if [ -d ${WORKDIR}/overlay ]
     then
 	echo "Overlaying files from ${WORKDIR}/overlay"
-	(cd ${WORKDIR}/overlay; find . | cpio -p ${UFS_MOUNT})
+	(cd ${WORKDIR}/overlay; find . | cpio -pmud ${UFS_MOUNT})
     fi
 
 fi
@@ -97,11 +107,5 @@ disk_release_image
 #
 # We have a finished image; explain what to do with it.
 #
-echo "DONE."
-echo "Completed disk image is in: ${IMG}"
-echo
-echo "Copy to a MicroSDHC card using a command such as:"
-echo "dd if=${IMG} of=/dev/da0 bs=1m"
-echo "(Replace /dev/da0 with the appropriate path for your SDHC card reader.)"
-echo
+board_show_message
 date
diff --git a/board/VersatilePB/overlay/boot/loader.rc b/board/VersatilePB/overlay/boot/loader.rc
new file mode 100644
index 0000000..400cc23
--- /dev/null
+++ b/board/VersatilePB/overlay/boot/loader.rc
@@ -0,0 +1 @@
+fdt addr 0x100
diff --git a/board/VersatilePB/overlay/etc/fstab b/board/VersatilePB/overlay/etc/fstab
new file mode 100644
index 0000000..ca40819
--- /dev/null
+++ b/board/VersatilePB/overlay/etc/fstab
@@ -0,0 +1,2 @@
+# Device	Mountpoint	FStype	Options	Dump	Pass#
+/dev/mmcsd0s2a / 		ufs rw,noatime 1 1
diff --git a/board/VersatilePB/overlay/etc/rc.conf b/board/VersatilePB/overlay/etc/rc.conf
new file mode 100644
index 0000000..8c85acf
--- /dev/null
+++ b/board/VersatilePB/overlay/etc/rc.conf
@@ -0,0 +1,12 @@
+hostname="versatilepb"
+ifconfig_ue0="DHCP"
+sshd_enable="YES"
+
+# Turn off a lot of standard stuff
+# for more free memory.
+cron_enable="NO"
+devd_enable="NO"
+syslogd_enable="NO"
+sendmail_submit_enable="NO"
+sendmail_outbound_enable="NO"
+sendmail_msp_queue_enable="NO"
diff --git a/board/VersatilePB/overlay/etc/ttys b/board/VersatilePB/overlay/etc/ttys
new file mode 100644
index 0000000..a95f6cc
--- /dev/null
+++ b/board/VersatilePB/overlay/etc/ttys
@@ -0,0 +1,10 @@
+ttyv0 "/usr/libexec/getty Pc" xterm on secure
+ttyv1 "/usr/libexec/getty Pc" xterm on secure
+ttyv2 "/usr/libexec/getty Pc" xterm on secure
+ttyv3 "/usr/libexec/getty Pc" xterm on secure
+ttyv4 "/usr/libexec/getty Pc" xterm on secure
+ttyv5 "/usr/libexec/getty Pc" xterm on secure
+ttyv6 "/usr/libexec/getty Pc" xterm on secure
+ttyv7 "/usr/libexec/getty Pc" xterm on secure
+ttyu0 "/usr/libexec/getty 3wire.115200" vt102 on secure
+
diff --git a/board/VersatilePB/setup.sh b/board/VersatilePB/setup.sh
new file mode 100644
index 0000000..77c1428
--- /dev/null
+++ b/board/VersatilePB/setup.sh
@@ -0,0 +1,35 @@
+FREEBSD_SRC=/usr/src
+KERNCONF=VERSATILEPB
+IMG=${WORKDIR}/FreeBSD-${KERNCONF}.img
+FLASH=${WORKDIR}/FreeBSD-${KERNCONF}.flash
+KERNELBIN=${WORKDIR}/obj/arm.armv6`realpath ${FREEBSD_SRC}`/sys/${KERNCONF}/kernel.bin
+
+board_construct_boot_partition ( ) {
+    # dummy partition.
+    disk_fat_create 8m
+    # build kernel flush image
+    #  following code is storren from gonzo, thanks.
+    rm -f $FLASH
+    # set r0..r3 to zero
+    /usr/bin/printf "\0\0\240\343" > ${WORKDIR}/first_commands
+    /usr/bin/printf "\0\020\240\343" >> ${WORKDIR}/first_commands
+    /usr/bin/printf "\0\040\240\343" >> ${WORKDIR}/first_commands
+    /usr/bin/printf "\0\060\240\343" >> ${WORKDIR}/first_commands
+    # jump to kernel entry point
+    /usr/bin/printf "\001\366\240\343" >> ${WORKDIR}/first_commands
+
+    dd of=$FLASH bs=1M count=4 if=/dev/zero
+    dd of=$FLASH bs=1 conv=notrunc if=${WORKDIR}/first_commands
+    dd of=$FLASH bs=64k oseek=15 conv=notrunc if=$KERNELBIN
+    
+}
+
+board_show_message ( ) {
+    echo "DONE."
+    echo "Completed disk image is in: ${IMG}"
+    echo "And kernel image is in: ${FLASH}"
+    echo
+    echo "Try to run:"
+    echo "qemu-system-arm -M versatilepb -m 128M -kernel ${FLASH} -cpu arm1176 -hda ${IMG}"
+    echo
+}
diff --git a/config.sh.sample b/config.sh.sample
index 2df69fc..dd485b9 100644
--- a/config.sh.sample
+++ b/config.sh.sample
@@ -13,6 +13,7 @@
 # board_setup BeagleBone
 # board_setup RaspberryPi
 # board_setup PandaBoard
+# board_setup VersatilePB
 
 #
 # Read board/<board-name>/README for more details


More information about the freebsd-arm mailing list