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"
40 PROG_DRIVERS
+= at_wini floppy pci
41 PROG_COMMANDS
+= cdprobe loadramdisk sysenv
43 PROG_USRSBIN
+= pwd_mkdb
45 .if
${MKSMALL} != "yes"
48 PROG_DRIVERS
+= virtio_blk
56 .
endif # ${MACHINE_ARCH} == "i386"
58 .if
${MACHINE_ARCH} == "earm"
59 EXTRA
+= rc.arm mylogin.sh ttys
60 PROG_DRIVERS
+= mmc tty gpio
61 PROG_COMMANDS
+= cp dd getty time sleep stty umount
62 PROG_BIN
+= cat ls
rm sync
63 PROTO
= proto.arm.small
64 .
endif # ${MACHINE_ARCH} == "earm"
66 .if
${LDSTATIC} == "-dynamic"
68 PROG_LIBEXEC
+= ld.elf_so
69 PROG_LIBS
+= libc libminlib libcompat_minix libterminfo
72 PROGRAMS
=${PROG_DRIVERS} ${PROG_COMMANDS} ${PROG_SERVERS} \
73 ${PROG_USRSBIN} ${PROG_BIN} ${PROG_LIBEXEC}
75 CPPFLAGS
+= -I
${NETBSDSRCDIR}/servers
77 # LSC We have to take care of not erasing the source file, so never add EXTRA
79 CLEANFILES
+= ${PROGRAMS} ${SCRIPTS} ${ETC} image image.c t proto.gen
80 CLEANFILES
+= ${LIBRARIES}
81 CLEANFILES
+= ${PROG_LIBEXEC}
82 CLEANFILES
+= ${.OBJDIR
}/etc
/*
84 #############################################################
85 # LSC Below this point the rules should not be modified
86 #############################################################
88 # Tool to bootstrap the password db
89 TOOL_PWD_MKDB?
= ${NETBSDSRCDIR}/usr.sbin
/pwd_mkdb
/pwd_mkdb
91 # Remove "drivers/ramdisk" component from path
92 PROGROOT
:= ${.OBJDIR
:S
,drivers
/ramdisk
,,}
94 # Generate dependencies rules for config files
96 ${etc}: ${NETBSDSRCDIR}/etc
/${etc}
100 # LSC Force the regeneration of the proto file as it seems sometimes
101 # they are not copied over as needed.
102 # LSC ramdisk rc file != /etc/rc
103 # BJG if ${.CURDIR} == ${.OBJDIR}, we are building in-tree and install
104 # shouldn't try to install the originals over the originals. Otherwise
105 # we are building out-of-tree and the contents should be copied
106 # unconditionally in case the contents have changed after the first copy.
107 .if
${.CURDIR
} != ${.OBJDIR
}
108 .for file in
${EXTRA} ${PROTO} ${PROTO_FILES}
109 CLEANFILES
+= ${.OBJDIR
}/${file}
110 ${file}: ${NETBSDSRCDIR}/drivers
/ramdisk
/${file} .PHONY
115 # Generate dependencies rules for dynamic libraries, if needed
116 .for lib in
${PROG_LIBS}
117 PROGRAMS
+= ${lib}.so
.0
118 CLEANFILES
+= ${lib}.so
.0
119 ${lib}.so
.0:${PROGROOT}/lib
/${lib}/${lib}.so
.0
122 ${PROGROOT}/lib
/${lib}/${lib}.so
.0:
123 ${MAKE} -C
${NETBSDSRCDIR}/lib
/${lib} all
126 # Generate dependencies rules for binaries
128 .for
srcdir in bin commands drivers libexec servers
129 .for prog in
${PROG_
${srcdir:tu
}}
130 ${prog}: ${PROGROOT}/${srcdir}/${dir.
${prog}:U
${prog}}/${prog}
133 ${PROGROOT}/${srcdir}/${dir.
${prog}:U
${prog}}/${prog}:
134 ${MAKE} -C
${NETBSDSRCDIR}/${srcdir}/${dir.
${prog}:U
${prog}} all
138 # We have to do this as a separate loop, because USR.SBIN is not a valid
139 # make variable name.
140 .for prog in
${PROG_USRSBIN}
141 ${prog}: ${PROGROOT}/usr.sbin
/${dir.
${prog}:U
${prog}}/${prog}
144 ${PROGROOT}/usr.sbin
/${dir.
${prog}:U
${prog}}/${prog}:
145 ${MAKE} -C
${NETBSDSRCDIR}/usr.sbin
/${dir.
${prog}:U
${prog}} all
148 image
: proto.gen
${ETC} ${EXTRA} pwd.db spwd.db passwd
149 ${_MKMSG_CREATE} "Generating ramdisk image"
150 ${TOOL_MKFSMFS} image proto.gen ||
{ rm -f image
; false
; }
151 # if fsck.mfs -s image | grep -q CLEAN; \
153 # else echo "CLEAN sanity check of image failed." ; \
154 # echo "(Perhaps install current mkfs and fsck.)" ; \
155 # rm -f image; false; \
158 etc
/master.passwd
: ${NETBSDSRCDIR}/etc
/master.passwd
159 rm -rf
${.OBJDIR
}/etc
/
160 mkdir
-p
${.OBJDIR
}/etc
162 ${TOOL_PWD_MKDB} -V
0 -p
-d . etc
/master.passwd
164 # LSC We use @F because some version of make still output a full path for @,
165 # even when the target is just a file name
166 pwd.db spwd.db passwd
: etc
/master.passwd
167 ${INSTALL} etc
/${@F
} ${@F
}
169 proto.gen
: ${PROTO} ${PROTO_FILES} ${PROGRAMS}
171 # We are using the c preprocessor to generate proto.gen
172 # used in the mkfs tool.
173 ${TOOL_CAT} ${PROTO} |
${CC} \
175 -E
- | grep
-v
"^$$" | grep
-v
"#" >${.OBJDIR
}/${.TARGET
}
177 .
include <minix.service.mk
>