openap-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[openap-cvs] : openap-main/rootskel Makefile,NONE,1.1 README,NONE,1.1


From: David Kimdon <address@hidden>
Subject: [openap-cvs] : openap-main/rootskel Makefile,NONE,1.1 README,NONE,1.1
Date: Tue, 06 Aug 2002 15:28:07 -0400

Update of /cvsroot/openap/openap-main/rootskel
In directory subversions:/tmp/cvs-serv12957

Added Files:
        Makefile README 
Log Message:
- provide way for vendor/board configurations to install files and symlinks in
  init.d and rc*.d.
- include the device making logic in this file.  It needs to be cleaned up,
  actually, somehow, but it exists as-is for now.


--- NEW FILE ---
LN_S=ln -sf

BASEDIRS=proc var etc bin sbin etc/init.d

all clean:

install: basefiles runlevels

basefiles:
        @echo "Creating base directories."
        @for dir in $(BASEDIRS) ; do \
                $(INSTALL) -d $(DESTDIR)/$$dir; \
        done
        @for dir in `cd root ; find . -type d | grep -v CVS` ; do \
                $(INSTALL) -d $(DESTDIR)/$$dir; \
        done
        @echo "Installing base system files."
        @for file in `cd root; find . -type f | grep -v CVS` ; do \
                cp -dp root/$$file $(DESTDIR)/$$file; \
        done

# Configuration files add to the rcS_FILES variable a path like
# 'config/wl11000/S40networking'.  We process that string in the
# obvious way to create symlinks on the target.

rcS_FILES=rootskel/root/etc/init.d/S20mount.sh
rc0_FILES=rootskel/root/etc/init.d/S20umount.sh

runlevels:
        $(INSTALL) -d $(DESTDIR)/etc/rcS.d
        @set -e; \
        for file in $(rcS_FILES) ; do \
            pathname=`echo $$file | sed -e 's|/[^/]\{3\}\([^/]*\)$$|/\1|'`; \
            $(INSTALL) $(TOPDIR)/$$pathname $(DESTDIR)/etc/init.d/; \
            $(LN_S) ../init.d/`basename $$pathname` \
                $(DESTDIR)/etc/rcS.d/`basename $$file`; \
            echo "    /etc/rcS.d/`basename $$file` ->  ../init.d/`basename 
$$pathname` "; \
        done
        
        $(INSTALL) -d $(DESTDIR)/etc/rc0.d
        @set -e; \
        for file in $(rc0_FILES) ; do \
            pathname=`echo $$file | sed -e 's|/[^/]\{3\}\([^/]*\)$$|/\1|'`; \
            $(INSTALL) $(TOPDIR)/$$pathname $(DESTDIR)/etc/init.d/; \
            $(LN_S) ../init.d/`basename $$pathname` \
                $(DESTDIR)/etc/rc0.d/`basename $$file`; \
            echo "/etc/rc0.d/`basename $$file` ->  ../init.d/`basename 
