aboutsummaryrefslogtreecommitdiffstats
path: root/meta-extras
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-09-30 21:35:20 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-30 22:16:10 +0100
commitc09cae578e5568c0ac975124db31f9cac05d50e9 (patch)
tree1183a51498c1d2c7874ea0d3741c4f70dbfc66ef /meta-extras
parenta51df11c1596746c85b015562ed67f37382b88b5 (diff)
downloadopenembedded-core-contrib-c09cae578e5568c0ac975124db31f9cac05d50e9.tar.gz
openembedded-core-contrib-c09cae578e5568c0ac975124db31f9cac05d50e9.tar.bz2
openembedded-core-contrib-c09cae578e5568c0ac975124db31f9cac05d50e9.zip
Move prism-firmware, spectrum-fw, python-urlgrabber, python-iniparse and yum-metadata to meta-extras
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta-extras')
-rw-r--r--meta-extras/packages/prism-firmware/prism-firmware.bb32
-rw-r--r--meta-extras/packages/prism-firmware/prism-firmware/hostap.rules4
-rw-r--r--meta-extras/packages/prism-firmware/prism-firmware/prism-fw.sh32
-rw-r--r--meta-extras/packages/python/python-iniparse-native_0.3.2.bb6
-rw-r--r--meta-extras/packages/python/python-iniparse_0.3.2.bb11
-rw-r--r--meta-extras/packages/python/python-urlgrabber-native_3.9.1.bb4
-rw-r--r--meta-extras/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch28
-rw-r--r--meta-extras/packages/python/python-urlgrabber/urlgrabber-HEAD.patch142
-rw-r--r--meta-extras/packages/python/python-urlgrabber/urlgrabber-reset.patch15
-rw-r--r--meta-extras/packages/python/python-urlgrabber_3.9.1.bb16
-rw-r--r--meta-extras/packages/python/yum-metadata-parser-native_1.1.4.bb7
-rw-r--r--meta-extras/packages/python/yum-metadata-parser_1.1.4.bb15
-rw-r--r--meta-extras/packages/spectrum-fw/spectrum-fw.bb22
-rwxr-xr-xmeta-extras/packages/spectrum-fw/spectrum-fw/get_symbol_fw29
-rwxr-xr-xmeta-extras/packages/spectrum-fw/spectrum-fw/parse_symbol_fw129
15 files changed, 492 insertions, 0 deletions
diff --git a/meta-extras/packages/prism-firmware/prism-firmware.bb b/meta-extras/packages/prism-firmware/prism-firmware.bb
new file mode 100644
index 0000000000..903c55e15e
--- /dev/null
+++ b/meta-extras/packages/prism-firmware/prism-firmware.bb
@@ -0,0 +1,32 @@
+DESCRIPTION = "Firmware for the Prism 2.x/3 cards"
+SECTION = "base"
+LICENSE = "closed"
+RDEPENDS = "hostap-utils"
+RREPLACES = "prism3-firmware prism3-support"
+RCONFLICTS = "prism3-firmware prism3-support"
+PACKAGE_ARCH = "all"
+PR = "r3"
+
+SRC_URI = "http://www.red-bean.com/~proski/firmware/primary.tar.bz2 \
+ http://www.red-bean.com/~proski/firmware/1.7.4.tar.bz2 \
+ file://prism-fw.sh \
+ file://hostap.rules"
+
+do_install() {
+ install -d ${D}${base_libdir}/firmware/
+ install -d ${D}${base_libdir}/udev/
+ install -d ${D}${sysconfdir}/pcmcia/
+ install -d ${D}${sysconfdir}/udev/rules.d/
+
+ install -m 0644 ${WORKDIR}/primary/af010104.hex ${D}${base_libdir}/firmware/
+ install -m 0644 ${WORKDIR}/primary/ak010104.hex ${D}${base_libdir}/firmware/
+ install -m 0644 ${WORKDIR}/primary/pm010102.hex ${D}${base_libdir}/firmware/
+
+ install -m 0644 ${WORKDIR}/1.7.4/rf010704.hex ${D}${base_libdir}/firmware/
+
+ install -m 0755 ${WORKDIR}/prism-fw.sh ${D}${base_libdir}/udev/
+ install -m 0644 ${WORKDIR}/hostap.rules ${D}${sysconfdir}/udev/rules.d/
+}
+
+PACKAGES = "${PN}"
+FILES_${PN} += "${base_libdir}"
diff --git a/meta-extras/packages/prism-firmware/prism-firmware/hostap.rules b/meta-extras/packages/prism-firmware/prism-firmware/hostap.rules
new file mode 100644
index 0000000000..dece98ae93
--- /dev/null
+++ b/meta-extras/packages/prism-firmware/prism-firmware/hostap.rules
@@ -0,0 +1,4 @@
+#
+# update firmware on Prism cards (load it to RAM, not to Flash)
+#
+SUBSYSTEM=="net", KERNEL=="wlan*" RUN="/lib/udev/prism-fw.sh"
diff --git a/meta-extras/packages/prism-firmware/prism-firmware/prism-fw.sh b/meta-extras/packages/prism-firmware/prism-firmware/prism-fw.sh
new file mode 100644
index 0000000000..619f612be1
--- /dev/null
+++ b/meta-extras/packages/prism-firmware/prism-firmware/prism-fw.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+CARD_ID=`/usr/sbin/hostap_diag $INTERFACE|grep NICID|awk '{print $2}'|sed -e 's/id=0x//'`
+
+# 801d cards lack even Primary firmware so we cannot use hostap_diag
+PRI=/lib/firmware/pm010102.hex
+STA=/lib/firmware/rf010704.hex
+
+if [ $CARD_ID = '800c' ] || [ $CARD_ID = '8013' ] || [ $CARD_ID = '8017' ] || \
+ [ $CARD_ID = '801b' ] || [ $CARD_ID = '8022' ] || [ $CARD_ID = '8023' ] ; then
+ PRI=/lib/firmware/ak010104.hex
+elif [ $CARD_ID = '800b' ] || [ $CARD_ID = '8012' ] || [ $CARD_ID = '8016' ] || \
+ [ $CARD_ID = '801a' ] ; then
+ PRI=/lib/firmware/af010104.hex
+elif [ $CARD_ID = '800e' ] || [ $CARD_ID = '8015' ] || [ $CARD_ID = '8019' ] || \
+ [ $CARD_ID = '801d' ] ; then
+ PRI=/lib/firmware/pm010102.hex
+fi
+
+DIR=/proc/net/hostap/wlan0
+
+if [ ! -d $DIR ]; then
+ exit 1
+fi
+
+if grep -q no_pri=1 $DIR/debug; then
+ /usr/sbin/prism2_srec -gs wlan0 $PRI
+ /usr/sbin/prism2_srec -gp wlan0 $PRI
+fi
+
+/usr/sbin/prism2_srec -rp wlan0 $STA
+
diff --git a/meta-extras/packages/python/python-iniparse-native_0.3.2.bb b/meta-extras/packages/python/python-iniparse-native_0.3.2.bb
new file mode 100644
index 0000000000..41aa13d97a
--- /dev/null
+++ b/meta-extras/packages/python/python-iniparse-native_0.3.2.bb
@@ -0,0 +1,6 @@
+require python-iniparse_${PV}.bb
+inherit native
+DEPENDS = "python-native"
+RDEPENDS = ""
+PR = "r0"
+
diff --git a/meta-extras/packages/python/python-iniparse_0.3.2.bb b/meta-extras/packages/python/python-iniparse_0.3.2.bb
new file mode 100644
index 0000000000..27a38f4249
--- /dev/null
+++ b/meta-extras/packages/python/python-iniparse_0.3.2.bb
@@ -0,0 +1,11 @@
+DESCRIPTION = "iniparse is a INI parser for Python"
+HOMEPAGE = "http://code.google.com/p/iniparse/"
+SECTION = "devel/python"
+PRIORITY = "optional"
+LICENSE = "GPL"
+PR = "r0"
+
+SRC_URI = "http://iniparse.googlecode.com/files/iniparse-${PV}.tar.gz"
+S = "${WORKDIR}/iniparse-${PV}"
+
+inherit distutils
diff --git a/meta-extras/packages/python/python-urlgrabber-native_3.9.1.bb b/meta-extras/packages/python/python-urlgrabber-native_3.9.1.bb
new file mode 100644
index 0000000000..ff8f02ecd7
--- /dev/null
+++ b/meta-extras/packages/python/python-urlgrabber-native_3.9.1.bb
@@ -0,0 +1,4 @@
+require python-urlgrabber_${PV}.bb
+inherit native
+DEPENDS = "python-native python-pycurl-native"
+RDEPENDS = ""
diff --git a/meta-extras/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch b/meta-extras/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch
new file mode 100644
index 0000000000..7a1ee059d1
--- /dev/null
+++ b/meta-extras/packages/python/python-urlgrabber/urlgrabber-3.0.0-cleanup.patch
@@ -0,0 +1,28 @@
+diff -up urlgrabber-3.0.0/urlgrabber/grabber.py.cleanup urlgrabber-3.0.0/urlgrabber/grabber.py
+--- urlgrabber-3.0.0/urlgrabber/grabber.py.cleanup 2007-11-29 10:25:13.000000000 +0000
++++ urlgrabber-3.0.0/urlgrabber/grabber.py 2007-11-29 10:26:15.000000000 +0000
+@@ -1204,16 +1204,18 @@ class URLGrabberFileObject:
+ bs = 1024*8
+ size = 0
+
+- if amount is not None: bs = min(bs, amount - size)
+- block = self.read(bs)
+- size = size + len(block)
+- while block:
+- new_fo.write(block)
++ try:
+ if amount is not None: bs = min(bs, amount - size)
+ block = self.read(bs)
+ size = size + len(block)
++ while block:
++ new_fo.write(block)
++ if amount is not None: bs = min(bs, amount - size)
++ block = self.read(bs)
++ size = size + len(block)
++ finally:
++ new_fo.close()
+
+- new_fo.close()
+ try:
+ modified_tuple = self.hdr.getdate_tz('last-modified')
+ modified_stamp = rfc822.mktime_tz(modified_tuple)
diff --git a/meta-extras/packages/python/python-urlgrabber/urlgrabber-HEAD.patch b/meta-extras/packages/python/python-urlgrabber/urlgrabber-HEAD.patch
new file mode 100644
index 0000000000..90180d29a0
--- /dev/null
+++ b/meta-extras/packages/python/python-urlgrabber/urlgrabber-HEAD.patch
@@ -0,0 +1,142 @@
+diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
+index e090e90..a26880c 100644
+--- a/urlgrabber/grabber.py
++++ b/urlgrabber/grabber.py
+@@ -439,6 +439,12 @@ try:
+ except:
+ __version__ = '???'
+
++try:
++ # this part isn't going to do much - need to talk to gettext
++ from i18n import _
++except ImportError, msg:
++ def _(st): return st
++
+ ########################################################################
+ # functions for debugging output. These functions are here because they
+ # are also part of the module initialization.
+@@ -1052,7 +1058,8 @@ class PyCurlFileObject():
+ self._reget_length = 0
+ self._prog_running = False
+ self._error = (None, None)
+- self.size = None
++ self.size = 0
++ self._hdr_ended = False
+ self._do_open()
+
+
+@@ -1085,9 +1092,14 @@ class PyCurlFileObject():
+ return -1
+
+ def _hdr_retrieve(self, buf):
++ if self._hdr_ended:
++ self._hdr_dump = ''
++ self.size = 0
++ self._hdr_ended = False
++
+ if self._over_max_size(cur=len(self._hdr_dump),
+ max_size=self.opts.max_header_size):
+- return -1
++ return -1
+ try:
+ self._hdr_dump += buf
+ # we have to get the size before we do the progress obj start
+@@ -1104,7 +1116,17 @@ class PyCurlFileObject():
+ s = parse150(buf)
+ if s:
+ self.size = int(s)
+-
++
++ if buf.lower().find('location') != -1:
++ location = ':'.join(buf.split(':')[1:])
++ location = location.strip()
++ self.scheme = urlparse.urlsplit(location)[0]
++ self.url = location
++
++ if len(self._hdr_dump) != 0 and buf == '\r\n':
++ self._hdr_ended = True
++ if DEBUG: DEBUG.info('header ended:')
++
+ return len(buf)
+ except KeyboardInterrupt:
+ return pycurl.READFUNC_ABORT
+@@ -1136,6 +1158,7 @@ class PyCurlFileObject():
+ self.curl_obj.setopt(pycurl.PROGRESSFUNCTION, self._progress_update)
+ self.curl_obj.setopt(pycurl.FAILONERROR, True)
+ self.curl_obj.setopt(pycurl.OPT_FILETIME, True)
++ self.curl_obj.setopt(pycurl.FOLLOWLOCATION, True)
+
+ if DEBUG:
+ self.curl_obj.setopt(pycurl.VERBOSE, True)
+@@ -1291,7 +1314,12 @@ class PyCurlFileObject():
+ raise err
+
+ elif str(e.args[1]) == '' and self.http_code != 0: # fake it until you make it
+- msg = 'HTTP Error %s : %s ' % (self.http_code, self.url)
++ if self.scheme in ['http', 'https']:
++ msg = 'HTTP Error %s : %s ' % (self.http_code, self.url)
++ elif self.scheme in ['ftp']:
++ msg = 'FTP Error %s : %s ' % (self.http_code, self.url)
++ else:
++ msg = "Unknown Error: URL=%s , scheme=%s" % (self.url, self.scheme)
+ else:
+ msg = 'PYCURL ERROR %s - "%s"' % (errcode, str(e.args[1]))
+ code = errcode
+@@ -1299,6 +1327,12 @@ class PyCurlFileObject():
+ err.code = code
+ err.exception = e
+ raise err
++ else:
++ if self._error[1]:
++ msg = self._error[1]
++ err = URLGRabError(14, msg)
++ err.url = self.url
++ raise err
+
+ def _do_open(self):
+ self.curl_obj = _curl_cache
+@@ -1532,11 +1566,14 @@ class PyCurlFileObject():
+ def _over_max_size(self, cur, max_size=None):
+
+ if not max_size:
+- max_size = self.size
+- if self.opts.size: # if we set an opts size use that, no matter what
+- max_size = self.opts.size
++ if not self.opts.size:
++ max_size = self.size
++ else:
++ max_size = self.opts.size
++
+ if not max_size: return False # if we have None for all of the Max then this is dumb
+- if cur > max_size + max_size*.10:
++
++ if cur > int(float(max_size) * 1.10):
+
+ msg = _("Downloaded more than max size for %s: %s > %s") \
+ % (self.url, cur, max_size)
+@@ -1582,7 +1619,11 @@ class PyCurlFileObject():
+ self.opts.progress_obj.end(self._amount_read)
+ self.fo.close()
+
+-
++ def geturl(self):
++ """ Provide the geturl() method, used to be got from
++ urllib.addinfourl, via. urllib.URLopener.* """
++ return self.url
++
+ _curl_cache = pycurl.Curl() # make one and reuse it over and over and over
+
+
+diff --git a/urlgrabber/progress.py b/urlgrabber/progress.py
+index dd07c6a..45eb248 100644
+--- a/urlgrabber/progress.py
++++ b/urlgrabber/progress.py
+@@ -658,6 +658,8 @@ def format_time(seconds, use_hours=0):
+ if seconds is None or seconds < 0:
+ if use_hours: return '--:--:--'
+ else: return '--:--'
++ elif seconds == float('inf'):
++ return 'Infinite'
+ else:
+ seconds = int(seconds)
+ minutes = seconds / 60
diff --git a/meta-extras/packages/python/python-urlgrabber/urlgrabber-reset.patch b/meta-extras/packages/python/python-urlgrabber/urlgrabber-reset.patch
new file mode 100644
index 0000000000..b63e7c33ac
--- /dev/null
+++ b/meta-extras/packages/python/python-urlgrabber/urlgrabber-reset.patch
@@ -0,0 +1,15 @@
+--- a/urlgrabber/grabber.py 2010-02-19 14:50:45.000000000 -0500
++++ b/urlgrabber/grabber.py 2010-02-19 14:51:28.000000000 -0500
+@@ -1626,6 +1626,12 @@
+
+ _curl_cache = pycurl.Curl() # make one and reuse it over and over and over
+
++def reset_curl_obj():
++ """To make sure curl has reread the network/dns info we force a reload"""
++ global _curl_cache
++ _curl_cache.close()
++ _curl_cache = pycurl.Curl()
++
+
+ #####################################################################
+ # DEPRECATED FUNCTIONS
diff --git a/meta-extras/packages/python/python-urlgrabber_3.9.1.bb b/meta-extras/packages/python/python-urlgrabber_3.9.1.bb
new file mode 100644
index 0000000000..9f3a4cc6a7
--- /dev/null
+++ b/meta-extras/packages/python/python-urlgrabber_3.9.1.bb
@@ -0,0 +1,16 @@
+DESCRIPTION = "urlgrabber is a pure python package that drastically simplifies the fetching of files."
+
+HOMEPAGE = "http://urlgrabber.baseurl.org/"
+SECTION = "devel/python"
+PRIORITY = "optional"
+LICENSE = "GPL"
+PR = "r1"
+
+SRC_URI = "http://urlgrabber.baseurl.org/download/urlgrabber-${PV}.tar.gz \
+ file://urlgrabber-HEAD.patch;patch=1 \
+ file://urlgrabber-reset.patch;patch=1"
+S = "${WORKDIR}/urlgrabber-${PV}"
+
+DEPENDS = "python-pycurl"
+
+inherit distutils \ No newline at end of file
diff --git a/meta-extras/packages/python/yum-metadata-parser-native_1.1.4.bb b/meta-extras/packages/python/yum-metadata-parser-native_1.1.4.bb
new file mode 100644
index 0000000000..0a44b99e2c
--- /dev/null
+++ b/meta-extras/packages/python/yum-metadata-parser-native_1.1.4.bb
@@ -0,0 +1,7 @@
+require yum-metadata-parser_${PV}.bb
+inherit native
+DEPENDS = "python-native sqlite3-native glib-2.0-native libxml2-native"
+RDEPENDS = ""
+PR = "r0"
+
+#BUILD_CFLAGS += "-I${STAGING_LIBDIR}/glib-2.0"
diff --git a/meta-extras/packages/python/yum-metadata-parser_1.1.4.bb b/meta-extras/packages/python/yum-metadata-parser_1.1.4.bb
new file mode 100644
index 0000000000..2e404a2bb1
--- /dev/null
+++ b/meta-extras/packages/python/yum-metadata-parser_1.1.4.bb
@@ -0,0 +1,15 @@
+DESCRIPTION = "C-based metadata parser to quickly parse xml metadata into sqlite databases."
+HOMEPAGE = "http://linux.duke.edu/projects/yum/download.ptml"
+SECTION = "devel/python"
+PRIORITY = "optional"
+DEPENDS = "python sqlite3 glib-2.0 libxml2"
+LICENSE = "GPL"
+
+PR = "r1"
+
+SRC_URI = "http://linux.duke.edu/projects/yum/download/yum-metadata-parser/yum-metadata-parser-${PV}.tar.gz"
+S = "${WORKDIR}/yum-metadata-parser-${PV}"
+
+TARGET_CFLAGS += "-I${STAGING_LIBDIR}/glib-2.0"
+
+inherit distutils
diff --git a/meta-extras/packages/spectrum-fw/spectrum-fw.bb b/meta-extras/packages/spectrum-fw/spectrum-fw.bb
new file mode 100644
index 0000000000..45011d336c
--- /dev/null
+++ b/meta-extras/packages/spectrum-fw/spectrum-fw.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "Firmware for Spectrum Wireless LAN cards"
+DEPENDS += " unzip-native "
+LICENSE = "closed"
+PR = "r2"
+
+SRC_URI = "http://ftp.osuosl.org/pub/nslu2/sources/MC&DriverOnlyInstallers.zip \
+ file://get_symbol_fw \
+ file://parse_symbol_fw"
+S = "${WORKDIR}"
+
+do_configure() {
+ ./get_symbol_fw
+}
+
+do_install() {
+ install -d ${D}${base_libdir}/firmware/
+ install -m 0755 ${WORKDIR}/symbol_sp24t_prim_fw ${D}${base_libdir}/firmware/symbol_sp24t_prim_fw
+ install -m 0755 ${WORKDIR}/symbol_sp24t_sec_fw ${D}${base_libdir}/firmware/symbol_sp24t_sec_fw
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += "${base_libdir}/firmware/symbol*"
diff --git a/meta-extras/packages/spectrum-fw/spectrum-fw/get_symbol_fw b/meta-extras/packages/spectrum-fw/spectrum-fw/get_symbol_fw
new file mode 100755
index 0000000000..80420b01a8
--- /dev/null
+++ b/meta-extras/packages/spectrum-fw/spectrum-fw/get_symbol_fw
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Get firmware for Symbol Spectrum24 Trilogy.
+# Both the header file and the binary firmware files are produced.
+
+# Copyright (C) 2004 Pavel Roskin <proski@gnu.org>
+
+# This script is Free Software, and it can be copied, distributed and
+# modified as defined in the GNU General Public License. A copy of
+# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
+
+# Usage: get_symbol_fw
+# Output: spectrum_fw.h symbol_sp24t_prim_fw symbol_sp24t_sec_fw
+# Needed tools: curl (or wget), unzip, perl.
+
+set -e
+
+DL_INT1='S24DRVR392B67-01.exe'
+DL_INT2='Driver Only Installer/NetWLan5.sys'
+DRIVER1=symbol1.drv
+DRIVER2=symbol2.drv
+
+unzip -p $DL_INT1 "$DL_INT2" >$DRIVER2
+
+perl parse_symbol_fw $DRIVER2 spectrum_fw.h symbol_sp24t_prim_fw \
+ symbol_sp24t_sec_fw
+
+rm -f $DRIVER1 $DRIVER2
+
diff --git a/meta-extras/packages/spectrum-fw/spectrum-fw/parse_symbol_fw b/meta-extras/packages/spectrum-fw/spectrum-fw/parse_symbol_fw
new file mode 100755
index 0000000000..7fe0ea57c4
--- /dev/null
+++ b/meta-extras/packages/spectrum-fw/spectrum-fw/parse_symbol_fw
@@ -0,0 +1,129 @@
+#!/usr/bin/perl -w
+
+# Extract Symbol firmware and convert is to a header file and two binary
+# files.
+
+# Copyright (C) 2004 Pavel Roskin <proski@gnu.org>
+
+# This script is Free Software, and it can be copied, distributed and
+# modified as defined in the GNU General Public License. A copy of
+# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
+
+# Usage:
+# parse_symbol_fw infile header binfile1 binfile2
+
+use strict;
+
+# Print message and exit (like "die", but without raising an exception).
+# Newline is added at the end.
+sub error
+{
+ printf STDERR "ERROR: ";
+ printf STDERR @_;
+ printf STDERR "\n";
+ exit 1;
+}
+
+sub readnum_ba ()
+{
+ my $byte_a;
+ read INFILE,$byte_a,1;
+ my $byte_b;
+ read INFILE,$byte_b,1;
+ return (ord($byte_b) << 8) + ord($byte_a);
+}
+
+
+if ($#ARGV != 3) {
+ error ("Usage: parse_symbol_fw infile header binfile1 binfile2");
+}
+
+unless (open (INFILE, "< $ARGV[0]")) {
+ error ("couldn't open $ARGV[0] for reading: $!");
+}
+
+unless (open (OUTFILE, "> $ARGV[1]")) {
+ error ("couldn't open $ARGV[1] for writing: $!");
+}
+
+# Process one array, either for primary or for secondary firmware
+sub process_one_array($$) {
+ my $arrname = shift(@_);
+ my $binfile = shift(@_);
+ my $offset = -1;
+ my $str_offset = 0;
+
+ # Skip to the beginning of firmware
+ $/ = "\x00";
+ while (<INFILE>) {
+ if (m{FILE: }g) {
+ $offset = $str_offset + pos() - 6;
+ last;
+ }
+ $str_offset = tell(INFILE);
+ }
+
+ if ($offset == -1) {
+ error("Cannot find FILE: marker");
+ }
+
+ my @fwdata = split;
+ print $fwdata[1] . "\n";
+ seek(INFILE, $offset, 0);
+
+ my $blknum = $fwdata[3];
+ my $pdrlen = $fwdata[4];
+ my $crclen = $fwdata[5];
+ my $compatlen = $fwdata[6];
+
+ while (!eof(INFILE)) {
+ my $byte;
+ read INFILE, $byte, 1;
+ last if (ord($byte) == 0x1a);
+ }
+
+ # Walk all blocks
+ my $block = $blknum;
+ while ($block-- > 0) {
+ seek(INFILE, 4, 1);
+ my $len = readnum_ba();
+ seek(INFILE, $len, 1);
+ }
+
+ my $img_len = tell(INFILE) - $offset + $pdrlen + $crclen + $compatlen + 2;
+ seek(INFILE, $offset, 0);
+
+ # Write binary file for the section
+ unless (open (BINFILE, "> $binfile")) {
+ error ("couldn't open $binfile for writing: $!");
+ }
+
+ # Output the array
+ printf OUTFILE "/* %s %s */\n", $fwdata[1], $fwdata[2];
+ printf OUTFILE "static u8 %s[] = {\n", $arrname;
+
+ my $count = 0;
+ while ($count++ < $img_len) {
+ my $byte;
+ read INFILE, $byte, 1;
+ $byte = ord($byte);
+ printf OUTFILE "0x%02x,", $byte;
+ printf BINFILE "%c", $byte;
+ if ($count % 16 == 0) {
+ printf OUTFILE "\n";
+ }
+ }
+
+ if ($img_len % 16) {
+ printf OUTFILE "\n";
+ }
+
+ print OUTFILE "};\n";
+ close(BINFILE);
+}
+
+process_one_array("primsym", $ARGV[2]);
+process_one_array("secsym", $ARGV[3]);
+
+close(INFILE);
+close(OUTFILE);