ramdisk:replace proto.sh by the c processor.

Replace proto.sh by the c processor to generate proto.gen in order
for us to have a more flexible way of selecting the files we want
in the ramdisk.

Change-Id: Id82b9f1b73b498c4d885bb3156fcefaeb9d157e0
This commit is contained in:
Kees Jongenburger 2013-01-10 10:50:32 +01:00
parent bdfef53dbf
commit aacce8f40c
4 changed files with 39 additions and 48 deletions

View file

@ -10,6 +10,20 @@ install:
all:
#
# Add a few defines we are going to use during the image
# creation to determine what features and binaries to include
# in the final image
# ACPI do we have/include the acpi binary
# RAMDISK_SMALL is the script called with MKSMALL=yes
# DYNAMIC does the ramdisk contain dynamic binaries?
RAMDISK_INC_ACPI=0
RAMDISK_SMALL=0
RAMDISK_DYNAMIC=0
# the name of the proto file to use
PROTO= proto
PROG_DRIVERS=at_wini floppy pci
PROG_COMMANDS=cdprobe loadramdisk mount fsck.mfs sysenv sh \
service
@ -17,18 +31,18 @@ PROG_SERVERS=mfs procfs
PROG_USRSBIN=pwd_mkdb
PROGRAMS=${PROG_DRIVERS} ${PROG_COMMANDS} ${PROG_SERVERS} ${PROG_USRSBIN}
EXTRA=system.conf master.passwd rs.single
PROTO_FILES=proto.common.etc proto.common.dynamic proto.sh proto.dev
PROTO_FILES=proto.common.etc proto.common.dynamic proto.dev
.if ${MKSMALL} != "yes"
RAMDISK_SMALL=1
PROG_DRIVERS+= ahci
PROG_SERVERS+= ext2
PROTO= proto
.else
PROTO= proto.small
.endif
.if ${MKACPI} != "no"
PROG_DRIVERS+= acpi
RAMDISK_INC_ACPI=1
.endif
CPPFLAGS+= -I${NETBSDSRCDIR}/servers
@ -109,8 +123,15 @@ etc/master.passwd: ${NETBSDSRCDIR}/etc/master.passwd
pwd.db spwd.db passwd: etc/master.passwd
${INSTALL} etc/${@F} ${@F}
proto.gen: ${PROTO} ${PROTO_FILES} ${PROGRAMS}
${STRIP} ${PROGRAMS}
${HOST_SH} -e proto.sh ${PROTO} >${.OBJDIR}/${.TARGET}
# We are using the c preprocessor to generate proto.gen
# used in the mkfs tool.
${TOOL_CAT} ${PROTO} | ${HOST_CC} \
-DRAMDISK_INC_ACPI=${RAMDISK_INC_ACPI} \
-DRAMDISK_SMALL=${RAMDISK_SMALL} \
-DRAMDISK_DYNAMIC=${RAMDISK_DYNAMIC} \
-traditional-cpp -E - | grep -v "^$$" | grep -v "#" >${.OBJDIR}/${.TARGET}
.include <minix.service.mk>

View file

@ -3,7 +3,9 @@ boot
d--755 0 0
bin d--755 0 0
cdprobe ---755 0 0 cdprobe
#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
@ -13,7 +15,9 @@ d--755 0 0
floppy ---755 0 0 floppy
ahci ---755 0 0 ahci
at_wini ---755 0 0 at_wini
#if RAMDISK_SMALL == 1
ext2 ---755 0 0 ext2
#endif
mfs ---755 0 0 mfs
procfs ---755 0 0 procfs
$
@ -22,10 +26,17 @@ d--755 0 0
loadramdisk ---755 0 0 loadramdisk
$
sbin d--755 0 0
@ACPI@
#if RAMDISK_INC_ACPI == 1
acpi ---755 0 0 acpi
#endif
pci ---755 0 0 pci
$
$
dev d--755 0 0
@DEV@
#include "proto.dev"
$
#include "proto.common.etc"
#if RAMDISK_DYNAMIC == 1
#include "proto.common.dynamic"
#endif
$

View file

@ -1,19 +0,0 @@
#!/bin/sh
set -e
PATH=/bin:/sbin:/usr/bin:/usr/sbin
PROTO=${1:-proto}
sed -n '1,/@ACPI/p' <${PROTO} | grep -v @ACPI@
if [ -e acpi ]
then
echo " acpi ---755 0 0 acpi"
fi
sed -n '/@ACPI/,/@DEV/p' <${PROTO} | grep -v -e @ACPI@ -e @DEV@
cat proto.dev
sed -n '/@DEV/,$p' <${PROTO} | grep -v @DEV@
cat proto.common.etc
if [ -x /libexec/ld.elf_so ]
then cat proto.common.dynamic
fi
echo '$'

View file

@ -1,22 +0,0 @@
boot
0 0
d--755 0 0
bin d--755 0 0
cdprobe ---755 0 0 cdprobe
loadramdisk ---755 0 0 loadramdisk
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
@ACPI@
at_wini ---755 0 0 at_wini
floppy ---755 0 0 floppy
pci ---755 0 0 pci
mfs ---755 0 0 mfs
procfs ---755 0 0 procfs
$
dev d--755 0 0
@DEV@
$