Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Oct 2009 12:15:15 +1300 (NZDT)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/139977: new port: sysutils/fconfig
Message-ID:  <20091025231515.8114411475@citylink.fud.org.nz>
Resent-Message-ID: <200910252340.n9PNe0Zu015419@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         139977
>Category:       ports
>Synopsis:       new port: sysutils/fconfig
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 25 23:40:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Thompson
>Release:        FreeBSD 9.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD burger.fud.org.nz 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r198348M: Fri Oct 23 08:58:52 NZDT 2009 thompsa@burger.fud.org.nz:/usr/obj/home/thompsa/scratch/fbsvn/head/sys/BURGER i386


	
>Description:
	Add fconfig for managing RedBoot embedded boot config.
>How-To-Repeat:
	
>Fix:
	Also available at http://people.freebsd.org/~thompsa/fconfig.tar


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	sysutils
#	sysutils/fconfig
#	sysutils/fconfig/Makefile
#	sysutils/fconfig/distinfo
#	sysutils/fconfig/pkg-descr
#	sysutils/fconfig/files
#	sysutils/fconfig/files/patch-fconfig.diff
#
echo c - sysutils
mkdir -p sysutils > /dev/null 2>&1
echo c - sysutils/fconfig
mkdir -p sysutils/fconfig > /dev/null 2>&1
echo x - sysutils/fconfig/Makefile
sed 's/^X//' >sysutils/fconfig/Makefile << 'df88c006be046ec06ddb3d9e9ee7072a'
X# New ports collection makefile for:	fconfig
X# Date created:			Oct 26, 2009
X# Whom:				thompsa@FreeBSD.org
X#
X# $FreeBSD$
X#
X
XPORTNAME=	fconfig
XPORTVERSION=	20080329
XCATEGORIES=	sysutils
XMASTER_SITES=	http://downloads.openwrt.org/sources/ \
X		http://andrzejekiert.ovh.org/software/fconfig/
X
XMAINTAINER=	thompsa@FreeBSD.org
XCOMMENT=	Read and modify RedBoot embedded boot configuration
X
XWRKSRC=		${WRKDIR}/${PORTNAME}
XUSE_GMAKE=	yes
XPLIST_FILES=	sbin/fconfig
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/fconfig ${PREFIX}/sbin
X
X.include <bsd.port.mk>
df88c006be046ec06ddb3d9e9ee7072a
echo x - sysutils/fconfig/distinfo
sed 's/^X//' >sysutils/fconfig/distinfo << 'd2298dd089beb180a9a57594cba39088'
XMD5 (fconfig-20080329.tar.gz) = dac355e9f2a0f48c414c52e2034b6346
XSHA256 (fconfig-20080329.tar.gz) = 4ff0e8f07e35e46b705c0dbe9d9544ede01ea092a69e3f7db03e55a3f2bb8eb7
XSIZE (fconfig-20080329.tar.gz) = 10179
d2298dd089beb180a9a57594cba39088
echo x - sysutils/fconfig/pkg-descr
sed 's/^X//' >sysutils/fconfig/pkg-descr << '2f1d2fb3743b8f870439911feb359754'
Xfconfig is an application that allows to read and write RedBoot's configuration
Xparameters. 
X
XExamples, 
X fconfig -l
X fconfig -w -n console_baud_rate -x 115200
X
XWWW: http://andrzejekiert.ovh.org/software.html.en
2f1d2fb3743b8f870439911feb359754
echo c - sysutils/fconfig/files
mkdir -p sysutils/fconfig/files > /dev/null 2>&1
echo x - sysutils/fconfig/files/patch-fconfig.diff
sed 's/^X//' >sysutils/fconfig/files/patch-fconfig.diff << '881cf4ebcb2e08596c43706cdd954c21'
Xdiff -urN crunchfc.c crunchfc.c
X--- crunchfc.c	2008-03-30 01:21:47.000000000 +1300
X+++ crunchfc.c	2009-10-26 09:13:04.000000000 +1300
X@@ -407,6 +407,7 @@
X 	MESSAGE(VERB_HIGH, "Writing %d bytes at offset %d\n", 
X 		TYPE_SIZE(key.type), offset);
X 
X+#if !defined(__FreeBSD__)
X 	/* do an actual write to the device or file */
X 	if (lseek(data->fd, data->offset+offset, SEEK_SET) == -1) {
X 		MESSAGE(VERB_LOW, "lseek() failed\n");
X@@ -416,6 +417,7 @@
X 		MESSAGE(VERB_LOW, "write() failed\n");
X 		return -1;
X 	}
X+#endif
X 	/* keep our buffer in sync with the device or file */
X 	memcpy(key.dataval, buf, TYPE_SIZE(key.type));
X 
X@@ -451,6 +453,7 @@
X 
X 	MESSAGE(VERB_HIGH, "Writing CRC at offset %d\n", len-4);
X 
X+#if !defined(__FreeBSD__)
X 	/* do an actual write to the device or file */
X 	if (lseek(data->fd, data->offset+len-4, SEEK_SET) == -1) {
X 		MESSAGE(VERB_LOW, "CRC: lseek() failed\n");
X@@ -460,6 +463,7 @@
X 		MESSAGE(VERB_LOW, "CRC: write() failed\n");
X 		return;
X 	}
X+#endif
X 	/* keep our buffer in sync with the device or file */
X 	memcpy(buf+len-4, &crc, sizeof(crc));
X 
Xdiff -urN fconfig.c fconfig.c
X--- fconfig.c	2008-03-30 01:21:48.000000000 +1300
X+++ fconfig.c	2009-10-26 10:11:01.000000000 +1300
X@@ -45,6 +45,8 @@
X #include "ftypes.h"
X #include "crunchfc.h"
X 
X+#define REDBOOT_DEV	"/dev/redboot/RedBoot config"
X+
X /*
X  * Parse type name, return type ID. 
X  * Type ID is the type number in the type table. 
X@@ -163,6 +165,16 @@
X 
X 	recalculate_crc(&data);
X 
X+#if defined(__FreeBSD__)
X+	/* FreeBSD needs to do a full sector write */
X+	if (lseek(data.fd, 0, SEEK_SET) == -1) {
X+		MESSAGE(VERB_LOW, "lseek() failed\n");
X+		return -1;
X+	}	
X+	if (write(data.fd, data.buf, MAX_CONFIG_DATA) == -1) {
X+		MESSAGE(VERB_LOW, "write() failed\n");
X+	}
X+#endif
X 	close_fconfig_handle(&data);
X 	return 0;
X 
X@@ -292,8 +304,12 @@
X 	}
X 
X 	if (device == NULL) {
X+#if defined(__FreeBSD__)
X+		device = REDBOOT_DEV;
X+#else
X 		MESSAGE(VERB_LOW, "You must provide a device name.\n");
X 		exit(1);
X+#endif
X 	}
X 
X 	switch (mode) {
Xdiff -urN ftypes.c ftypes.c
X--- ftypes.c	2006-03-15 03:18:18.000000000 +1300
X+++ ftypes.c	2009-10-26 10:07:04.000000000 +1300
X@@ -21,8 +21,13 @@
X #include <arpa/inet.h>
X 
X /* For ether_aton */
X+#if defined(__FreeBSD__)
X+#include <sys/types.h>
X+#include <net/ethernet.h>
X+#else
X #include <net/ethernet.h>
X #include <netinet/ether.h>
X+#endif
X 
X #include <stdlib.h>
X #include <stdio.h>
881cf4ebcb2e08596c43706cdd954c21
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091025231515.8114411475>