$$pathname` "; \
        done


# FIXME : there should be a better way of creating these devices, possible
# using metafiles
devices:
        mkdir -p $(DESTDIR)/dev/
        $(MKNOD) $(DESTDIR)/dev/console c 5 1
        $(MKNOD) $(DESTDIR)/dev/initctl p
        $(MKNOD) $(DESTDIR)/dev/kmem    c 1 2
        $(MKNOD) $(DESTDIR)/dev/loop0   b 7 0
        $(MKNOD) $(DESTDIR)/dev/loop1   b 7 1
        $(MKNOD) $(DESTDIR)/dev/mem     c 1 1
        $(MKNOD) $(DESTDIR)/dev/null    c 1 3
        $(MKNOD) $(DESTDIR)/dev/port    c 1 4
        $(MKNOD) $(DESTDIR)/dev/ptmx    c 5 2
        ln -s    ram0                     $(DESTDIR)/dev/ram
        $(MKNOD) $(DESTDIR)/dev/ram0    b 1 0
        ln -s    ram0                     $(DESTDIR)/dev/ramdisk 
        $(MKNOD) $(DESTDIR)/dev/random  c 1 8
        ln -s    ../proc/self/fd/2        $(DESTDIR)/dev/stderr 
        ln -s    ../proc/self/fd/0        $(DESTDIR)/dev/stdin
        ln -s    ../proc/self/fd/1        $(DESTDIR)/dev/stdout 
        $(MKNOD) $(DESTDIR)/dev/tty     c 5 0
        $(MKNOD) $(DESTDIR)/dev/tty0    c 4 0
        $(MKNOD) $(DESTDIR)/dev/ttyS0   c 4 64
        $(MKNOD) $(DESTDIR)/dev/urandom c 1 9
        $(MKNOD) $(DESTDIR)/dev/zero    c 1 5
        $(MKNOD) $(DESTDIR)/dev/watchdog c 10 130

        $(MKNOD) $(DESTDIR)/dev/mtd0 c 90 0
        $(MKNOD) $(DESTDIR)/dev/mtdblock0 b 31 0

        # tty/pty's used by telnetd
        let i=0; \
        while [ $$i -lt 4 ] ; do\
                $(MKNOD) $(DESTDIR)/dev/ptyp$$i c 2 $$i ;\
                $(MKNOD) $(DESTDIR)/dev/ttyp$$i c 3 $$i ;\
                let i=$$i+1;\
        done

        address@hidden a+r $(DESTDIR)/dev 1>/dev/null 2>/dev/null

        # set a link from /etc/mtab to /proc/mtab
        ln -s ../proc/mounts $(DESTDIR)/etc/mtab

        # link /tmp to /var/tmp so we don't have to mount another ramfs
        ln -s /var/tmp $(DESTDIR)/tmp
        # link /etc/var to /var/etc/var so we don't have to mount another ramfs
        ln -s /var/etc/rw  $(DESTDIR)/etc/rw
        ln -s /var/etc/rw/resolv.conf  $(DESTDIR)/etc/resolv.conf

        # set the runlevels

        # init 1 - nothing running mode (upgrades)
        mkdir -p $(DESTDIR)/etc/rc1.d
        mkdir -p $(DESTDIR)/etc/rc3.d
ifeq ($(CONFIG_AP_BRIDGE),y)
        ln -s ../init.d/bridge $(DESTDIR)/etc/rc1.d/K60bridge
        ln -s ../init.d/bridge $(DESTDIR)/etc/rc3.d/S30bridge
        ln -s ../init.d/tcpip.bridge $(DESTDIR)/etc/rc3.d/S40tcpip
        ln -s ../init.d/tcpip.bridge $(DESTDIR)/etc/rc1.d/K50tcpip
endif
ifeq ($(CONFIG_AP_ROUTER),y)
        ln -s ../init.d/tcpip.router $(DESTDIR)/etc/rc3.d/S40tcpip
        ln -s ../init.d/tcpip.router $(DESTDIR)/etc/rc1.d/K50tcpip
endif
        ln -s ../init.d/wireless $(DESTDIR)/etc/rc1.d/K70wireless
        ln -s ../init.d/configfs $(DESTDIR)/etc/rc1.d/K80configfs

        # init 3 - normal run mode
        ln -s ../init.d/configfs $(DESTDIR)/etc/rc3.d/S10configfs
        ln -s ../init.d/wireless $(DESTDIR)/etc/rc3.d/S20wireless

        ln -s /var/syslogd.socket $(DESTDIR)/dev/log

include $(TOPDIR)/make/rules.mk

--- NEW FILE ---
* Board/Vendor Extentions

The 'rootskel' module provides a framework for installing files into
/etc/init.d/ and creating the accompanying symlink.  Board/Vendor
config.mk's add their files to a variable like:

rcS_FILES    += config/wl11000/S40networking

Provided a file config/wl11000/networking exists the build system will 
install it into /etc/init.d/networking and create a S40networking ->
../init.d/networking link in /etc/rcS.d.

* General Discussion

All initialization scripts are in /etc/init.d/.  Symbolic links in
/etc/init.d/rc<runlevel>.d/ control what scripts are run for which
runlevel and in what order.

Currently defined runlevels:

S - startup - These scripts are run once when the system first boots.
These scripts are responsible for mounting filesystems, configuring
network interfaces and initializing any other hardware.

0 - halt the system - These scripts will be run when the system is
going down.  These scripts should gracefully stop services and save
state as necessary.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]