From: Kern Sibbald Date: Fri, 13 May 2005 21:30:04 +0000 (+0000) Subject: Enhance makefiles X-Git-Tag: Release-1.38.0~464 X-Git-Url: https://git.sur5r.net/?p=bacula%2Frescue;a=commitdiff_plain;h=a8fb5b31c17996100e529e9bba5c02cc3c0f862a Enhance makefiles --- diff --git a/rescue/Makefile.in b/rescue/Makefile.in index 9592dc5..e1bb125 100755 --- a/rescue/Makefile.in +++ b/rescue/Makefile.in @@ -8,8 +8,8 @@ srcdir = @srcdir@ VPATH = @srcdir@ .PATH: @srcdir@ -topdir = .. -thisdir = bootstrap +topdir = . +thisdir = . first_rule: all diff --git a/rescue/autoconf/configure.in b/rescue/autoconf/configure.in index 94a4619..37fb26f 100644 --- a/rescue/autoconf/configure.in +++ b/rescue/autoconf/configure.in @@ -86,11 +86,70 @@ if test ! x$CDRECORD = x ; then fi AC_SUBST(CDSTL) - dnl# -------------------------------------------------------------------------- dnl# CHECKING COMMAND LINE OPTIONS dnl# -------------------------------------------------------------------------- +# ------------------------------------------- +# static-fd (default off) +# ------------------------------------------- +AC_ARG_ENABLE(static-fd, + [ --enable-static-fd enable static File daemon [disabled]], + [if test x$enableval = xyes; then + support_static_fd=yes + fi]) + +STATIC_FD= +if test x$support_static_fd = xyes; then + STATIC_FD="static-bacula-fd" +fi +AC_SUBST(STATIC_FD) + +where= +# ------------------------------------------ +# Where to get iso +# ------------------------------------------ +AC_ARG_WITH(iso, + [ --with-iso=PATH specify path to iso], + [ + if test "x$withval" != "xno" ; then + where=$withval + type=iso + fi + ] +) +AC_SUBST(iso) + +# ------------------------------------------ +# Where to get cdrom +# ------------------------------------------ +AC_ARG_WITH(cdrom, + [ --with-cdrom=PATH specify path to cdrom], + [ + if test "x$withval" != "xno" ; then + where=$withval + type=cdrom + fi + ] +) + +AC_SUBST(where) +AC_SUBST(type) + +# ------------------------------------------ +# Where to get Bacula source +# ------------------------------------------ +AC_ARG_WITH(bacula, + [ --with-bacula=PATH specify path to bacula], + [ + if test "x$withval" != "xno" ; then + bacula=$withval + fi + ] +) + +AC_SUBST(bacula) + # # Finally we set appropriate distribution specific @@ -210,7 +269,9 @@ Configuration on `date`: Host: $host -- ${DISTNAME} ${DISTVER} Rescue version: ${VERSION} (${DATE}) - Source code location: ${srcdir} + Source code location: ${bacula} + Rescue disk image type: ${type} + Rescue disk image location: ${where} " > config.out diff --git a/rescue/configure b/rescue/configure index d04299f..f345297 100755 --- a/rescue/configure +++ b/rescue/configure @@ -272,7 +272,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="version.h" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG AWK VERSION DATE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MV RM CP ECHO AR CDRECORD build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE CDSTL hostname DISTNAME DISTVER LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG AWK VERSION DATE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MV RM CP ECHO AR CDRECORD build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE CDSTL STATIC_FD iso where type bacula hostname DISTNAME DISTVER LIBOBJS LTLIBOBJS' ac_subst_files='MCOMMON' # Initialize some variables set by options. @@ -784,6 +784,18 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-static-fd enable static File daemon disabled + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-iso=PATH specify path to iso + --with-cdrom=PATH specify path to cdrom + --with-bacula=PATH specify path to bacula + _ACEOF fi @@ -2255,6 +2267,76 @@ fi +# ------------------------------------------- +# static-fd (default off) +# ------------------------------------------- +# Check whether --enable-static-fd or --disable-static-fd was given. +if test "${enable_static_fd+set}" = set; then + enableval="$enable_static_fd" + if test x$enableval = xyes; then + support_static_fd=yes + fi +fi; + +STATIC_FD= +if test x$support_static_fd = xyes; then + STATIC_FD="static-bacula-fd" +fi + + +where= +# ------------------------------------------ +# Where to get iso +# ------------------------------------------ + +# Check whether --with-iso or --without-iso was given. +if test "${with_iso+set}" = set; then + withval="$with_iso" + + if test "x$withval" != "xno" ; then + where=$withval + type=iso + fi + + +fi; + + +# ------------------------------------------ +# Where to get cdrom +# ------------------------------------------ + +# Check whether --with-cdrom or --without-cdrom was given. +if test "${with_cdrom+set}" = set; then + withval="$with_cdrom" + + if test "x$withval" != "xno" ; then + where=$withval + type=cdrom + fi + + +fi; + + + + +# ------------------------------------------ +# Where to get Bacula source +# ------------------------------------------ + +# Check whether --with-bacula or --without-bacula was given. +if test "${with_bacula+set}" = set; then + withval="$with_bacula" + + if test "x$withval" != "xno" ; then + bacula=$withval + fi + + +fi; + + # @@ -3053,6 +3135,11 @@ s,@HAVE_IRIX_OS_FALSE@,$HAVE_IRIX_OS_FALSE,;t t s,@HAVE_DARWIN_OS_TRUE@,$HAVE_DARWIN_OS_TRUE,;t t s,@HAVE_DARWIN_OS_FALSE@,$HAVE_DARWIN_OS_FALSE,;t t s,@CDSTL@,$CDSTL,;t t +s,@STATIC_FD@,$STATIC_FD,;t t +s,@iso@,$iso,;t t +s,@where@,$where,;t t +s,@type@,$type,;t t +s,@bacula@,$bacula,;t t s,@hostname@,$hostname,;t t s,@DISTNAME@,$DISTNAME,;t t s,@DISTVER@,$DISTVER,;t t @@ -3454,7 +3541,9 @@ Configuration on `date`: Host: $host -- ${DISTNAME} ${DISTVER} Rescue version: ${VERSION} (${DATE}) - Source code location: ${srcdir} + Source code location: ${bacula} + Rescue disk image type: ${type} + Rescue disk image location: ${where} " > config.out diff --git a/rescue/linux/cdrom/Makefile.in b/rescue/linux/cdrom/Makefile.in index 977fce9..8d87294 100644 --- a/rescue/linux/cdrom/Makefile.in +++ b/rescue/linux/cdrom/Makefile.in @@ -15,6 +15,17 @@ iso: -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table cdtree +remaster: + rm -f bootcd.iso + mkisofs -A "Bacula Rescue Disk" -V "Bacula Rescue Disk" \ + -J -R -T -o bootcd.iso \ + -b isolinux/isolinux.bin -c isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table cdimage + +cdimage: + makecdimage --type=@type@ --where=@where@ + + # try booting it with qemu emulator boot: qemu -cdrom bootcd.iso @@ -34,19 +45,22 @@ static-bacula: dummy bacula: dummy @(cd bacula; make) -all: kernel binaries bacula initrd iso +copy-bacula: + cp -a bacula/ cdimage/ + +all: cdimage bacula copy-bacula remaster copy-static-fd: kernel binaries static-bacula initrd iso # This needs to be customized for your burner. burn: - cdrecord dev=@CDSTL@ gracetime=2 fs=4096k driveropts=burnfree -v \ + cdrecord dev=ATA:@CDSTL@ gracetime=2 fs=4096k driveropts=burnfree -v \ -useinfo speed=48 -dao -eject -pad -data "bootcd.iso" # Blank the CDROM assuming it is +rw blank: - cdrecord dev=@CDSTL@ gracetime=2 -v blank=fast -useinfo speed=48 + cdrecord dev=ATA:@CDSTL@ gracetime=2 -v blank=fast -useinfo speed=48 scan: cdrecord -scanbus diff --git a/rescue/linux/cdrom/README b/rescue/linux/cdrom/README index 473765c..e2023e4 100644 --- a/rescue/linux/cdrom/README +++ b/rescue/linux/cdrom/README @@ -179,7 +179,7 @@ Reading an ISO image: umount mnt rm -rf mnt -Unpacking in initrd.img: +Unpacking an initrd.img: mkdir mnt su mount -o loop xxx.iso mnt diff --git a/rescue/linux/cdrom/makebinaries b/rescue/linux/cdrom/makebinaries index ea638c6..ed6af5e 100755 --- a/rescue/linux/cdrom/makebinaries +++ b/rescue/linux/cdrom/makebinaries @@ -42,7 +42,6 @@ for file in `cat rootsbin.list` ; do rm -f $file fi done -# Special cases cd roottree/sbin ln -sf halt reboot cd $TOPDIR diff --git a/rescue/linux/cdrom/makecdimage b/rescue/linux/cdrom/makecdimage new file mode 100755 index 0000000..7e1128d --- /dev/null +++ b/rescue/linux/cdrom/makecdimage @@ -0,0 +1,110 @@ +#! /bin/sh + +# This script makes a copy of an existing boot cd or iso on +# disk so that we can add the Bacula code to it for remastering +# +# When we are done if there is no error, we should have the +# cdrom image in cdimage +# + +export LANG=C + +# Print Usage message +usage () { + cat </dev/null >/dev/null -# losetup -d /dev/loop2 2>/dev/null >/dev/null +umount /mnt/loop2 2>/dev/null >/dev/null +losetup -d /dev/loop2 2>/dev/null >/dev/null -# # associate it with /dev/loop2 -# losetup /dev/loop2 $TOPDIR/root +# associate it with /dev/loop2 +losetup /dev/loop2 $TOPDIR/root -# # make an ext2 filesystem on it. Set reserve to 0 -# mke2fs -q -m 0 /dev/loop2 $ISIZE -# if [ $? != 0 ] ; then -# echo "Build failed." -# exit 1 -# fi +# make an ext2 filesystem on it. Set reserve to 0 +mke2fs -q -m 0 /dev/loop2 $ISIZE +if [ $? != 0 ] ; then + echo "Build failed." + exit 1 +fi -# # we mount it... -# mount /dev/loop2 /mnt/loop2 +# we mount it... +mount /dev/loop2 /mnt/loop2 -# # ... and delete the lost+found directory -# rm -rf /mnt/loop2/lost+found +# ... and delete the lost+found directory +rm -rf /mnt/loop2/lost+found -# # then we copy the contents of our roottree to this filesystem -# cp -dpR roottree/* /mnt/loop2/ -# if [ $? != 0 ] ; then -# echo "RAM disk build failed." -# exit 1 -# fi +# then we copy the contents of our roottree to this filesystem +cp -dpR roottree/* /mnt/loop2/ +if [ $? != 0 ] ; then + echo "RAM disk build failed." + exit 1 +fi -# # and unmount and divorce /dev/loop2 -# umount /mnt/loop2 -# losetup -d /dev/loop2 +# and unmount and divorce /dev/loop2 +umount /mnt/loop2 +losetup -d /dev/loop2 -(cd roottree; find . | cpio --quiet -c -o) >root +# (cd roottree; find . | cpio --quiet -c -o) >root echo "Building initial RAM disk done" diff --git a/rescue/linux/cdrom/makekernel b/rescue/linux/cdrom/makekernel index f6a5860..eee2e23 100755 --- a/rescue/linux/cdrom/makekernel +++ b/rescue/linux/cdrom/makekernel @@ -23,6 +23,13 @@ echo "Updating modules in root RAM disk" rm -rf roottree/lib/modules mkdir -p roottree/lib/modules cp -af /lib/modules/$KERNEL/ roottree/lib/modules/ +# clean up just a bit +rm -rf roottree/lib/modules/build +rm -rf roottree/lib/modules/kernel/drivers/bluetooth +rm -rf roottree/lib/modules/kernel/drivers/pcmcia +rm -rf roottree/lib/modules/kernel/drivers/usb +rm -rf roottree/lib/modules/kernel/drivers/video +rm -rf roottree/lib/modules/kernel/drivers/isdn kernel="/boot/vmlinuz-$KERNEL" echo "Coping $kernel to $TOPDIR/cdtree/boot/isolinux/vmlinuz" diff --git a/rescue/linux/cdrom/rootsbin.list b/rescue/linux/cdrom/rootsbin.list index 035649e..176fe58 100644 --- a/rescue/linux/cdrom/rootsbin.list +++ b/rescue/linux/cdrom/rootsbin.list @@ -48,7 +48,6 @@ roottree/sbin/fsck.jfs roottree/sbin/fsck.msdos roottree/sbin/fsck.vfat roottree/sbin/ftp -roottree/sbin/gdb roottree/sbin/getkey roottree/sbin/grep roottree/sbin/grub @@ -110,7 +109,6 @@ roottree/sbin/more roottree/sbin/mount roottree/sbin/mt roottree/sbin/mv -roottree/sbin/nash roottree/sbin/netstat roottree/sbin/nice roottree/sbin/nm diff --git a/rescue/linux/cdrom/roottree/linuxrc b/rescue/linux/cdrom/roottree/linuxrc index 08733be..6a5f7c1 100755 --- a/rescue/linux/cdrom/roottree/linuxrc +++ b/rescue/linux/cdrom/roottree/linuxrc @@ -1,22 +1,39 @@ -#!/bin/sh +#!/bin/ash # # First script called by Linux when booting # +echo "============ in linuxrc ============" +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/initrd/bin trap "" 1 2 3 15 exec >/dev/console &1 + +echo Creating /dev +mount -o mode=0755 -t tmpfs none /dev +mknod /dev/console c 5 1 +mknod /dev/null c 1 3 +mknod /dev/zero c 1 5 +mkdir /dev/pts +mkdir /dev/shm + + mount -t proc none /proc +mount -t sysfs /sys /sys >/dev/null 2>&1 + CMDLINE=`cat /proc/cmdline` DEBUG="" case "$CMDLINE" in *debug*) DEBUG="yes"; ;; esac export DEBUG +echo Starting udev +echo -n "/sbin/hotplug" > /proc/sys/kernel/hotplug +udevstart + # Magic incantation for root to remain in ram +#ln -s /dev/ram0 /dev/root echo 0x0100 > /proc/sys/kernel/real-root-dev - mount -o remount,rw /dev/root / - # sh - +echo "================ exit linuxrc ============" exit 0