Use objcopy to build ramdisk object
. during build, uses much less memory, disk space, and time . lets us throw out bintoc
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Makefile for memory driver (MEMORY)
|
||||
PROG= memory
|
||||
SRCS= memory.c imgrd.c
|
||||
SRCS= memory.c imgrd.mfs
|
||||
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
|
||||
|
||||
DPADD+= ${LIBBLOCKDRIVER} ${LIBCHARDRIVER} ${LIBSYS}
|
||||
LDADD+= -lblockdriver -lchardriver -lsys
|
||||
@@ -10,6 +11,22 @@ MAN=
|
||||
BINDIR?= /usr/sbin
|
||||
|
||||
CPPFLAGS.memory.c+= -I${MINIXSRCDIR}
|
||||
CPPFLAGS.imgrd.c+= -I${.CURDIR}/../ramdisk
|
||||
|
||||
imgrd.d: touch-genfiles
|
||||
touch-genfiles:
|
||||
[ -e ../ramdisk/image ] || touch -t 197001020000.00 ../ramdisk/image
|
||||
|
||||
|
||||
.SUFFIXES: .mfs .c .o
|
||||
|
||||
# 'elf32-${ARCH}-minix' below should really be ${MACHINE_GNU_PLATFORM}
|
||||
# but bsd.own.mk has to be upgraded for that.
|
||||
.mfs.o:
|
||||
${_MKTARGET_CREATE}
|
||||
${OBJCOPY} -Ibinary -B${ARCH} -Oelf32-${ARCH}-minix $< $@
|
||||
|
||||
imgrd.mfs:
|
||||
ln -s ../ramdisk/image $@
|
||||
CLEANFILES+= imgrd.mfs
|
||||
|
||||
.include <minix.bootprog.mk>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
Ramdisk that is part of the image
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "local.h"
|
||||
|
||||
unsigned char imgrd[]=
|
||||
{
|
||||
#include "image.c"
|
||||
};
|
||||
|
||||
size_t imgrd_size= sizeof(imgrd);
|
||||
@@ -2,5 +2,8 @@
|
||||
local defines and declarations
|
||||
*/
|
||||
|
||||
extern unsigned char imgrd[];
|
||||
extern size_t imgrd_size;
|
||||
extern unsigned char _binary_imgrd_mfs_start[], *_binary_imgrd_mfs_end;
|
||||
|
||||
#define imgrd _binary_imgrd_mfs_start
|
||||
#define imgrd_size \
|
||||
((size_t)(_binary_imgrd_mfs_end - _binary_imgrd_mfs_start))
|
||||
|
||||
Reference in New Issue
Block a user