Merge pull request #78 from bauen1/dhcp-overlay2

DHCP/DNS overlay bundle
This commit is contained in:
Ivan Davidov 2017-08-01 22:03:33 +03:00 committed by GitHub
commit 29e3f3049f
12 changed files with 53 additions and 59 deletions

View File

@ -171,12 +171,13 @@ COPY_SOURCE_ISO=true
# static_get - portable binaries for Linux (http://s.minos.io)
# cf_cli - CLoud Foundry CLI (command line interface)
# nweb - simple mini http server
# dhcp - DHCP and DNS functionality
#
# Refer to the README file for more information.
#
#OVERLAY_BUNDLES=glibc_full,links,dropbear,java,felix,mll_utils,lua,static_get,cf_cli
#OVERLAY_BUNDLES=cf_cli
OVERLAY_BUNDLES=nweb
OVERLAY_BUNDLES=nweb,dhcp
# This property enables the standard penguin boot logo in the upper left corner
# of the screen. The property is used in 'xx_build_kernel.sh'. The default value

View File

@ -57,10 +57,6 @@ fi
cp $SYSROOT/lib/libm.so.6 lib
cp $SYSROOT/lib/libc.so.6 lib
# These libraries are necessary for the DNS resolving.
cp $SYSROOT/lib/libresolv.so.2 lib
cp $SYSROOT/lib/libnss_dns.so.2 lib
# Copy all necessary 'glibc' libraries to '/lib' END.
strip -g \

View File

@ -69,6 +69,8 @@ Currently available overlay bundles:
add '-net nic,model=e1000 -net user,hostfwd=tcp::8080-:80' to the cmd in
qemu64.sh and qemu32.sh
* dhcp - DHCP and DNS functionality
### ### ###
I only provide the build scripts. It's entirely up to you to configure and

View File

@ -0,0 +1,17 @@
#!/bin/sh
# This script gets called by udhcpc to setup the network interfaces
ip addr add $ip/$mask dev $interface
if [ "$router" ]; then
ip route add default via $router dev $interface
fi
if [ "$ip" ]; then
echo -e "DHCP configuration for device $interface"
echo -e "IP: \\e[1m$ip\\e[0m"
echo -e "mask: \\e[1m$mask\\e[0m"
echo -e "router: \\e[1m$router\\e[0m"
fi

View File

@ -0,0 +1,27 @@
#!/bin/sh
SRC_DIR=$(pwd)
. ../../common.sh
echo "removing previous work area"
rm -rf $WORK_DIR/overlay/dhcp
mkdir -p $WORK_DIR/overlay/dhcp
cd $WORK_DIR/overlay/dhcp
DESTDIR="$MAIN_SRC_DIR/work/src/minimal_overlay/rootfs"
mkdir -p "$DESTDIR"
install -d -m755 "$DESTDIR/etc"
install -m644 "$SRC_DIR/resolv.conf" "$DESTDIR/etc/resolv.conf"
install -d -m755 "$DESTDIR/etc/autorun"
install -m755 "$SRC_DIR/01_network.sh" "$DESTDIR/etc/autorun/01_network.sh"
install -m755 "$SRC_DIR/05_rc.dhcp" "$DESTDIR/etc/05_rc.dhcp"
# These libraries are necessary for the DNS resolving.
install -d -m755 "$DESTDIR/lib"
install -m755 "$SYSROOT/lib/libresolv.so.2" "$DESTDIR/lib/libresolv.so.2"
install -m755 "$SYSROOT/lib/libnss_dns.so.2" "$DESTDIR/lib/libnss_dns.so.2"
strip -g "$DESTDIR/lib/*" 2>/dev/null
echo "dhcp scripts and libraries have been installed"

View File

@ -14,9 +14,7 @@
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# | +-- /etc/autorun/* (all scripts)
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |

View File

@ -14,9 +14,7 @@
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# | +-- /etc/autorun/* (all scripts)
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |

View File

@ -14,9 +14,7 @@
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# | +-- /etc/autorun/* (all scripts)
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |

View File

@ -1,41 +0,0 @@
#!/bin/sh
# System initialization sequence:
#
# /init
# |
# +--(1) /etc/01_prepare.sh
# |
# +--(2) /etc/02_overlay.sh
# |
# +-- /etc/03_init.sh
# |
# +-- /sbin/init
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp (this file)
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
# +--(2) /bin/sh (Alt + F2)
# |
# +--(2) /bin/sh (Alt + F3)
# |
# +--(2) /bin/sh (Alt + F4)
ip addr add $ip/$mask dev $interface
if [ "$router" ]; then
ip route add default via $router dev $interface
fi
if [ "$ip" ]; then
echo -e "DHCP configuration for device $interface"
echo -e "IP: \\e[1m$ip\\e[0m"
echo -e "mask: \\e[1m$mask\\e[0m"
echo -e "router: \\e[1m$router\\e[0m"
fi

View File

@ -14,9 +14,7 @@
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# | +-- /etc/autorun/* (all scripts)
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
@ -43,7 +41,7 @@ if [ ! "$key" = "" ] ; then
# Set flag which indicates that we have obtained controlling terminal.
export PID1_SHELL=true
# Interactive shell with controlling tty as PID 1.
exec setsid cttyhack sh
fi