1 # Makefile for ramdisk image
9 # Add a few defines we are going to use during the image
10 # creation to determine what features and binaries to include
12 # ACPI do we have/include the acpi binary
13 # RAMDISK_SMALL is the script called with MKSMALL=yes
14 # DYNAMIC does the ramdisk contain dynamic binaries?
20 -DRAMDISK_INC_ACPI
=${RAMDISK_INC_ACPI} \
21 -DRAMDISK_SMALL
=${RAMDISK_SMALL} \
22 -DRAMDISK_DYNAMIC
=${RAMDISK_DYNAMIC}
24 # The name of the proto file to use
27 # Common to all architectures
28 ETC
= system.conf master.passwd
30 PROTO_FILES
= proto.common.etc proto.common.dynamic proto.dev
32 PROG_COMMANDS
= mount fsck.mfs sh service
37 .if
${MACHINE_ARCH} == "i386"
39 PROG_DRIVERS
+= at_wini floppy pci
40 PROG_COMMANDS
+= cdprobe loadramdisk sysenv
42 PROG_USRSBIN
+= pwd_mkdb
44 .if
${MKSMALL} != "yes"
54 .
endif # ${MACHINE_ARCH} == "i386"
56 .if
${MACHINE_ARCH} == "earm"
58 PROG_DRIVERS
+= mmc tty
59 PROG_COMMANDS
+= cp dd getty ls time sync sleep stty umount
61 PROTO
= proto.arm.small
62 .
endif # ${MACHINE_ARCH} == "earm"
64 .if
${LDSTATIC} == "-dynamic"
66 PROG_LIBEXEC
+= ld.elf_so
67 PROG_LIBS
+= libc libminlib libcompat_minix libterminfo
70 PROGRAMS
=${PROG_DRIVERS} ${PROG_COMMANDS} ${PROG_SERVERS} \
71 ${PROG_USRSBIN} ${PROG_BIN} ${PROG_LIBEXEC}
73 CPPFLAGS
+= -I
${NETBSDSRCDIR}/servers
75 # LSC We have to take care of not erasing the source file, so never add EXTRA
77 CLEANFILES
+= ${PROGRAMS} ${SCRIPTS} ${ETC} image image.c t proto.gen
78 CLEANFILES
+= ${LIBRARIES}
79 CLEANFILES
+= ${PROG_LIBEXEC}
80 CLEANFILES
+= ${.OBJDIR
}/etc
/*
82 #############################################################
83 # LSC Below this point the rules should not be modified
84 #############################################################
86 # Tool to bootstrap the password db
87 TOOL_PWD_MKDB?
= ${NETBSDSRCDIR}/usr.sbin
/pwd_mkdb
/pwd_mkdb
89 # Remove "drivers/ramdisk" component from path
90 PROGROOT
:= ${.OBJDIR
:S
,drivers
/ramdisk
,,}
92 # Generate dependencies rules for config files
94 ${etc}: ${NETBSDSRCDIR}/etc
/${etc}
98 # LSC Force the regeneration of the proto file as it seems sometimes
99 # they are not copied over as needed.
100 # LSC The test is needed; otherwise install complains about src and dst
101 # being the same, during in-tree builds
102 # LSC ramdisk rc file != /etc/rc && mtab not empty!
103 .for file in
${EXTRA} ${PROTO} ${PROTO_FILES}
104 ${file}: ${NETBSDSRCDIR}/drivers
/ramdisk
/${file} .PHONY
105 [ -e
$@
] ||
${INSTALL} $> $@
108 # Generate dependencies rules for dynamic libraries, if needed
109 .for lib in
${PROG_LIBS}
110 PROGRAMS
+= ${lib}.so
.0
111 CLEANFILES
+= ${lib}.so
.0
112 ${lib}.so
.0:${PROGROOT}/lib
/${lib}/${lib}.so
.0
115 ${PROGROOT}/lib
/${lib}/${lib}.so
.0:
116 ${MAKE} -C
${NETBSDSRCDIR}/lib
/${lib} all
119 # Generate dependencies rules for binaries
121 .for
srcdir in bin commands drivers libexec servers
122 .for prog in
${PROG_
${srcdir:tu
}}
123 ${prog}: ${PROGROOT}/${srcdir}/${dir.
${prog}:U
${prog}}/${prog}
126 ${PROGROOT}/${srcdir}/${dir.
${prog}:U
${prog}}/${prog}:
127 ${MAKE} -C
${NETBSDSRCDIR}/${srcdir}/${dir.
${prog}:U
${prog}} all
131 # We have to do this as a separate loop, because USR.SBIN is not a valid
132 # make variable name.
133 .for prog in
${PROG_USRSBIN}
134 ${prog}: ${PROGROOT}/usr.sbin
/${dir.
${prog}:U
${prog}}/${prog}
137 ${PROGROOT}/usr.sbin
/${dir.
${prog}:U
${prog}}/${prog}:
138 ${MAKE} -C
${NETBSDSRCDIR}/usr.sbin
/${dir.
${prog}:U
${prog}} all
141 image
: proto.gen
${ETC} ${EXTRA} pwd.db spwd.db passwd
142 ${_MKMSG_CREATE} "Generating ramdisk image"
143 ${TOOL_MKFSMFS} image proto.gen ||
{ rm -f image
; false
; }
144 # if fsck.mfs -s image | grep -q CLEAN; \
146 # else echo "CLEAN sanity check of image failed." ; \
147 # echo "(Perhaps install current mkfs and fsck.)" ; \
148 # rm -f image; false; \
151 etc
/master.passwd
: ${NETBSDSRCDIR}/etc
/master.passwd
152 rm -rf
${.OBJDIR
}/etc
/
153 mkdir
-p
${.OBJDIR
}/etc
155 ${TOOL_PWD_MKDB} -V
0 -p
-d . etc
/master.passwd
157 # LSC We use @F because some version of make still output a full path for @,
158 # even when the target is just a file name
159 pwd.db spwd.db passwd
: etc
/master.passwd
160 ${INSTALL} etc
/${@F
} ${@F
}
162 proto.gen
: ${PROTO} ${PROTO_FILES} ${PROGRAMS}
164 # We are using the c preprocessor to generate proto.gen
165 # used in the mkfs tool.
166 ${TOOL_CAT} ${PROTO} |
${HOST_CC} \
168 -traditional-cpp
-E
- | grep
-v
"^$$" | grep
-v
"#" >${.OBJDIR
}/${.TARGET
}
170 .
include <minix.service.mk
>