From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Schmoller Date: Tue, 28 Jul 2009 11:34:01 -0500 Subject: [U-Boot] [RFC 1/3] uboot-doc: Initial support of user documentation generator In-Reply-To: References: Message-ID: <6954317d75cb9e909b9e69e9808a4242483bb32a.1248798202.git.jschmoller@xes-inc.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Initial support of U-Boot User's Manual documentation generator. It makes use of the C pre-processor to gather context, and then the doc-stream.pl program parses out interesting comments for consideration by uboot-doc, which creates DocBook style XML from autogenerated files as well as the template files. Template files are pseudo-XML with precompiler directives. Also includes a stylesheet wrapper for manual customization. Signed-off-by: John Schmoller --- Makefile | 2 + config.mk | 1 + doc/manual/85xx_program_flow.tmpl | 74 ++++ doc/manual/book_info.tmpl | 35 ++ doc/manual/booting_linux.tmpl | 249 +++++++++++ doc/manual/config.mk | 74 ++++ doc/manual/doc-stream.pl | 34 ++ doc/manual/introduction.tmpl | 136 ++++++ doc/manual/manual.tmpl | 26 ++ doc/manual/scripting.tmpl | 154 +++++++ doc/manual/setup.tmpl | 294 +++++++++++++ doc/manual/uboot-doc | 866 +++++++++++++++++++++++++++++++++++++ doc/manual/uboot_manual.xsl | 286 ++++++++++++ rules.mk | 7 + 14 files changed, 2238 insertions(+), 0 deletions(-) create mode 100644 doc/manual/85xx_program_flow.tmpl create mode 100644 doc/manual/book_info.tmpl create mode 100644 doc/manual/booting_linux.tmpl create mode 100644 doc/manual/config.mk create mode 100644 doc/manual/doc-stream.pl create mode 100644 doc/manual/introduction.tmpl create mode 100644 doc/manual/manual.tmpl create mode 100644 doc/manual/scripting.tmpl create mode 100644 doc/manual/setup.tmpl create mode 100644 doc/manual/uboot-doc create mode 100644 doc/manual/uboot_manual.xsl diff --git a/Makefile b/Makefile index ef535ed..ff4f242 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,7 @@ ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk)) all: sinclude $(obj)include/autoconf.mk.dep sinclude $(obj)include/autoconf.mk +sinclude $(obj)doc/manual/config.mk # load ARCH, BOARD, and CPU configuration include $(obj)include/config.mk @@ -3646,6 +3647,7 @@ clean: @rm -f $(obj)include/bmp_logo.h @rm -f $(obj)nand_spl/{u-boot-spl,u-boot-spl.map,System.map} @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl-4k.bin,ipl.map} + @rm -f $(obj)doc/manual/{*.xml,*.html,*.fo,*.pdf,params.xsl} @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE) @find $(OBJTREE) -type f \ \( -name 'core' -o -name '*.bak' -o -name '*~' \ diff --git a/config.mk b/config.mk index fd56621..fb8bed0 100644 --- a/config.mk +++ b/config.mk @@ -96,6 +96,7 @@ BOARDDIR = $(VENDOR)/$(BOARD) else BOARDDIR = $(BOARD) endif +export BOARDDIR ifdef BOARD sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules endif diff --git a/doc/manual/85xx_program_flow.tmpl b/doc/manual/85xx_program_flow.tmpl new file mode 100644 index 0000000..1010780 --- /dev/null +++ b/doc/manual/85xx_program_flow.tmpl @@ -0,0 +1,74 @@ + + + + U-Boot Program Flow + U-Boot follows the following program flow. + + + Reset + + + Initialize Processor + + + Set up data cache as stack + + + Set up TLBs and LAWs + + + Initialize U-Boot environment + + + Initialize serial port + + + Initialize I2C + + + Initialize DRAM + + + Relocate from Flash to RAM + + + Set up data cache + + + Initialize Flash Structure + + + Initialize malloc area + + + Initialize NAND device + + + Initialize PCI + + + Initialize Vector Table + + + Initialize Ethernet + +#ifdef CONFIG_PREBOOT + + Exectue preboot + environment variable + + +#endif + + Wait bootdelay + seconds to stop autoboot + + + + If not canceled, execute + bootcmd or enter main loop. + + + + diff --git a/doc/manual/book_info.tmpl b/doc/manual/book_info.tmpl new file mode 100644 index 0000000..a4cec17 --- /dev/null +++ b/doc/manual/book_info.tmpl @@ -0,0 +1,35 @@ + + + + ${BOARD} U-Boot Manual + U-Boot User's Manual + U-Boot version: ${VERSION} + ${BOARD} + ${DATE} + + + U-Boot is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + + + U-Boot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the + Free Software Foundation, Inc., +
59 Temple Place, Suite 330 + Boston, MA 02111-1307 + USA +
+
+
+
+ diff --git a/doc/manual/booting_linux.tmpl b/doc/manual/booting_linux.tmpl new file mode 100644 index 0000000..e0ab37c --- /dev/null +++ b/doc/manual/booting_linux.tmpl @@ -0,0 +1,249 @@ + + + + Booting Linux + + + + Booting Linux with U-Boot + + Booting Linux + The following is intended to be a Quick Start guide for booting a + Linux kernel. More information can be found in your Linux Manual. + + + Your Linux kernel can be booted from either RAM or from Flash. + Images booted from RAM will need to be downloaded from the network + using tftp + on every reset. Images booted from Flash will be copied from Flash to + RAM automatically. + + + + Booting from RAM + To boot an image from RAM, you will need to have your Linux + kernel +#ifdef CONFIG_OF_LIBFDT + and Flat Device Tree image +#endif + on a TFTP server. See + + Networking for more information about + TFTP and TFTP servers. Next, you will need to set up your + + network environment variables to point to + your TFTP server. +#ifdef CONFIG_CMD_DHCP + You can use a DHCP server to accomplish this if + your network has one set up using the + dhcp command. +#endif + Download the Linux kernel using the + tftp + command. + +tftp 10000000 <Path to Linux Kernel> + +#ifdef CONFIG_OF_LIBFDT + Download the Flat Device Tree image using the + tftp + command. + +tftp c000000 <Path to Flat Device Tree image> + +#endif + Adjust the download address based on the size of your kernel image. + Consult your Linux manual for the recommended + bootargs. + Set the + bootargs using the + setenv + command. Finally, boot your kernel image. + +#ifdef CONFIG_OF_LIBFDT +bootm 10000000 - c000000 +#else +bootm 10000000 +#endif + + Since we didn't disguss downloading a file system, this option + assumes you are booting an NFS file system. + + + Your console input/output should look something like this. + +=> setenv serverip 10.52.0.33 +=> setenv gatewayip 10.52.0.1 +=> setenv netmask 255.255.0.0 +=> setenv ipaddr 10.52.4.240 +=> tftp 10000000 /home/jschmoller/uImage +Enet starting in 1000BT/FD +Speed: 1000, full duplex +Using eTSEC2 device +TFTP from server 10.52.0.33; our IP address is 10.52.4.240 +Filename '/home/jschmoller/uImage'. +Load address: 0x10000000 +Loading: ################################################################# + ################################################################# + ################################################################# + ################################################################# + ###### +done +Bytes transferred = 3901275 (3b875b hex) +#ifdef CONFIG_OF_LIBFDT +=> tftp c000000 /home/jschmoller/dtb +Enet starting in 1000BT/FD +Speed: 1000, full duplex +Using eTSEC2 device +TFTP from server 10.52.0.33; our IP address is 10.52.4.240 +Filename '/home/jschmoller/dtb'. +Load address: 0xc000000 +Loading: ## +done +Bytes transferred = 16384 (4000 hex) +#endif +=> setenv bootargs console=ttyS0,115200 root=/dev/nfs rw ip=on +#ifdef CONFIG_OF_LIBFDT +=> bootm 10000000 - c000000 +#else +=> bootm 10000000 +#endif +## Booting kernel from Legacy Image at 10000000 ... + Image Name: Linux-2.6.23.17-fsl_r1 + Created: 2008-08-06 16:46:04 UTC + Image Type: PowerPC Linux Kernel Image (gzip compressed) + Data Size: 3901211 Bytes = 3.7 MB + Load Address: 00000000 + Entry Point: 00000000 + Verifying Checksum ... OK + Uncompressing Kernel Image ... OK + + + + + + Booting from Flash + To boot an image from Flash, you will need to follow a similar + procedure to load the Kernel +#ifdef CONFIG_OF_LIBFDT + and FDT +#endif + for the first time. Make sure you have your Kernel +#ifdef CONFIG_OF_LIBFDT + and FDT +#endif + on your TFTP server. Set your + + network environment variables to point to + your TFTP server. Download the Linux kernel using the + tftp + command and then erase Flash and copy it using the + erase and + cp commands. + +tftp 10000000 <Path to Linux Kernel> +erase <Flash start + 1000000> +$filesize +cp.b 10000000 <Flash start + 1000000> $filesize + +#ifdef CONFIG_OF_LIBFDT + Download the Flat Device Tree image using the + tftp + command. + +tftp c000000 <Path to Flat Device Tree image> +erase <Flash start> +$filesize +cp.b c000000 <Flash start> $filesize + +#endif + Consult your Linux manual for the recommended + bootargs. + Set the + bootargs using the + setenv + command and then save them using + saveenv. Set up your + bootcmd + environment variable to automatically boot the Linux kernel. + +#ifdef CONFIG_OF_LIBFDT +setenv bootcmd bootm <Flash start + 1000000> - <Flash start> +#else +setenv bootcmd bootm <Flash start + 1000000> +#endif + + Finally, boot your kernel image by resetting the board. + Since we didn't disguss downloading a file system, this option + assumes you are booting an NFS file system. + + + Your console input/output should look something like this. + +=> setenv serverip 10.52.0.33 +=> setenv gatewayip 10.52.0.1 +=> setenv netmask 255.255.0.0 +=> setenv ipaddr 10.52.4.240 +=> tftp 10000000 /home/jschmoller/uImage +Enet starting in 1000BT/FD +Speed: 1000, full duplex +Using eTSEC2 device +TFTP from server 10.52.0.33; our IP address is 10.52.4.240 +Filename '/home/jschmoller/uImage'. +Load address: 0x10000000 +Loading: ################################################################# + ################################################################# + ################################################################# + ################################################################# + ###### +done +Bytes transferred = 3901275 (3b875b hex) +=> erase f9000000 +$filesize + +.............................. done +Erased 30 sectors +=> cp.b 10000000 f9000000 $filesize +Copy to Flash... done +#ifdef CONFIG_OF_LIBFDT +=> tftp c000000 /home/jschmoller/dtb +Enet starting in 1000BT/FD +Speed: 1000, full duplex +Using eTSEC2 device +TFTP from server 10.52.0.33; our IP address is 10.52.4.240 +Filename '/home/jschmoller/dtb'. +Load address: 0xc000000 +Loading: ## +done +Bytes transferred = 16384 (4000 hex) +=> erase f8000000 +$filesize + +. done +Erased 1 sectors +=> cp.b c000000 f8000000 $filesize +Copy to Flash... done +#endif +=> setenv bootargs console=ttyS0,115200 root=/dev/nfs rw ip=on +#ifdef CONFIG_OF_LIBFDT +=> setenv bootcmd bootm f9000000 - f8000000 +#else +=> setenv bootcmd bootm f9000000 +#endif +=> saveenv +=> reset +<Board resets> +Hit any key to stop autoboot: 0 +## Booting kernel from Legacy Image at f9000000 ... + Image Name: Linux-2.6.23.17-fsl_r1 + Created: 2008-08-06 16:46:04 UTC + Image Type: PowerPC Linux Kernel Image (gzip compressed) + Data Size: 3901211 Bytes = 3.7 MB + Load Address: 00000000 + Entry Point: 00000000 + Verifying Checksum ... OK + Uncompressing Kernel Image ... OK + + + + + + diff --git a/doc/manual/config.mk b/doc/manual/config.mk new file mode 100644 index 0000000..59bebb7 --- /dev/null +++ b/doc/manual/config.mk @@ -0,0 +1,74 @@ +# +# (C) Copyright 2009 Extreme Engineering Solutions +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +######################################################################### + +ifndef DOCBOOK_XSL_DIR +DOCBOOK_XSL_DIR = /usr/share/xml/docbook/stylesheet/nwalsh +endif +export DOCBOOK_XSL_DIR + +ifndef XSLT_PROCESSOR +XSLT_PROCESSOR = xsltproc +endif + +ifndef FO_PROCESSOR +FO_PROCESSOR = fop +endif + +.PHONY = $(obj)man_parse $(obj)xml + +$(obj)man_parse: $(obj)include/autoconf.mk $(TIMESTAMP_FILE) \ + $(VERSION_FILE) + @for f in $(dir $(LIBS)); do \ + echo $$f; \ + $(MAKE) -C $$f _man_parse; \ + done + +$(obj)xml: $(obj)man_parse + perl $(TOPDIR)/doc/manual/uboot-doc \ + $(TOPDIR)/doc/manual/autoconf-doc.txt + rm $(TOPDIR)/doc/manual/autoconf-doc.txt + +$(obj)text: $(obj)xml + $(XSLT_PROCESSOR) -o $(TOPDIR)/doc/manual/ --xinclude \ + --stringparam pages.template \ + $(DOCBOOK_XSL_DIR)/roundtrip/template.xml \ + $(DOCBOOK_XSL_DIR)/roundtrip/dbk2wordml.xsl \ + $(TOPDIR)/doc/manual/manual.xml + +$(obj)html: $(obj)xml + $(XSLT_PROCESSOR) -o $(TOPDIR)/doc/manual/ --xinclude \ + $(DOCBOOK_XSL_DIR)/html/chunk.xsl \ + $(TOPDIR)/doc/manual/manual.xml + +$(obj)xhtml: $(obj)xml + $(XSLT_PROCESSOR) -o $(TOPDIR)/doc/manual/ --xinclude \ + $(DOCBOOK_XSL_DIR)/xhtml/chunk.xsl \ + $(TOPDIR)/doc/manual/manual.xml + +$(obj)pdf: $(obj)xml + $(XSLT_PROCESSOR) -o $(TOPDIR)/doc/manual/$(BOARD).fo \ + --stringparam docbook_path ${DOCBOOK_XSL_DIR} --xinclude \ + $(TOPDIR)/doc/manual/uboot_manual.xsl \ + $(TOPDIR)/doc/manual/manual.xml + $(FO_PROCESSOR) -fo $(TOPDIR)/doc/manual/$(BOARD).fo -pdf \ + $(TOPDIR)/doc/manual/$(BOARD).pdf diff --git a/doc/manual/doc-stream.pl b/doc/manual/doc-stream.pl new file mode 100644 index 0000000..71b7d02 --- /dev/null +++ b/doc/manual/doc-stream.pl @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w + +use strict; + +my $comment = ""; +my $in_comment = 0; + +# This file takes the output of the C pre-processor and scans it for +# "interesting" comments (those that contain an @) and prints the comment. +# Those comments are then dumped into a file that can be processed by +# uboot-doc. Without this script, the output of the C pre-processor is +# unnecesarily large (~36MB). +while () { + if (/^\s*\/\*\*\s*$/) { + $comment .= $_; + $in_comment = 1; + } elsif (/\*\//) { + if ($in_comment) { + $comment .= $_; + + if ($comment =~ /.*[\s\*]+ at .*/) { + print $comment; + } + } + $in_comment = 0; + $comment = ""; + } elsif (/\s*\*\s*/) { + if ($in_comment) { + $comment .= $_; + } + } +} + + diff --git a/doc/manual/introduction.tmpl b/doc/manual/introduction.tmpl new file mode 100644 index 0000000..063a6b8 --- /dev/null +++ b/doc/manual/introduction.tmpl @@ -0,0 +1,136 @@ + + + + Das U-Boot + + + Introduction to U-Boot + The ${BOARD} utilizes the U-Boot bootloader. U-Boot + is an open-source bootloader which provides low-level hardware + initialization, power on self tests (POSTs), access to onboard peripherals + (Ethernet, flash, EEPROMs, sensors, etc.), and contains a powerful + set of commands that allow booting a variety of + operation systems and applications. Additional U-Boot information + can be found at http://www.denx.de/wiki/U-Boot/WebHome. + + + + Terminology and Conventions + Below is a glossary of terminology that is relevant to U-Boot + + Terminology + + + + + + Settings + Value + + + + + + Target + + The single-board computer being used, e.g.: ${BOARD} + +#ifdef CONFIG_CMD_DHCP + + + BOOTP + + Bootstrap Protocol. BOOTP can be used to configure the + target's network settings based on information provided + by a BOOTP server. + + + + DHCP + + Dynamic Host Configuration Protocol. DHCP can be used to + configure the target's network settings based on information + provided by a DHCP server. DHCP is very similar to BOOTP. It + is newer and provides some advanced features which BOOTP lacks. + Most DHCP servers also provide support for BOOTP. + +#endif +#ifdef CONFIG_CMD_SNTP + + + NTP + + Network Time Protocol. NTP is used to synchronize the + target's date and time with an NTP server + +#endif + + + OS + + Operating System. e.g.: Linux, VxWorks, QNX, INTEGRITY. + + + + uImage + + An image format which contains a payload (OS image, + application image, filesystem, script, etc) as well as metadata + describing the payload. The metadata includes such information + as a checksum, payload name, timestamp, load address, etc. + + +#ifdef CONFIG_OF_LIBFDT + + + Device Tree + + A device tree is a text file which contains information in + a tree structure based on the Open Firmware specification. The + most common use of a device tree is to specify board-specific + information such as baud rate, CPU speed, number of flashes, etc + which U-Boot can manipulate and pass to an operating system such + as Linux. + + + + DTB + + Device Tree Blob. A commonly used acronym for a flattened + device tree blob. DTB can be used interchangeably with FDT. + + + + + FDT + + Flattened device tree. A FDT blob is a device tree which + has been converted into a binary form (a "blob"). + + +#endif + + + Primary Flash + + The primary NOR flash device on the target. Also referred + to as Flash 1. + + + + + Secondary Flash + + The secondary NOR flash device on the target. Also referred + to as Flash 2. + + + + +
+
+
diff --git a/doc/manual/manual.tmpl b/doc/manual/manual.tmpl new file mode 100644 index 0000000..37eb85d --- /dev/null +++ b/doc/manual/manual.tmpl @@ -0,0 +1,26 @@ + + + + + + + + + + + + + +#ifdef CONFIG_POST + +#endif + + + + + + + diff --git a/doc/manual/scripting.tmpl b/doc/manual/scripting.tmpl new file mode 100644 index 0000000..21a7918 --- /dev/null +++ b/doc/manual/scripting.tmpl @@ -0,0 +1,154 @@ + + + + Scripting + + + Scripting in U-Boot + + Variable Expansion with $ + Variable substitution can be done with the $ character. For + instance, + printenv + bootargs could also be executed with + echo + $bootargs. + More powerfully, this variable substitution can be used in scripting. + See the example in the next section. + + + + + Conditionals + U-Boot has a scripting language which can be used to customize + command execution. It contains if..then..else..fi, for..do..done, + while..do..done and until..do..done control flow operations. + + + As an example, take the environment variable bootcmd_net. + +bootcmd_net=run set_bootargs; $download_cmd $osaddr $osfile; if test $? -eq 0; +then if test -n $fdtaddr; then $download_cmd $fdtaddr $fdtfile; +if test $? -eq 0; then bootm $osaddr - $fdtaddr; else; echo FDT DOWNLOAD FAILED; +fi; else; bootm $osaddr; fi; else; echo OS DOWNLOAD FAILED; fi; + + To walk through the script, we start with + run + set_bootargs, which executes the commands stored + in set_bootargs. Next, we execute the command stored + in download_cmd which we'll assume is set to + tftp and + download the file from the path stored in osfile to + the address stored in osaddr. The next step is + interesting. We start an if conditional, and use the + test command + to check to see if the return value ($?) of the + download_cmd is 0. If it + isn't, meaning the download failed, we find the matching + then and see that we echo + DOWNLOAD FAILED. If it is 0 + meaning the download completed successfully, we start a new + if conditional and test to see if + fdtaddr is defined. If it is, use + download_cmd to download the file + stored in fdtfile to the address stored in + fdtaddr. Again, we verify that the download + completed successfully. If everything has worked up until now, we + complete the script with + bootm + osaddr - fdtaddr and boot the image we just + downloaded. If fdtaddr had been undefined, we would + have executed + bootm + osaddr instead. + + + + + && and || + Another feature of the U-Boot scripting language are the + && and || functions. The + && is an if and only if command. For + instance, the command + echo + $do_stuff && + run + $do_stuff would run do_stuff + only if the + echo command returned successfully, meaning + that do_stuff is defined. If + do_stuff was not defined, the + run command + would not be executed. Similarly, the || command will + execute the second command only if the first command fails. For + instance, if bank1 stored the location of the OS in + flash bank 1 and bank2 stored the location of the + OS in flash bank 2, the following command would try to boot the image + in bank 1. If unsuccessful it would boot the image in bank 2. If that + failed, it would attempt to download the file over the network, and if + that succeeded, it would boot the image. + +bootm $bank1 || bootm $bank2 || tftp $osaddr $osfile && bootm + + + + + + Quotes and tick marks + Quotation marks and tick marks also have a special meaning in + U-Boot scripting. Let's say you wanted to create an environment + variable called do_stuff and this variable was going + to run + printenv + bootargs + then run + bootcmd. + Depending on how you format the command, it's execution will + change. You could save the command as + +setenv do_stuff "print bootargs; run $bootcmd" + + When you + printenv do_stuff you + should see something like + +do_stuff=print bootargs; run bootm f8000000 + + Notice how the variable specified with the $ was expanded. Now, if + you do the same thing, replacing the quotation marks with tick marks, + +setenv do_stuff 'printenv bootargs; run $bootcmd' + + you will see different behavior. + +do_stuff=printenv bootargs; run $bootcmd + + Notice how the variables specified with the $ were not expanded. In + most cases, this would be the desired behavior as these variables + would be expanded when they are executed. Then, any changes made to + bootcmd + between the time that do_stuff was set and it was + run would change the functionality of do_stuff. + For example, + +setenv printscript print +setenv do_stuff "$printscript" +setenv printscript echo do nothing +run do_stuff + + would result in printing all the environment variables, rather than + printing "do nothing", whereas + +setenv printscript print +setenv do_stuff '$printscript' +setenv printscript echo do nothing +run do_stuff + + would result in printing "do nothing". + + + + + diff --git a/doc/manual/setup.tmpl b/doc/manual/setup.tmpl new file mode 100644 index 0000000..2d43a72 --- /dev/null +++ b/doc/manual/setup.tmpl @@ -0,0 +1,294 @@ + + + + U-Boot Setup + + + Getting Started +#ifdef CONFIG_BAUDRATE + + Serial + + The U-Boot console can be accessed by a standard PC using terminal + software such as HyperTerminal or TeraTerm in Windows or minicom in + Linux. + + + + + Plug the serial adapter cable into the ${BOARD}'s serial + connector. + + + + Connect the other end of the serial adapter cable to the male + DB9 to one of your host PC's COM ports; a DB9 extension cable + may be required. A USB-to-Serial adapter may also be used if the + host PC being used does not have a male DB9 port available. + + + + Start up your host PC terminal emulator (eg: HyperTerminal, + TeraTerm, minicom) using the following parameters: + + + + Default serial port settings + + + + + + Settings + Value + + + + + + Baud Rate + + @CONFIG_BAUDRATE + + + + Data Bits + + 8 + + + + Parity + + None + + + + Stop Bits + + 1 + + + + Flow Control + + None + + + +
+
+
+ + After configuring the serial terminal, you should be able to + interact with the target. When the target is powered on, the user should + be presented with output similar to the following: + +U-Boot 1.3.4-xes_r3 (Jan 06 2009 - 11:42:40) + +CPU0: 8572E, Version: 1.0, (0x80e80010) +Core: E500, Version: 3.0, (0x80210030) +Clock Configuration: + CPU:1500 MHz, CCB:600 MHz, + DDR:300 MHz (600 MT/s data rate) (Synchronous), LBC:75 MHz +L1: D-cache 32 kB enabled + I-cache 32 kB enabled +Board: X-ES XPedite5370 3U VPX SBC + Rev SA, Serial# 26081001, Cfg 90030065-1 +I2C: ready +DTT1: 45 C +DTT2: 35 C +DRAM: 2 GB (bank interleaving, ECC enabled) +FLASH: Executed from FLASH1 +FLASH: 256 MB +L2: 1024 KB enabled + + PCIE1 connected as Root Complex (x4) + Scanning PCI bus 01 + 02 01 10b5 8518 0604 00 + 02 02 10b5 8518 0604 00 + 02 03 10b5 8518 0604 00 + 01 00 10b5 8518 0604 00 + PCIE1 on bus 00 - 05 + + PCIE2 connected as End Point (x4) + PCIE2 on bus 06 - 06 +In: serial +Out: serial +Err: serial +Net: eTSEC1, eTSEC2 +Hit any key to stop autoboot: 0 +=> + + + + If you don't see console output: + + + + Verify the serial cable is firmly connected to both the board + and your PC. + + + + Verify that your serial port has the settings listed above. + If it does, your board may have been changed to a different + baudrate. Try setting your terminal to 9600 baud and reset the + board. + + + + Verify that your jumper settings are logical. + + + Check to see if a reset LED is lit and stays lit. If it does, + your board is being held in reset. Make sure the board has adequate + power and that the shelf manager isn't powering it down. + + +#ifdef CONFIG_REDUNDANT_MONITORS + + U-Boot has many valid baudrate options. Rather than try all + options, try booting from the other bank of flash, and thusly, the + other set of environment variables. Power down the board and move + the boot device select jumper to select the other bank. + + +#endif + + Power on the board and wait for about a minute. If the board is + working but the serial port is not, you should autoboot into an OS + which may start a heartbeat LED. If you see an LED pulsing on and + off after some time, your board is booting but your serial + connection is bad. Try a different cable. + + + + Contact Tech Support + + +
+#endif CONFIG_BAUDRATE + +#ifdef CONFIG_MPC85xx + +#endif CONFIG MPC85xx + + + Autoboot + Your ${BOARD} may be set up to autoboot into an Operating System. + In order to stop autoboot and drop down to the U-Boot prompt, press + any key when the autoboot count down starts. To disable autobooting, use + the setenv + command to set the + bootdelay environment variable to + -1. You must use the + saveenv + command to save this change. + + + + + U-Boot Shell + U-Boot is designed to set up your ${BOARD} and turn execution over + to an OS. In order to transfer control, U-Boot provides many commands + to help customize the hardware. + + One way to customize your version of U-Boot is through the use of + environment variables. Variables + can be modified with the + setenv + command. These variables will return to defaults after a reset unless a + saveenv + command is executed. You can create any number of environment variables + to store instruction sequences. These variables can then be executed + with the run + command. By modifying the + bootcmd and + preboot + environment varaibles, you can automate the use of your customized + variables. In order to save a string of commands to your environment + variable, you must insert a semicolon between every command. You will + either need to escape your semicolon (\;) or put the entire variable in + quotation marks (""). See the + Scripting in U-Boot section for more + information on quotation marks. + + To see a list of the commands available to you, type + help at the + command prompt. + + After entering a command, you can re-execute it simply by pressing + the ENTER or RETURN key. Some commands, such as memory display + (md), + auto-increment to the next address on each subsequent auto-repeat. + + + + + + Network + If network operations will be performed on the target, connect any + applicable Ethernet interfaces. The ${BOARD} supports IP, TCP, ARP, + DHCP, TFTP, UDP, and ICMP transactions. Please also reference the + + Network Environment Variables and + + Network Commands for information + on using the ${BOARD}'s Ethernet ports. + + + + + Firmware Update Procedure + In the even that you receive a firmware update or one of your + U-Boot images becomes corrupt, use the following procedure. + + + + Place a good U-Boot image on a TFTP server. + + + Set your + network environment variables to reflect + the location of your TFTP server. + + + + Download the new U-Boot image using the + tftp + command. + +tftp $loadaddr <path to U-Boot image> + + + + + Erase the old U-Boot image, beginning at ${TEXT_BASE} using + the erase + command. + +erase ${TEXT_BASE} +800000 + + + + + Copy the downloaded image to flash using the + cp command. + +cp.b $loadaddr ${TEXT_BASE} $filesize + + + + + Reset the board to load the new image using the + reset + command. + + + + +
+
diff --git a/doc/manual/uboot-doc b/doc/manual/uboot-doc new file mode 100644 index 0000000..c2939bc --- /dev/null +++ b/doc/manual/uboot-doc @@ -0,0 +1,866 @@ +#!/usr/bin/perl -w + +use strict; + +## Copyright (C) 2009 Extreme Engineering Solutions +## +## Author: John Schmoller +## +## This software falls under the GNU General Public License. +## Please read the COPYING file for more information +## +## This file is loosly based on kernel-doc originally created by +## Michael Zucchi from the Linux distribution. + +# +# This will read a 'c' file and scan for embedded comments in the +# style of gnome comments (+minor extensions - see below). +# + +# usage: +# uboot-doc inputfile ... +# +# inputfile ... - a list of files which will be searched for comment +# blocks to convert to XML. +# +# All errors go to stderr. + +# +# format of comments. +# In the following table, (...)? signifies optional structure. +# (...)* signifies 0 or more structure elements +# /** +# * @cmd: cmd_name +# (* @sect: sect_name)? +# (* a blank line)? +# (* @param([(o)?(r)?])?: param_name - description)* +# * @desc: Description of function +# (* Function description extends through comment end.)* +# (*)?*/ +# +# The @sect is optional, and specifies which command sub-section +# to place the common. Any string is a valid @sect descriptor (e.g. "Memory", +# "Networking", "Environment Modifying". If not +# specified, the command will be placed in the "Other" section. +# +# There are two optional suffixes to the @param specifier. o states whether +# the parameter is optional, r states whether the parameter is replaceable. +# Non-replaceable parameters are entered litterally, like i2c *probe*. +# Replaceable parameters are substituted before the command is valid, like +# md *addr* to md *100000*. Valid options are [or], [ro], [o], [r], [], and +# nothing. [] means not optional and non-replaceable. Nothing defaults to +# not optional and replaceable. +# +# The @desc and @entry fields can have links to other points in the document. +# To specify a link to a command, use @ccommand_name, and for environment +# variables, @eenv_name. For example, @cprintenv or @ebootdelay. +# +# So .. the trivial example would be: +# +# /** +# * @cmd: my_command +# */ +# +# Or more compicated: +# /** +# * @cmd: my_function +# * @sect: Memory +# * @param: my_arg - its mine +# * @desc: Does my stuff explained. +# */ +# etc. +# +# Besides functions you can also write documentation for environment varaibles, +# POSTs, and memory maps. Instead of @cmd name you must write the name +# of the declaration; @env, @post, or @memmap must always precede +# the name. Nesting of declarations is not supported. +# e.g. +# /** +# * @env: env_name +# (* @sect: sect_name)? +# * @desc: Environment variable description. +# (* Additional description.)* +# (*)?*/ +# +# /** +# * @post: post_name +# * @desc: POST description. +# (* Additional description.)* +# (*)?*/ +# +# /** +# * @memmap: Memory Map Name +# (* @entry: start_addr: end_addr: Entry description)* +# (*)?*/ +# +# All @desc can be multiline. +# + +my $manual_dir = "doc/manual"; + +sub usage { + print "Usage: $0 outputfile\n"; + exit 1; +} + +# read arguments +if ( $#ARGV == -1 ) { + usage(); +} + +# states +# 0 - normal code +# 1 - looking for command, env var, post, or memmap +# 2 - parsing params and the first line of desc +# 3 - finish parsing desc's, parse memmap entries +my $state; + +# Regular expressions for matching section types +my $doc_special = '@'; +my $doc_system_env = '\$'; +my $doc_cmd_link = $doc_special . 'c'; +my $doc_env_link = $doc_special . 'e'; +my $doc_start = '^\s*/\*\*\s*$'; # Allow whitespace at end of comment start. +my $doc_end = '\*/'; +my $doc_com = '\s*\*\s*'; +my $doc_sect = $doc_special . 'sect:'; +my $doc_cmd = $doc_special . 'cmd:\s*'; +my $doc_param = $doc_special . 'param\s*\[?[or]*\]?:\s*'; +my $doc_env = $doc_special . 'env:\s*'; +my $doc_desc = $doc_special . 'desc:\s*'; +my $doc_post = $doc_special . 'post:\s*'; +my $doc_memmap = $doc_special . 'memmap:\s*'; +my $doc_memmap_entry = $doc_special . 'entry:\s*'; + +# Hashes and arrays for storing output to files +my @valuetype; +my @valuename; +my @valuedesc; +my %cmdhash; +my %envhash; +my %posthash; +my %definehash; +my %memmaphash; +my @definecontext = (1); + +reset_state(); + +# Open up commands.xml to write and add the XML header +if ( !open( CMDOUT, ">$manual_dir/commands.xml" ) ) { + print STDERR "Error: Cannot open file commamds.xml\n"; + return; +} +print CMDOUT "\n\n"; +print CMDOUT "\n\n"; +print CMDOUT "\n\n"; +print CMDOUT " U-Boot Commands\n\n"; + +# Open up environment_variables.xml to write and add the XML header +if ( !open( ENVOUT, ">$manual_dir/environment_variables.xml" ) ) { + print STDERR "Error: Cannot open file environment_variables.xml\n"; + return; +} +print ENVOUT "\n\n"; +print ENVOUT "\n\n"; +print ENVOUT "\n\n"; +print ENVOUT " U-Boot Environment Variables\n\n"; + +# Open up posts.xml to write and add XML header +if ( !open( POSTOUT, ">$manual_dir/posts.xml" ) ) { + print STDERR "Error: Cannot open file posts.xml\n"; + return; +} +print POSTOUT "\n\n"; +print POSTOUT "\n\n"; +print POSTOUT "\n\n"; +print POSTOUT " U-Boot POST Descriptions\n\n"; + +# Open up memory_resources.xml to write and add XML header +if ( !open( MEMOUT, ">$manual_dir/memory_resources.xml" ) ) { + print STDERR "Error: Cannot open file memory_resources.xml\n"; + return; +} +print MEMOUT "\n\n"; +print MEMOUT "\n\n"; +print MEMOUT "\n\n"; +print MEMOUT " U-Boot Memory Resources\n\n"; + +# Parse autoconf.mk for #defines +if ( open( AUTOCONF, ") { + my $key = $_; + my $value = $_; + $key =~ s/=.*\s*$//; + $value =~ s/^.*?=//; + $value =~ s/\s*$//; + $definehash{$key} = $value; + } +} else { + print STDERR "Error: Cannot open file autoconf.mk\n"; +} + +# Get date from timestamp_autogenerated.h +my $DATE = "Jan 1, 2000"; +if ( open( TIMESTAMP, ") { + if (/U_BOOT_DATE\s*\"([\w\s]*)\"\s*$/) { + $DATE = $1; + } + } +} + +# Get version from version_autogenerated.h +my $VERSION = "U-Boot $DATE"; +if ( open( VERSION, ") { + if (/U_BOOT_VERSION\s*\"U-Boot\s*(.*?)\"\s*$/) { + $VERSION = $1; + } + } +} + +sub process_file($); + +foreach (@ARGV) { + chomp; + process_file($_); +} + +# Finish off the commands.xml file +foreach my $HoHkey ( sort ( keys(%cmdhash) ) ) { + my $tag_key = lc($HoHkey); + while ( $tag_key =~ / / ) { + $tag_key =~ s/ /_/; + } + print CMDOUT " \n"; + print CMDOUT " $HoHkey Commands\n"; + foreach my $key ( sort ( keys %{ $cmdhash{$HoHkey} } ) ) { + print CMDOUT $cmdhash{$HoHkey}{$key}; + } + print CMDOUT " \n"; +} +print CMDOUT ""; + +# Finish off the environment_variables.xml file +foreach my $HoHkey ( sort ( keys(%envhash) ) ) { + my $tag_key = lc($HoHkey); + while ( $tag_key =~ / / ) { + $tag_key =~ s/ /_/; + } + print ENVOUT " \n"; + print ENVOUT " $HoHkey Environment Variables\n"; + print ENVOUT " \n"; + print ENVOUT " $HoHkey Environment Variables\n"; + print ENVOUT " \n"; + print ENVOUT " \n"; + print ENVOUT " \n"; + print ENVOUT " \n"; + print ENVOUT " \n"; + print ENVOUT " Variable\n"; + print ENVOUT " Description\n"; + print ENVOUT " \n"; + print ENVOUT " \n"; + print ENVOUT " \n"; + + foreach my $key ( sort ( keys %{ $envhash{$HoHkey} } ) ) { + print ENVOUT $envhash{$HoHkey}{$key}; + } + print ENVOUT " \n"; + print ENVOUT " \n"; + print ENVOUT "
\n"; + print ENVOUT "
\n"; +} +print ENVOUT "
"; + +# Finish off the posts.xml file +foreach my $key ( sort ( keys(%posthash) ) ) { + print POSTOUT $posthash{$key}; +} +print POSTOUT "
"; + +# Finish off the memory_resources.xml file +# Set System Memory Map first, all others alphabetically +foreach my $key ( sort ( keys(%memmaphash) ) ) { + my $tag_key = lc($key); + while ( $tag_key =~ / / ) { + $tag_key =~ s/ /_/; + } + + print MEMOUT " \n"; + print MEMOUT " $key\n"; + print MEMOUT " \n"; + print MEMOUT " $key\n"; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT " Start\n"; + print MEMOUT " End\n"; + print MEMOUT " Description\n"; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT $memmaphash{$key}; + print MEMOUT " \n"; + print MEMOUT " \n"; + print MEMOUT "
\n"; + print MEMOUT "
\n"; +} +print MEMOUT "
"; + +# Start processing the template files. Look first in $manual_dir/ +# then in board/$BOARDDIR/manual. Overwrite any duplicate +# files found in $manual_dir/ with the ones found in board/. +my %files; +opendir( MANDIR, $ENV{'TOPDIR'} . "/$manual_dir" ) or die "$!"; +my @manfiles = grep { /.*\.tmpl/ } readdir MANDIR; +close MANDIR; +foreach my $file (@manfiles) { + $files{$file} = $ENV{'TOPDIR'} . "/$manual_dir/$file"; +} +if ( opendir( BOARDDIR, $ENV{'TOPDIR'} . "/board/" . + $ENV{'BOARDDIR'} . "/manual" ) ) +{ + my @boardfiles = grep { /.*\.tmpl/ } readdir BOARDDIR; + close BOARDDIR; + foreach my $file (@boardfiles) { + $files{$file} = + $ENV{'TOPDIR'} . "/board/" . $ENV{'BOARDDIR'} . "/manual/$file"; + } +} + +foreach my $file ( keys(%files) ) { + @definecontext = (); + push( @definecontext, 1 ); + my $define; + my $outfile = $file; + $outfile =~ s/\.tmpl//; + $outfile .= ".xml"; + open( FH, "$files{$file}" ) or die "Cannot open file $files{$file}: $!"; + open( OUT, ">$manual_dir/$outfile" ) or die "$!"; + + while () { + + # #else processing + if (/^#else/) { + + if ( $definecontext[$#definecontext] ) { + $definecontext[$#definecontext] = 0; + } else { + $definecontext[$#definecontext] = 1; + } + + # #endif processing + } elsif (/^#endif/) { + pop(@definecontext); + + # #ifdef processing + } elsif (/^#ifdef\s*(\w*)\s*$/) { + + if ( !$definecontext[$#definecontext] ) { + push( @definecontext, 0 ); + } elsif ( exists( $definehash{$1} ) ) { + push( @definecontext, 1 ); + } else { + push( @definecontext, 0 ); + } + + # ignore everything else until context changes + } elsif ( !$definecontext[$#definecontext] ) { + next; + + # System environment and #define processing + } elsif (/[$doc_special$doc_system_env]/) { + my @words = split(/\s+/); + foreach my $word (@words) { + while ( $word =~ /^.*?$doc_special(\w*).*?$/ ) { + $define = $1; + + if ( exists( $definehash{$define} ) ) { + s/$doc_special\w*/$definehash{$define}/; + } else { + s/$doc_special/ at /; + } + $word =~ s/$doc_special/ at /; + } + while ( $word =~ /$doc_system_env\{(\w*)\}+/ ) { + $define = $1; + + # Check for the special $VERSION and $DATE defines + if ( $define eq "VERSION" ) { + s/$doc_system_env\{\w*\}/$VERSION/; + } elsif ( $define eq "DATE" ) { + s/$doc_system_env\{\w*\}/$DATE/; + } elsif ( exists $ENV{"$define"} ) { + s/$doc_system_env\{\w*\}/$ENV{"$define"}/; + } else { + s/$doc_system_env\{(\w*)\}/\$$1/; + } + $word =~ s/$doc_system_env/ /; + } + } + print OUT $_; + } elsif ( $definecontext[$#definecontext] ) { + print OUT $_; + } + } + close(FH); +} + +# Output the DOCBOOK_XSL_DIR variable so it's readable by the stylesheets +if ( !open( PARAMS, ">$manual_dir/params.xsl" ) ) { + print STDERR "Error: Cannot open file params.xsl\n"; + return; +} +print PARAMS "\n\n"; +print PARAMS "\n\n"; +print PARAMS "\n\n"; +print PARAMS " \n\n"; +print PARAMS "\n"; +close(PARAMS); + +# Function to parse descriptive text to find possible XML links +sub output_link($) { + my @words; + my $retstr = ""; + $_ = $_[0]; + + @words = split(/\s+/); + foreach (@words) { + if (/^$doc_env_link(\w*)/) { #link to environment element in doc + $retstr .= ""; + $retstr .= "$1 "; + } elsif (/^$doc_cmd_link(\w*)/) { #link to command element in doc + $retstr .= ""; + $retstr .= "$1 "; + } else { + $retstr .= "$_ "; + } + } + return $retstr; +} + +# Writes XML for a command to the command hash +sub output_command { + my $i = 0; + my $conditional_prints = 1; + my $hashvalue = ""; + my $hashkey; + my $tag_key; + my $hashofhasheskey; + + # Make sure we're not re-processing a command + if ( exists( $cmdhash{ $valuedesc[0] }{ $valuename[0] } ) ) { + return; + } + + # Cycle through all the elements to the command + foreach (@valuetype) { + + # The @cmd and @sect lines + if (/$doc_cmd/) { + $hashkey = $valuename[$i]; + $tag_key = lc( $valuename[$i] ); + while ( $tag_key =~ / / ) { + $tag_key =~ s/ /_/; + } + $hashvalue .= " \n"; + $hashvalue .= " $valuename[$i]\n"; + $hashvalue .= " \n"; + $hashvalue .= " $valuename[$i]\n"; + $hashofhasheskey = $valuedesc[$i]; + + if ( $hashofhasheskey eq '0' ) { + $hashofhasheskey = "Other"; + } + + if ( !exists( $cmdhash{$hashofhasheskey} ) ) { + $cmdhash{$hashofhasheskey} = {}; + } + } elsif (/$doc_param/) { # The @param line + if (/\[[or]*\]/) { #arg options specified + if (/\[\w?o\w?\]/) { #arg optional + $hashvalue .= " \n"; + } else { #arg required + $hashvalue .= " \n"; + } + + if (/\[\w?r\w?\]/) { #arg replaceable + $hashvalue .= " $valuename[$i]"; + $hashvalue .= "\n"; + } else { #arg literal + $hashvalue .= " $valuename[$i]\n"; + } + $hashvalue .= " \n"; + } else { #assume [r] + $hashvalue .= " \n"; + $hashvalue .= " $valuename[$i]"; + $hashvalue .= "\n"; + $hashvalue .= " \n"; + } + } elsif (/$doc_desc/) { # The @desc line + my @words; + if ($conditional_prints) { #finish up the synopsis + $hashvalue .= " \n"; + $hashvalue .= " "; + $conditional_prints = 0; + } else { + $hashvalue .= " "; + } + + if ( $valuedesc[$i] eq "\n" ) { + $hashvalue .= "\n"; + if ( $i != $#valuetype ) { + $hashvalue .= " "; + } + $i++; + next; + } + + $hashvalue .= output_link( $valuedesc[$i] ); + + if ( ($i) == $#valuetype ) { + $hashvalue .= ""; + } + + $hashvalue .= "\n"; + } + $i++; + } + + # Make a second run through the command to get the XML formatted correctly + $conditional_prints = 1; + $i = 0; + my $param_present = 0; + foreach (@valuetype) { + if (/$doc_param/) { + if ($conditional_prints) { + $hashvalue .= " \n"; + $hashvalue .= " Arguments\n"; + $conditional_prints = 0; + $param_present = 1; + } + + $hashvalue .= " \n"; + $hashvalue .= " \n"; + + if (/\[\w?r\w?\]/) { #replaceable arg option specified + $hashvalue .= " $valuename[$i]"; + $hashvalue .= "\n"; + } elsif (/\[\w*\]/) { #replaceable arg not specified + $hashvalue .= " $valuename[$i]\n"; + } else { #no args specified, default to replaceable + $hashvalue .= " $valuename[$i]"; + $hashvalue .= "\n"; + } + + $hashvalue .= " \n"; + $hashvalue .= " \n"; + $hashvalue .= " $valuedesc[$i]\n"; + $hashvalue .= " \n"; + $hashvalue .= " \n"; + } + + if ( $i == $#valuetype ) { + if ($param_present) { + $hashvalue .= " \n"; + } + $hashvalue .= " \n"; + + } + $i++; + } + + $cmdhash{$hashofhasheskey}{$hashkey} = $hashvalue; +} + +# Function writes XML for an environment variable to the env hash +sub output_env { + my @words; + my $conditional_prints = 1; + my $i = 0; + my $hashvalue = ""; + my $hashkey; + my $hashofhasheskey; + + # Make sure we're not re-processing an environment variable + if ( exists( $envhash{ $valuedesc[0] }{ $valuename[0] } ) ) { + return; + } + + $hashkey = $valuename[0]; + $hashvalue .= " \n"; + $hashvalue .= " \n"; + $hashvalue .= " $valuename[0]\n"; + $hashvalue .= " \n"; + $hashvalue .= " \n"; + $hashvalue .= " "; + $hashofhasheskey = $valuedesc[0]; + + if ( $hashofhasheskey eq '0' ) { + $hashofhasheskey = "Other"; + } + + if ( !exists( $envhash{$hashofhasheskey} ) ) { + $envhash{$hashofhasheskey} = {}; + } + + # For each description element, add to the env var description + foreach (@valuetype) { + if (/$doc_desc/) { + if ( $i != 0 ) { + $hashvalue .= " "; + } + + if ( $valuedesc[$i] eq "\n" ) { + $hashvalue .= "\n"; + if ( $i != $#valuetype ) { + $hashvalue .= " "; + } + } else { + + $hashvalue .= output_link( $valuedesc[$i] ); + + if ( ($i) == $#valuetype ) { + $hashvalue .= ""; + } + + $hashvalue .= "\n"; + } + } + $i++; + } + + $hashvalue .= " \n"; + $hashvalue .= " \n"; + + $envhash{$hashofhasheskey}{$hashkey} = $hashvalue; +} + +sub output_post { + my $hashvalue = ""; + my $i = 0; + + if ( exists( $posthash{ $valuename[0] } ) ) { + return; + } + + my $hashkey = $valuename[0]; + my $tag_key = $hashkey; + while ( $tag_key =~ / / ) { + $tag_key =~ s/ /_/; + } + + foreach (@valuetype) { + if (/$doc_post/) { + $hashvalue .= " \n"; + $hashvalue .= " $hashkey\n"; + $hashvalue .= " \n"; + } elsif (/$doc_desc/) { + if ( $valuedesc[$i] eq "\n" ) { + $hashvalue .= "\n"; + if ( $i != $#valuetype ) { + $hashvalue .= " "; + } + } else { + $hashvalue .= " "; + $hashvalue .= output_link( $valuedesc[$i] ); + } + } + $i++; + } + + $hashvalue .= " \n"; + $hashvalue .= " \n"; + + $posthash{$hashkey} = $hashvalue; +} + +# Function writes XML for a memory map to the memmap hash +sub output_memmap { + my @words; + my $conditional_prints = 1; + my $i = 0; + my $hashvalue = ""; + my $hashkey; + + # Make sure we're not re-processing a memory map + if ( exists( $memmaphash{ $valuedesc[0] } ) ) { + return; + } + + # Make a valid XML tag name out of memmap description + $hashkey = $valuedesc[0]; + my $tag_key = lc($hashkey); + while ( $tag_key =~ / / ) { + $tag_key =~ s/ /_/; + } + + # Cycle through all the memmap entries + foreach (@valuetype) { + my @words; + if (/$doc_memmap_entry/) { + + $hashvalue .= " \n"; + + # Split up start and end and drop them in the table + @words = split( /\s*:\s*/, $valuedesc[$i] ); + foreach my $word (@words) { + $hashvalue .= " \n"; + $hashvalue .= " $word\n"; + $hashvalue .= " \n"; + } + + $hashvalue .= " \n"; + $hashvalue .= " "; + $hashvalue .= output_link( $valuename[$i] ); + $hashvalue .= "\n"; + $hashvalue .= " \n"; + $hashvalue .= " \n"; + + } + $i++; + } + + $memmaphash{$hashkey} = $hashvalue; +} + +# Call the appropriate output function +sub output_section { + if ( $valuetype[0] =~ /$doc_cmd/io ) { + output_command(); + } elsif ( $valuetype[0] =~ /$doc_env/io ) { + output_env(); + } elsif ( $valuetype[0] =~ /$doc_post/io ) { + output_post(); + } elsif ( $valuetype[0] =~ /$doc_memmap/io ) { + output_memmap(); + } +} + +# After each comment block, reset all our variables +sub reset_state { + + @valuetype = (); + @valuename = (); + @valuedesc = (); + + $state = 0; +} + +# Main processing loop +sub process_file($) { + my $file; + my $identifier; + my $func; + my $descr; + my @links; + + $file = "@_"; + + if ( !open( IN, "<$file" ) ) { + print STDERR "Error: Cannot open file $file\n"; + return; + } + + while () { + if ( $state == 0 ) { # Normal code + if (/$doc_start/io) { + $state = 1; + } + } elsif ( $state == 1 ) + { # We got the start of a potential comment block + if (/^$doc_com$/io) { # Got an empty line + next; + + } elsif (/$doc_cmd\s*([\w\s-]*\w)\s*$/io) { # Found a function + push @valuetype, $doc_cmd; + push @valuename, $1; + push @valuedesc, '0'; + + $state = 2; + } elsif (/$doc_env\s*([\w\s-]*\w)\s*$/io) { # Found an env var + push @valuetype, $doc_env; + push @valuename, $1; + push @valuedesc, '0'; + + $state = 2; + } elsif (/$doc_post\s*([\w\s-]*\w)\s*$/io) { # Found POST descriptor + push @valuetype, $doc_post; + push @valuename, $1; + push @valuedesc, '0'; + + $state = 2; + } elsif (/$doc_memmap\s*([\w\s-]*\w)\s*$/io) { # Found a memory map + push @valuetype, $doc_memmap; + push @valuename, '0'; + push @valuedesc, $1; + + $state = 3; + } elsif (/$doc_end/io) { # Musta been a normal comment + $state = 0; + } + } elsif ( $state == 2 ) { # Found a valid comment declaration + if (/^$doc_com$/io) { # Got an empty line + next; + } elsif (/($doc_param)\s*([^-]*[^\s])\s*-\s*(.*)\s*$/io) { # Param + push @valuetype, $1; + push @valuename, $2; + push @valuedesc, $3; + } elsif (/$doc_desc(.*\s*$)/io) { # Got a description + push @valuetype, $doc_desc; + push @valuename, $doc_desc; + push @valuedesc, $1; + + $state = 3; + } elsif (/$doc_sect\s*(.*[^\s])\s*$/io) { # Got a sub-section decl + $valuedesc[$#valuedesc] = $1; + } else { # Something undefined happened + print STDERR "Warning(${file}:$.): bad line: $_"; + reset_state(); + } + } elsif ( $state == 3 ) { # Process descriptions and memmap entries + if (/$doc_end/) { # End of comment block + # Write comment to proper hash + output_section(); + + # Reset hash variables and state + reset_state(); + } elsif (/^$doc_com$/) { # Empty line, push a newline + push @valuetype, $doc_desc; + push @valuename, $doc_desc; + push @valuedesc, "\n"; + + # Got memmap entry + } elsif (/$doc_memmap_entry\s*(\w*\s*:\s*\w*)\s*:\s*(.*)$/io) { + push @valuetype, $doc_memmap_entry; + push @valuename, $2; + push @valuedesc, $1; + } else { # No tag, keep pushing description + $descr = $_; + $descr =~ s/^$doc_com//io; + + push @valuetype, $doc_desc; + push @valuename, $doc_desc; + push @valuedesc, $descr; + } + } + } +} + diff --git a/doc/manual/uboot_manual.xsl b/doc/manual/uboot_manual.xsl new file mode 100644 index 0000000..bc40b46 --- /dev/null +++ b/doc/manual/uboot_manual.xsl @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + always + 2.8em + 3em + 3.2em + left + + + + + + + + + + + + + + + + U-Boot User's Manual + + + + + + + + + + + url(' + + ') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + always + + + + always + bold + + + pt + + false + 0.4em + 0.6em + 0.8em + + + + + + + + + + + + always + 1.5pt solid black + left + + 75% + + + + left + + 60% + + + #e6e6fb + + + + + + + + + + + + + + + normal + normal + 4pt + + + + + + + 1em + 0.8em + 1.2em + 1em + 0.8em + 1.2em + 0.25in + + + + + + + 0.8em + 1em + 1.2em + 0.8em + 1em + 1.2em + false + no-wrap + false + preserve + preserve + start + 75% + + + diff --git a/rules.mk b/rules.mk index 6f999dd..383bf6b 100644 --- a/rules.mk +++ b/rules.mk @@ -24,6 +24,7 @@ ######################################################################### _depend: $(obj).depend +_man_parse: $(obj).man_parse $(obj).depend: $(src)Makefile $(TOPDIR)/config.mk $(SRCS) @rm -f $@ @@ -32,4 +33,10 @@ $(obj).depend: $(src)Makefile $(TOPDIR)/config.mk $(SRCS) $(CC) -M $(HOSTCFLAGS) $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \ done +$(obj).man_parse: $(src)Makefile $(TOPDIR)/config.mk $(SRCS) + @for f in $(SRCS); do \ + $(CPP) $(CPPFLAGS) -C $$f | \ + perl $(TOPDIR)/doc/manual/doc-stream.pl >> \ + $(TOPDIR)/doc/manual/autoconf-doc.txt; \ + done ######################################################################### -- 1.6.0.4