propagator/Makefile
Michael Shigorin 8d2cd5aec8 initial verify_ramdisk_digest()
This is a patch by Maxim Suhanov <suhanov/group-ib.ru>
aiming to provide integrity and authenticity check for
stage2 rootfs image when required:

- media bootloader passes sha256 hash of stage2 image;
- stage1 early userspace code (that is, propagator)
  checks the candidate files against that during search;
- existing file with different checksum results in a warning
  with a dialog to just say NO, continue searching for the
  proper squashfs image and have a look at that weird one;
- existing file with correct checksum results in booting
  as usual.

The check is triggered by "hash=..." kernel boot parameter.

See also http://www.forensicswiki.org/wiki/Forensic_Live_CD_issues
2014-04-19 12:49:58 +04:00

129 lines
2.8 KiB
Makefile

PACKAGE = propagator
DESTDIR =
bindir = /usr/bin
libdir = /usr/lib
INSTALL = /bin/install
#---------------------------------------------------------------
L ?= GLIBC
#L = KLIBC
ifeq ($(L),KLIBC)
CC = klcc
endif
ifeq ($(F),)
ifeq ($(L),GLIBC)
F = NEWT
else
F = STDIO
endif
endif
CFLAGS += -Os -pipe -Wall
GLIBC_INCLUDES =
KLIBC_INCLUDES =
INCLUDES = $($(L)_INCLUDES)
GLIBC_LDFLAGS = -static
KLIBC_LDFLAGS =
MUSL_LDFLAGS = -static
LDFLAGS += $($(L)_LDFLAGS)
STRIPCMD = strip -R .note -R .comment
#---------------------------------------------------------------
DEFS = -D_GNU_SOURCE
#---------------------------------------------------------------
INITSRC = init.c
INITOBJS = $(addprefix $(L)-,$(subst .c,.o,$(INITSRC)))
#---------------------------------------------------------------
STAGE1_DEFS =
ifneq ($(WITH_SHELL),)
STAGE1_DEFS += -DSPAWN_SHELL
endif
ifneq ($(WITH_SPLASH),)
STAGE1_DEFS += -DSPAWN_SPLASH
endif
ifeq ($(WITH_ADSL),)
STAGE1_DEFS += -DDISABLE_ADSL
endif
ifneq ($(WITHOUT_USBNET),)
STAGE1_DEFS += -DDISABLE_USBNET
endif
COMPILE = $(CC) $(CFLAGS) $(DEFS)
#- frontends
NEWT_FRONTEND_SRC = newt-frontend.c
NEWT_FRONTEND_LIBS = $(libdir)/libnewt.a $(libdir)/libslang.a
STDIO_FRONTEND_SRC = stdio-frontend.c
STDIO_FRONTEND_LIBS =
FRONTEND_OBJS = $(addprefix $(L)-,$(subst .c,.o,$($(F)_FRONTEND_SRC)))
FRONTEND_LINK = $(FRONTEND_OBJS) $($(F)_FRONTEND_LIBS)
GLIBC_STAGE1_OWN_LIBS =
KLIBC_STAGE1_OWN_LIBS =
STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS)
KLIBC_STAGE1_NETWORK_LIBS =
GLIBC_STAGE1_NETWORK_LIBS = $(libdir)/libresolv.a
STAGE1_NETWORK_LIBS = $($(L)_STAGE1_NETWORK_LIBS)
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c \
mount.c lomount.c automatic.c frontend-common.c \
cdrom.c disk.c common.c \
network.c dhcp.c url.c dns.c adsl.c \
sha256.c
STAGE1OBJS = $(addprefix $(L)-,$(subst .c,.o,$(STAGE1SRC)))
#---------------------------------------------------------------
ALLSRC = $(INITSRC) $(STAGE1SRC)
TARGETS = init gencpio
all: version.h $(TARGETS)
init: $(INITOBJS) $(STAGE1OBJS) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
$(CC) -o $@ $^ $(LDFLAGS)
$(STRIPCMD) $@
$(INITOBJS): $(L)-%.o: %.c
$(COMPILE) $(INIT_DEFS) -c $< -o $@
$(STAGE1OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) $(STAGE1_DEFS) -c $< -o $@
$(FRONTEND_OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) -c $< -o $@
version.h:
echo -e \#define VERSION \"$(version)\" \\n\#define DISTRIB_NAME \"ALT Linux\" > $@
gencpio: gen_init_cpio.c
$(CC) $(CFLAGS) $(DEFS) -o $@ $^
install:
$(INSTALL) -D -m0755 gencpio $(DESTDIR)$(bindir)/gencpio
$(INSTALL) -m0755 mkmodpack $(DESTDIR)$(bindir)/mkmodpack
$(INSTALL) -D -m0755 init $(DESTDIR)/usr/sbin/propagator
clean:
rm -f *.o .depend $(TARGETS) version.h
.depend: version.h
$(CPP) $(CFLAGS) -M $(ALLSRC) > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif