+20130306:
+ For people building ARM images, the procedure has changed
+ a bit. You need a full FS to boot now. In short, you need
+ to use the new in-tree script to make a full SD image. See
+ http://wiki.minix3.org/en/DevelopersGuide/MinixOnARM
+ for details.
+
20130201:
Replace our native ln with NetBSD version.
EXTRA= rc
PROTO_FILES= proto.common.etc proto.common.dynamic proto.dev
PROG_DRIVERS=
-PROG_COMMANDS= mount fsck.mfs sh service
-PROG_SERVERS= mfs
+PROG_COMMANDS= mount fsck.mfs sh service loadramdisk sysenv
+PROG_SERVERS= mfs procfs
PROG_BIN=
PROG_SBIN=
PROG_USR.BIN=
PROG_USR.SBIN=
+.if ${MKSMALL} != "yes"
+RAMDISK_SMALL= 1
+.endif
+
.if ${MACHINE_ARCH} == "i386"
ETC+= rs.single
EXTRA+=
PROG_DRIVERS+= at_wini floppy pci
-PROG_COMMANDS+= cdprobe loadramdisk sysenv
-PROG_SERVERS+= procfs
+PROG_COMMANDS+= cdprobe
PROG_USR.SBIN+= pwd_mkdb
.if ${MKSMALL} != "yes"
-RAMDISK_SMALL= 1
PROG_DRIVERS+= ahci
PROG_DRIVERS+= virtio_blk
PROG_SERVERS+= ext2
.endif # ${MACHINE_ARCH} == "i386"
.if ${MACHINE_ARCH} == "earm"
-EXTRA+= rc.arm mylogin.sh ttys
-PROG_DRIVERS+= fb mmc tty gpio
-PROG_COMMANDS+= cp dd getty time sleep stty umount
-PROG_BIN+= cat ls rm sync
-PROTO= proto.arm.small
+PROG_DRIVERS+= mmc
.endif # ${MACHINE_ARCH} == "earm"
.if ${LDSTATIC} == "-dynamic"
+++ /dev/null
-#!/bin/sh
-echo Welcome
-export PATH=$PATH:/mnt/bin:/mnt/usr/bin
-exec /bin/sh
0 0
d--755 0 0
bin d--755 0 0
+#ifdef __i386__
cdprobe ---755 0 0 cdprobe
+#endif
+ sysenv ---755 0 0 sysenv
#if RAMDISK_SMALL == 1
fsck.mfs ---755 0 0 fsck.mfs
#endif
mount ---755 0 0 mount
sh ---755 0 0 sh
service ---755 0 0 service
- sysenv ---755 0 0 sysenv
$
sbin d--755 0 0
+#ifdef __i386__
floppy ---755 0 0 floppy
ahci ---755 0 0 ahci
virtio_blk ---755 0 0 virtio_blk
at_wini ---755 0 0 at_wini
#if RAMDISK_SMALL == 1
ext2 ---755 0 0 ext2
+#endif
+#endif
+#ifdef __arm__
+ mmc ---755 0 0 mmc
#endif
mfs ---755 0 0 mfs
procfs ---755 0 0 procfs
loadramdisk ---755 0 0 loadramdisk
$
sbin d--755 0 0
+#ifdef __i386__
#if RAMDISK_INC_ACPI == 1
- acpi ---755 0 0 acpi
+ acpi ---755 0 0 acpi
#endif
pci ---755 0 0 pci
+#endif
$
$
dev d--755 0 0
+++ /dev/null
-boot
-0 0
-d--755 0 0
- bin d--755 0 0
- mount ---755 0 0 mount
- umount ---755 0 0 umount
- sh ---755 0 0 sh
- service ---755 0 0 service
- getty ---755 0 0 getty
- stty ---755 0 0 stty
- cp ---755 0 0 cp
- sync ---755 0 0 sync
- sleep ---755 0 0 sleep
- dd ---755 0 0 dd
- time ---755 0 0 time
- cat ---755 0 0 cat
- ls ---755 0 0 ls
- fsck.mfs ---755 0 0 fsck.mfs
- $
- sbin d--755 0 0
- fb ---755 0 0 fb
- mmc ---755 0 0 mmc
- mfs ---755 0 0 mfs
- gpio ---755 0 0 gpio
-
- $
- mnt d--755 0 0
- $
- gpio d--755 0 0
- $
- usr d--755 0 0
- bin d--755 0 0
- login ---755 0 0 mylogin.sh
- $
- $
- dev d--755 0 0
-#include "proto.dev"
- $
-#include "proto.common.etc"
-$
pwd.db ---644 0 0 pwd.db
spwd.db ---600 0 0 spwd.db
master.passwd ---600 0 0 master.passwd
-#if defined(__i386__)
rc ---755 0 0 rc
+#if defined(__i386__)
rs.single ---755 0 0 rs.single
-#endif
-#if defined(__arm__)
- rc ---755 0 0 rc.arm
- ttys ---644 0 0 ttys
#endif
$
FSCK=/bin/fsck.mfs
ACPI=/usr/sbin/acpi
-if [ -e $ACPI -a -n "`sysenv acpi`" ]
-then
- /bin/service -c up $ACPI
+
+if [ X`/bin/sysenv arch` = Xi386 ]
+then if [ -e $ACPI -a -n "`sysenv acpi`" ]
+ then
+ /bin/service -c up $ACPI
+ fi
+ /bin/service -c up /usr/sbin/pci
+ /bin/service -cn up /sbin/floppy -dev /dev/fd0
+ if [ X`/bin/sysenv ahci` = Xyes ]
+ then
+ # this is here temporarily, for testing purposes
+ /bin/service -c up /sbin/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0
+ elif [ X`/bin/sysenv virtio_blk` = Xyes ]
+ then
+ /bin/service -c up /sbin/virtio_blk -dev /dev/c0d0 -label virtio_blk_0 -args instance=0
+ else
+ /bin/service -c up /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
+ /bin/service -cr up /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1
+ fi
fi
-/bin/service -c up /usr/sbin/pci
-/bin/service -cn up /sbin/floppy -dev /dev/fd0
-if [ X`/bin/sysenv ahci` = Xyes ]
-then
- # this is here temporarily, for testing purposes
- /bin/service -c up /sbin/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0
-elif [ X`/bin/sysenv virtio_blk` = Xyes ]
-then
- /bin/service -c up /sbin/virtio_blk -dev /dev/c0d0 -label virtio_blk_0 -args instance=0
-else
- /bin/service -c up /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
- /bin/service -cr up /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1
+
+if [ X`/bin/sysenv arch` = Xearm ]
+then echo starting mmc driver
+ /bin/service -c up /sbin/mmc -dev /dev/c0d0
fi
+
/bin/service up /sbin/procfs || echo "WARNING: couldn't start procfs"
if /bin/sysenv rootdevname >/dev/null
+++ /dev/null
-#!/bin/sh
-# LSC FIXME quick hack, we should retink the rc script so we do not
-# get two different script
-set -e
-
-
-exec >/dev/log
-exec 2>/dev/log
-exec </dev/null
-
-#XXX
-#/bin/service -c up /sbin/mmc -dev /dev/c0d0
-#/bin/fsck.mfs -p /dev/c0d0p1
-#/bin/mount /dev/c0d0p1 /mnt
-#gpio
-#mount -t gpio none /gpio
-#service up /sbin/fb -dev /dev/fb0 -period 2HZ
-exit
+++ /dev/null
-#
-# from: @(#)ttys 5.1 (Berkeley) 4/17/89
-#
-# name getty type status comments
-#
-console "getty 115200" minix on secure
-#ttyc1 getty minix on secure
-#ttyc2 getty minix on secure
-#ttyc3 getty minix on secure
-tty00 "" unknown off secure
-tty01 "" unknown off secure
-
-ttyp0 "" network off
-ttyp1 "" network off
-ttyp2 "" network off
-ttyp3 "" network off
-ttyp4 "" network off
-ttyp5 "" network off
-ttyp6 "" network off
-ttyp7 "" network off
-ttyp8 "" network off
-ttyp9 "" network off
-ttypa "" network off
-ttypb "" network off
-ttypc "" network off
-ttypd "" network off
-ttype "" network off
-ttypf "" network off
-ttyq0 "" network off
-ttyq1 "" network off
-ttyq2 "" network off
-ttyq3 "" network off
-ttyq4 "" network off
-ttyq5 "" network off
-ttyq6 "" network off
-ttyq7 "" network off
-ttyq8 "" network off
-ttyq9 "" network off
-ttyqa "" network off
-ttyqb "" network off
-ttyqc "" network off
-ttyqd "" network off
-ttyqe "" network off
-ttyqf "" network off
RC_TZ=/etc/rc.timezone
export TERM PATH
+ARCH="`sysenv arch`"
+
+if [ ! "$ARCH" ]
+then # Older kernels do not provide an arch sysenv variable.
+ # We assume we are on x86 then, as existing systems with
+ # kernel and userland (i.e. this script) unsynchronized
+ # will be x86.
+ ARCH=i386
+fi
+
usage()
{
echo >&2 "Usage: $0 [-saf] start|stop|down"
then . "$RC_TZ"
fi
- # Try to read the hardware real-time clock, otherwise do it manually.
- readclock || intr date -q
+ if [ $ARCH = i386 ]
+ then
+ # Try to read the hardware real-time clock, otherwise do it manually.
+ readclock || intr date -q
+ fi
+
+ if [ $ARCH = earm ]
+ then
+ date 201301010000
+ fi
+
# Initialize files.
>/etc/utmp # /etc/utmp keeps track of logins
cp /usr/lib/em* /usr/lib/cpp* /lib
esac
- echo -n "Starting hotplugging infrastructure... "
- rm -f /var/run/devmand.pid
- devmand -d /etc/devmand -d /usr/pkg/etc/devmand &
- echo "done."
+ if [ $ARCH = i386 ]
+ then
+ echo -n "Starting hotplugging infrastructure... "
+ rm -f /var/run/devmand.pid
+ devmand -d /etc/devmand -d /usr/pkg/etc/devmand &
+ echo "done."
+ fi
# Things should be alright now.
;;
down|stop)
sync
- if [ -f /var/run/devmand.pid ]
+ if [ $ARCH = i386 ]
then
- kill -INT `cat /var/run/devmand.pid`
- # without this delay the following will
- # be printed in the console
- # RS: devman not running?
- sleep 1
- fi
- #
- # usbd needs to be stopped exactly
- # at this stage(before stopping devman
- # and after stopping the services
- # stated by devmand)
- if [ -x /usr/pkg/etc/rc.d/usbd ]
- then
- /usr/pkg/etc/rc.d/usbd stop
+ if [ -f /var/run/devmand.pid ]
+ then
+ kill -INT `cat /var/run/devmand.pid`
+ # without this delay the following will
+ # be printed in the console
+ # RS: devman not running?
+ sleep 1
+ fi
+ #
+ # usbd needs to be stopped exactly
+ # at this stage(before stopping devman
+ # and after stopping the services
+ # stated by devmand)
+ if [ -x /usr/pkg/etc/rc.d/usbd ]
+ then
+ /usr/pkg/etc/rc.d/usbd stop
+ fi
fi
+
# Tell RS server we're going down.
service shutdown
;;
RANDOM_FILE=/usr/adm/random.dat
LOCAL_FILE=/usr/etc/rc.local
+ARCH="`sysenv arch`"
+
+if [ ! "$ARCH" ]
+then # Older kernels do not provide an arch sysenv variable.
+ # We assume we are on x86 then, as existing systems with
+ # kernel and userland (i.e. this script) unsynchronized
+ # will be x86.
+ ARCH=i386
+fi
+
# Get $SERVICES_DIRS
. /etc/rc.conf
else
up inet -script /etc/rs.inet -dev /dev/ip -devstyle STYLE_CLONE
fi
- up -n printer -dev /dev/lp -period 10HZ
+
up -n ipc
- # start VirtualBox time sync driver if the device is there
- if grep '^[^ ]* [^ ]* 80EE:CAFE ' /proc/pci >/dev/null; then
- up -n vbox -period 10HZ
+
+ if [ $ARCH = i386 ]
+ then
+ up -n printer -dev /dev/lp -period 10HZ
+ # start VirtualBox time sync driver if the device is there
+ if grep '^[^ ]* [^ ]* 80EE:CAFE ' /proc/pci >/dev/null; then
+ up -n vbox -period 10HZ
+ fi
fi
+
echo .
# Network initialization.
#define INVAL_GID ((gid_t) -1) /* invalid gid value */
#define SERVARNAME "cttyline"
+#define ARCHVARNAME "arch"
#define SERBAUDVARNAME "cttybaud"
/* Bits for s_flags in the privilege structure. */
int i;
for (i = 0; i < MB_MODS_NR; ++i) {
mb_modlist[i].mod_start = MB_MODS_BASE + i * MB_MODS_ALIGN;
- mb_modlist[i].mod_end = mb_modlist[i].mod_start + MB_MODS_ALIGN - 1; mb_modlist[i].cmdline = 0;
+ mb_modlist[i].mod_end = mb_modlist[i].mod_start + MB_MODS_ALIGN - 1;
+ mb_modlist[i].cmdline = 0;
+
+ if (i == 5) {
+ /* LSC HACK: Special case for memory, it is actually loaded at the
+ * end, so that it can grow without having to change the
+ * alignment of everything. currently reserving 64MiB */
+ mb_modlist[i].mod_start = 0x96800000;
+ mb_modlist[i].mod_end = mb_modlist[i].mod_start + (0x04000000) - 1;
+ }
}
/* Final 'module' is actually a string holding the boot cmdline */
}
}
+ /* let higher levels know what we are booting on */
+ mb_set_param(cbi->param_buf, ARCHVARNAME, "earm", cbi);
+
/* round user stack down to leave a gap to catch kernel
* stack overflow; and to distinguish kernel and user addresses
* at a glance (0xf.. vs 0xe..)
}
}
+ /* let higher levels know what we are booting on */
+ mb_set_param(cbi->param_buf, ARCHVARNAME, "i386", cbi);
+
/* round user stack down to leave a gap to catch kernel
* stack overflow; and to distinguish kernel and user addresses
* at a glance (0xf.. vs 0xe..)
--- /dev/null
+#!/bin/bash
+set -e
+
+MP_MINIX=/tmp/minix
+MP_BOOT=/tmp/minixboot
+
+: ${ARCH=evbearm-el}
+: ${OBJ=../obj.arm}
+: ${CROSS_TOOLS=${OBJ}/"tooldir.`uname -s`-`uname -r`-`uname -m`"/bin}
+: ${CROSS_PREFIX=${CROSS_TOOLS}/arm-elf32-minix-}
+: ${DESTDIR=${OBJ}/destdir.$ARCH}
+: ${FSTAB=$DESTDIR/etc/fstab}
+: ${LOOP=/dev/loop0}
+: ${EMPTYIMG=minix_arm_sd_empty.img}
+: ${IMG=minix_arm_sd.img}
+: ${QEMU=/opt/bin/qemu-system-arm}
+
+BUILDSH=build.sh
+
+if [ ! -f $BUILDSH ]
+then echo "Please invoke me from the root source dir, where $BUILDSH is."
+ exit 1
+fi
+
+if [ ! -f ${EMPTYIMG}.bz2 ]
+then echo Retrieving $EMPTYIMG
+ wget http://www.minix3.org/arm/${EMPTYIMG}.bz2
+fi
+
+if [ ! -f $IMG ]
+then echo decompressing $EMPTYIMG onto $IMG
+ bzip2 -d -k ${EMPTYIMG}.bz2
+ mv $EMPTYIMG $IMG
+fi
+
+# remove fstab and generated pw db
+rm -rf $DESTDIR/etc
+
+sh build.sh -j4 -m$ARCH -O $OBJ -D $DESTDIR -u distribution
+
+cat >$FSTAB <<END_FSTAB
+/dev/c0d0p1s0 / mfs rw 0 1
+/dev/c0d0p1s2 /usr mfs rw 0 2
+/dev/c0d0p1s1 /home mfs rw 0 2
+END_FSTAB
+
+rm -f $DESTDIR/SETS.*
+
+${CROSS_TOOLS}/nbpwd_mkdb -V 0 -p -d $DESTDIR $DESTDIR/etc/master.passwd
+
+set -x
+
+umount $MP_MINIX/home || true
+umount $MP_MINIX/usr || true
+umount $MP_MINIX || true
+umount $MP_BOOT || true
+
+losetup -d $LOOP || true
+losetup $LOOP $IMG
+
+${CROSS_TOOLS}/nbmkfs.mfs ${LOOP}p5
+${CROSS_TOOLS}/nbmkfs.mfs ${LOOP}p6
+${CROSS_TOOLS}/nbmkfs.mfs ${LOOP}p7
+
+mkdir -p $MP_BOOT
+mount ${LOOP}p1 $MP_BOOT
+
+mkdir -p ${MP_MINIX}
+mount ${LOOP}p5 ${MP_MINIX}
+
+mkdir -p ${MP_MINIX}/home
+mkdir -p ${MP_MINIX}/usr
+mount ${LOOP}p6 ${MP_MINIX}/home
+mount ${LOOP}p7 ${MP_MINIX}/usr
+
+cp releasetools/uEnv.txt releasetools/cmdline.txt $MP_BOOT
+
+${CROSS_PREFIX}objcopy ${OBJ}/kernel/kernel -O binary ${OBJ}/kernel.bin
+cp ${OBJ}/kernel.bin $MP_BOOT
+
+set -x
+
+rsync -a $DESTDIR/ $MP_MINIX/
+
+for f in vm rs pm sched vfs ds mfs pfs init
+do
+ cp ${OBJ}/servers/$f/$f ${OBJ}/$f.elf
+ ${CROSS_PREFIX}strip -s ${OBJ}/$f.elf
+ cp ${OBJ}/$f.elf $MP_BOOT
+done
+
+for f in tty memory log
+do
+ cp ${OBJ}/drivers/$f/$f ${OBJ}/$f.elf
+ ${CROSS_PREFIX}strip -s ${OBJ}/$f.elf
+ cp ${OBJ}/$f.elf $MP_BOOT
+done
+
+# Unmount disk image
+sync
+
+umount $MP_MINIX/home
+umount $MP_MINIX/usr
+umount $MP_MINIX
+umount $MP_BOOT
+losetup -d $LOOP
+
+$QEMU -M beaglexm -drive if=sd,cache=writeback,file=$IMG -clock unix -serial pty -vnc :1 $*
--- /dev/null
+console=tty02 rootdevname=c0d0p1s0
--- /dev/null
+#uEnv.txt
+
+# Set the command to be executed
+uenvcmd=run mmcbootcmd
+
+# With cmdline/bootargs in cmdline.txt
+mmcbootcmd=echo starting from MMC ; mmc part 0; fatload mmc 0:1 0x80200000 kernel.bin; fatload mmc 0:1 0x90000000 ds.elf; fatload mmc 0:1 0x90800000 rs.elf; fatload mmc 0:1 0x91000000 pm.elf; fatload mmc 0:1 0x91800000 sched.elf; fatload mmc 0:1 0x92000000 vfs.elf; fatload mmc 0:1 0x96800000 memory.elf; fatload mmc 0:1 0x93000000 log.elf; fatload mmc 0:1 0x93800000 tty.elf; fatload mmc 0:1 0x94000000 mfs.elf; fatload mmc 0:1 0x94800000 vm.elf; fatload mmc 0:1 0x95000000 pfs.elf; fatload mmc 0:1 0x95800000 init.elf; mw.b 0x96000000 0 16384; fatload mmc 0:1 0x96000000 cmdline.txt; go 0x80200000
+
+# Netbooting.
+#echo == Configure the server IP ==
+#serverip=192.168.12.10
+#ipaddr=192.168.12.62
+#usbnet_devaddr=e8:03:9a:24:f9:10
+#usbethaddr=e8:03:9a:24:f9:11
+#mmcbootcmd=echo starting from TFTP; usb start ; tftp 0x80200000 kernel.bin; tftp 0x90000000 ds.elf; tftp 0x90800000 rs.elf; tftp 0x91000000 pm.elf; tftp 0x91800000 sched.elf; tftp 0x92000000 vfs.elf; tftp 0x96800000 memory.elf; tftp 0x93000000 log.elf; tftp 0x93800000 tty.elf; tftp 0x94000000 mfs.elf; tftp 0x94800000 vm.elf; tftp 0x95000000 pfs.elf; tftp 0x95800000 init.elf; mw.b 0x96000000 0 16384; tftp 0x96000000 cmdline.txt; dcache off ; icache off ; go 0x80200000
+
+# For mmcinfo
+#mmcbootcmd=mmcinfo; fatload mmc 0:1 0x80200000 boot.bin; go 0x80200000
+
+# beaglebone
+#mmc rescan; fatload mmc 0 0x80200000 kernel.bin; go 0x80200000