From patchwork Mon Apr 13 01:11:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 25888 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id EA103DEC43 for ; Mon, 13 Apr 2009 11:18:38 +1000 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 082C7DE1DD; Mon, 13 Apr 2009 11:16:08 +1000 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX1/zJ39J9koxmwPGv4v2PidhceXYkDfWSlU@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n3D1G1k5008946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 13 Apr 2009 01:16:01 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n3D1G10Y008945; Mon, 13 Apr 2009 01:16:01 GMT Message-Id: <20090413011138.032695983@am.sony.com> References: <20090413011136.475152916@am.sony.com> In-Reply-To: <20090413011136.475152916@am.sony.com> User-Agent: quilt/0.46-1 Date: Sun, 12 Apr 2009 18:11:56 -0700 From: Geoff Levand To: Jeremy Kerr Content-Disposition: inline; filename=udhcpc.diff X-Virus-Scanned: ClamAV 0.93.3/9226/Sun Apr 12 20:02:45 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Mon, 13 Apr 2009 01:16:03 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 20/24] petitboot: Add udhcpc utility script X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Add a udhcpc utility script. udhcpc can be configured to run a specified script when there is a change in the dhcp configuration. This udhcpc utility script will write a petitboot netboot message to the petitboot user event socket. Signed-off-by: Geoff Levand --- rules.mk | 4 +++- utils/udhcpc | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) --- a/rules.mk +++ b/rules.mk @@ -30,6 +30,7 @@ endif # other to install artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz rules = utils/99-petitboot.rules +udhcpc = utils/udhcpc # client/daemon lib objs list_objs = lib/list/list.o @@ -115,7 +116,7 @@ $(parser_test): $(parser_test_objs) parser-test: $(parser_test) -install: all $(rules) +install: all $(rules) $(udhcpc) $(INSTALL) -d $(DESTDIR)$(sbindir)/ $(INSTALL) $(daemons) $(uis) $(utils) $(DESTDIR)$(sbindir)/ $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/artwork/ @@ -123,6 +124,7 @@ install: all $(rules) $(DESTDIR)$(pkgdatadir)/artwork/ $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/utils $(INSTALL) -m 644 $(top_srcdir)/$(rules) $(DESTDIR)$(pkgdatadir)/utils + $(INSTALL) -m 644 $(top_srcdir)/$(udhcpc) $(DESTDIR)$(pkgdatadir)/utils dist: $(PACKAGE)-$(VERSION).tar.gz --- /dev/null +++ b/utils/udhcpc @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Petitboot udhcpc user script. Should be run by udhcpc when +# there is a change in the dhcp configuration. For more info +# see the udhcpc man page and the Linux kernel source file +# Documentation/filesystems/nfsroot.txt. +# + +PBOOT_USER_EVENT_SOCKET="/tmp/petitboot.ev" +log="pb-udhcpc.log" + +pb_add () { + k_server_ip=${rootpath%%:*} + k_root_dir=${rootpath#*:} + + [ ${k_server_ip} != ${rootpath} ] || k_server_ip=${serverid} + + echo -ne "add@/net/${interface}\0name=netboot\0image=tftp://${siaddr}${boot_file}\0args=root=/dev/nfs ip=any nfsroot=${k_server_ip}:${k_root_dir}\0" | pb-event +} + +pb_remove () { + echo -ne "remove@/net/${interface}\0name=netboot\0" | pb-event +} + +case "$1" in +bound | renew) + pb_add + ;; +deconfig) + pb_remove + ;; +*) + ;; +esac + +echo "--- $1 ---" >> ${log} +set >> ${log} +echo "---------------" >> ${log}