pre-klibc state

This commit is contained in:
Sergey Bolshakov 2008-03-01 17:50:20 +03:00
parent 85c9a14f65
commit 435eacecc6
3 changed files with 73 additions and 88 deletions

View File

@ -1 +1 @@
tar.bz2: . name=propagator-@version@ base=
tar: . name=@name@-@version@-@release@ base=@name@-@version@

147
Makefile
View File

@ -1,40 +1,3 @@
#******************************************************************************
#
# mdk-stage1 - the program that will load second-stage install
#
# $Id$
#
# Guillaume Cottenceau (gc@mandrakesoft.com)
#
# Copyright 2000 MandrakeSoft
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Portions from Erik Troan (ewt@redhat.com) Copyright 1996 Red Hat Software
#
#*****************************************************************************
#
# Currently:
#
# ix86
# init with minilibc
# stage1 with dietlibc except some targets
#
# ppc
# init with dietlibc
# stage1 with glibc
#
# ia64
# init with glibc
# stage1 with glibc
#
#*****************************************************************************
PACKAGE = propagator
DESTDIR =
@ -43,12 +6,47 @@ BINDIR ?= /usr/bin
LIBDIR ?= /usr/lib
BINSDIR ?= $(LIBDIR)/$(PACKAGE)/bin
TARGETS = init stage1 gencpio
TARGETS = init stage1
all: version.h $(TARGETS)
include Makefile.common
#---------------------------------------------------------------
L ?= GLIBC
#L = KLIBC
ifeq (KLIBC, $(L))
CC = klcc
endif
ifeq ($(F),)
ifeq ($(L),GLIBC)
F = NEWT
else
F = STDIO
endif
endif
CFLAGS += -Os -pipe -Wall -D_GNU_SOURCE
GLIBC_INCLUDES =
KLIBC_INCLUDES =
INCLUDES = -I. $($(L)_INCLUDES)
GCC_LIBDIR=$(shell dirname `gcc -print-libgcc-file-name`)
LIBGCC_A=$(shell gcc -print-libgcc-file-name)
GLIBC_LDFLAGS_STAGE1 = -static
KLIBC_LDFLAGS_STAGE1 =
# $(LIBGCC_A)
LDFLAGS_STAGE1 = $($(L)_LDFLAGS_STAGE1)
GLIBC_LIBC =
KLIBC_LIBC =
STAGE1_LIBC = $($(L)_LIBC)
STRIPCMD = strip -R .note -R .comment
#---------------------------------------------------------------
DEFS =
INIT_DEFS =
STAGE1_DEFS =
@ -70,43 +68,30 @@ COMPILE = $(CC) $(DEFS) $(CFLAGS)
#- stage1 "loader"
# i386 name is invalid to force this feature off
ifeq (xi386, $(ARCH))
INITSRC = minilibc.c init.c
INIT_DEFS = -DINIT_HEADERS=\"minilibc.h\"
else
INITSRC = init.c
ifeq (ia64, $(ARCH))
INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(GLIBC_INCLUDES)
else
INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(DIETLIBC_INCLUDES)
endif
endif
INIT_DEFS = $(INCLUDES)
INITOBJS = $(subst .c,.o,$(INITSRC))
INITOBJS = $(addprefix $(L)-,$(subst .c,.o,$(INITSRC)))
#- frontends
NEWT_FRONTEND_SRC = newt-frontend.c
GLIBC_NEWT_FRONTEND_LIBS = $(LIBDIR)/libnewt.a $(LIBDIR)/libslang.a
DIETLIBC_NEWT_FRONTEND_LIBS = $(DIET_LIBDIR)/libnewt.a $(DIET_LIBDIR)/libslang.a
NEWT_FRONTEND_LIBS = $(LIBDIR)/libnewt.a $(LIBDIR)/libslang.a
STDIO_FRONTEND_SRC = stdio-frontend.c
GLIBC_STDIO_FRONTEND_LIBS =
DIETLIBC_STDIO_FRONTEND_LIBS =
STDIO_FRONTEND_LIBS =
FRONTEND_OBJS = $(addprefix $(L)-,$(subst .c,.o,$($(F)_FRONTEND_SRC)))
FRONTEND_LINK = $(FRONTEND_OBJS) $($(F)_FRONTEND_LIBS)
FRONTEND_OBJS = $(subst .c,.o,$($(F)_FRONTEND_SRC))
FRONTEND_LINK = $(FRONTEND_OBJS) $($(L)_$(F)_FRONTEND_LIBS)
GLIBC_STAGE1_OWN_LIBS = $(LIBDIR)/libmar.a $(LIBDIR)/libbz2.a
DIETLIBC_STAGE1_OWN_LIBS = $(DIET_LIBDIR)/libmar.a $(DIET_LIBDIR)/libbz2.a
GLIBC_STAGE1_OWN_LIBS =
KLIBC_STAGE1_OWN_LIBS =
STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS)
ifeq (DIETLIBC, $(L))
STAGE1_NETWORK_LIBS = $(DIET_LIBDIR)/librpc.a
ifeq ($(L),KLIBC)
STAGE1_NETWORK_LIBS =
endif
ifeq (GLIBC, $(L))
ifeq ($(L),GLIBC)
STAGE1_NETWORK_LIBS = $(LIBDIR)/libresolv.a
endif
@ -116,25 +101,16 @@ STAGE1SRC = stage1.c log.c tools.c modules.c probing.c \
mount.c lomount.c automatic.c frontend-common.c \
cdrom.c disk.c \
network.c nfsmount.c dhcp.c url.c dns.c adsl.c
ALLSRC = $(INITSRC) $(STAGE1SRC)
###############################################################################
STAGE1OBJS = $(subst .c,.o,$(STAGE1SRC))
STAGE1OBJS = $(addprefix $(L)-,$(subst .c,.o,$(STAGE1SRC)))
ifeq (xi386, $(ARCH))
LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o
else
ifeq (ia64, $(ARCH))
LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1)
INIT_LIBC = $(GLIBC_LIBC)
else
LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1)
INIT_LIBC = $(GLIBC_LIBC)
endif
endif
LDFLAGS_INIT = $($(L)_LDFLAGS_STAGE1)
INIT_LIBC = $($(L)_LIBC)
init: $(INITOBJS) $(INIT_LIBC)
init: $(INITOBJS) $(INIT_LIBC)
$(CC) -o $@ $^ $(LDFLAGS_INIT)
$(STRIPCMD) $@
@ -142,14 +118,14 @@ stage1: $(STAGE1OBJS) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK)
$(CC) -o $@ $^ $(LDFLAGS_STAGE1)
$(STRIPCMD) $@
$(INITOBJS): %.o: %.c
$(COMPILE) $(INIT_DEFS) -c $<
$(INITOBJS): $(L)-%.o: %.c
$(COMPILE) $(INIT_DEFS) -c $< -o $@
$(STAGE1OBJS): %.o: %.c
$(STAGE1OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) $(STAGE1_DEFS) -c $< -o $@
.c.o:
$(COMPILE) $(INCLUDES) -c $<
$(FRONTEND_OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) -c $< -o $@
version.h: /etc/altlinux-release
@sed 's|^ALT Linux \([^ ]\+\)\([^(]\+\)(\([^)]\+\))|\
@ -172,3 +148,10 @@ install: $(TARGETS)
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(BINSDIR)
install -m0755 gencpio $(DESTDIR)$(BINDIR)
install -m0755 init stage1 $(DESTDIR)$(BINSDIR)
initfs: all mkinitfs
sh mkinitfs > $@
test: initfs modpack
cat $^ > $@
qstage -initrd test

View File

@ -9,20 +9,22 @@ Summary: 'Early userspace' set of binaries
License: GPL
Group: System/Kernel and hardware
Source0: %name-%version.tar.bz2
Source0: %name-%version-%release.tar
BuildRequires: mar >= 20070301-alt1 bzlib-devel-static libnewt-devel-static libslang-devel-static
BuildRequires: bzlib-devel-static libnewt-devel-static libslang-devel-static
%description
%name is a set of binaries useful in 'early userspace' environment,
including init and various helpers for hw probing and bootstrapping.
%prep
%setup -c
%setup
%build
make %{?_with_shell:WITH_SHELL=t} %{?_with_splash:WITH_SPLASH=t} \
LIBDIR=%_libdir CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"
make CFLAGS="$RPM_OPT_FLAGS" \
%{?_with_shell:WITH_SHELL=t} \
%{?_with_splash:WITH_SPLASH=t} \
LIBDIR=%_libdir
%install
%make_install DESTDIR=%buildroot LIBDIR=%_libdir install