BCM963XX LinuxDeveloperGuide
BCM963XX LinuxDeveloperGuide
Version 3.0
16215 Alton Parkway • P.O. Box 57013 • Irvine, CA 92619-7013 USA • Phone: (949) 450-8700 • Fax: (949) 450-8710
BCM963xx Linux Software Build Guide
Table of Contents
1.0 Introduction......................................................................................................... 2
Broadcom Corporation
Page ii Document 963XX-SWUM100-x
BCM963XX Linux Software Build Guide
REVISION HISTORY
®
This document contains information that is confidential and proprietary to Broadcom Corporation (Broadcom) and may not be
reproduced in any form without express written consent of Broadcom. No transfer or licensing of technology is implied by this
document. Broadcom reserves the right to make changes without further notice to any products or data herein to improve reliability,
function, or design. Information furnished by Broadcom is believed to be accurate and reliable. However, Broadcom does not
assume any liability arising out of the application or use of this information, nor the application or use of any product or circuit
described herein, neither does it convey any license under its patent rights nor the rights of others.
Copyright © 2002 by Broadcom Corporation. All rights reserved. Printed in the U.S.A.
®
Broadcom and the pulse logo are trademarks of Broadcom Corporation and/or its subsidiaries in the United States and certain
other countries. All other trademarks are the property of their respective owners.
Broadcom Corporation
Document 96345/9635X-DEVELGUIDE-01 Page 1
BCM963xx Linux Software Build Guide
1.0 INTRODUCTION
This document provides detailed information on the software build framework for the BCM963xx xDSL
router or IAD device reference design platforms. Developers may use the framework to build a software
image including both Linux kernel and user applications. Under the framework, developers have the
flexibility to choose a variety of configurations as well as software components for different platforms such
as the BCM96345R or BCM96345GW etc. tailored to their specific needs and feature set. For example, if
a developer does not need firewall or NAT, they can exclude it from the build configurations to obtain a
smaller image size. The file specifying build configurations for a hardware platform is called a platform
build profile. This framework is generic and designed with scalability, meaning future platforms can be
added with little effort.
Broadcom Corporation
Page 2 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
/opt/bcm963xx
96345R…
96345R Build profile for 6345R board
Broadcom Corporation
Document 963XX-SWUM100-x Page 3
BCM963xx Linux Software Build Guide
Within a build profile, a form of “name=value” is used to specify a configuration item. Different values
have different meanings.
For kernel drivers and modules:
• "m" means “build the driver as kernel module”
• "y" means “statically link with kernel”
• "# ... is not set" means “do not build the driver”
Broadcom Corporation
Page 4 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
At the top-level of source code directory, type make menuconfig, then a GUI interface appears.
.
By selecting “Load software build profile”, you can load an existing profile, such as 96345GW or
96345R, and then you can modify configurations and select “Save software build profile as…” to create
your own platform build profile. You can also start from scratch to create a profile. Following steps show
how to create a customized profile based upon 96345GW profile.
Broadcom Corporation
Document 963XX-SWUM100-x Page 5
BCM963xx Linux Software Build Guide
By default, the 96345GW profile supports all the netfilter features including NAT and firewall. In this
example, we show how to create a profile that does not support NAT and firewall, but it needs remote
access in PPP IP extension mode. Consequently, the user applications, upnp and reaim (transparent
proxy of AOL/MSN messenger) are not needed, and are excluded from the new build profile.
Step 1:
Load BCM96345GW profile by selecting “Load software build profile”,
Step 2:
Select “Netfilter selection”. NAT, firewall and ALGs are all supported by the default BCM96345GW
profile.
Broadcom Corporation
Page 6 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
Step 3:
Clear “Firewall support”, “NAT support” and “Logging events” by pressing space or “n”, and then
select “Remote access support in PPP IP extension” by pressing “m” if built as kernel modules or “y” if
built as statically linked with the kernel.
Note:
When “Firewall support” is enabled, several netfilter kernel modules will be built into the root file system
including ip_tables.o, ipt_state.o, iptable_filter.o, ipt_TCPMSS.o.
When “NAT support” is enabled, several netfilter kernel modules will be automatically built into the root
file system including ip_tables.o, ip_conntrack.o, iptable_nat.o, ipt_MASQUERADE.o, ipt_REDIRECT.o.
You can enable those ALG modules as well, such as H.323 (ip_conntrack_h323.o, ip_nat_h323.o).
When “Remote access support in PPP IP extension” is enabled, several netfilter kernel modules will be
built into the root file system including ip_tables.o, ip_conntrack.o, iptable_nat.o, iptable_filter.o and
ipt_TCPMSS.o
Broadcom Corporation
Document 963XX-SWUM100-x Page 7
BCM963xx Linux Software Build Guide
Step 4:
Select “Exit” and go back to the main menu. Select “User application selection”. All the included
applications for the BCM96345GW board are listed.
Broadcom Corporation
Page 8 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
Step 5:
Clear “Transparent proxy for AOL/MSN messenger” and “UPNP” by pressing space or “n”,
Broadcom Corporation
Document 963XX-SWUM100-x Page 9
BCM963xx Linux Software Build Guide
Step 6:
Select “Exit” and go back to the main menu. Select “Save software build profile as…” and then type
“my96345GW”.
Broadcom Corporation
Page 10 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
After the profile named “my96345GW” is saved, a new directory “my96345GW” is created under “targets”
directory and the profile named “my96345GW” is also created. You can use the new profile to build your
customized image by following commands described in the next section.
Since we may build different images with different configurations in one place, it is required to specify the
profile name in all the following build commands.
Broadcom Corporation
Document 963XX-SWUM100-x Page 11
BCM963xx Linux Software Build Guide
1. Build image
$make PROFILE=<profile name>
Default settings (configurations) are quite desirable for end-users because they do not need to configure
the software themselves and thus it makes customer support easier. A developer can specify which
default settings file to be included in the image by using GUI-based "make menuconfig” when creating a
build profile.
Broadcom Corporation
Page 12 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
2. Select "default settings file name" and type in the file name. The file must be located in
"targets/defaultcfg" directory.
After the default settings file is specified, the build framework will copy the file from "targets/defaultcfg"
directory to the target root file system, which is "fs/etc/default.cfg". When the xDSL router boots, it will use
the default settings in that file to properly configure itself.
Note that the design of default settings support is backward compatible, which means that a default
settings file is optional. If you do not want a default settings file and do not specify it in your profile,
everything stays the same as before (the default settings are empty.)
The way to generate a default settings file for adding into the build framework is easy. Just use WebUI to
configure all the settings that are expected to be included in the default settings, then select
"Management/Settings/Backup" to export the settings to a file. Put the file under "targets/defaultcfg"
directory for including when building an image. In this way, the default settings file can include any
possible configurations.
Broadcom Corporation
Document 963XX-SWUM100-x Page 13
BCM963xx Linux Software Build Guide
The "buildFS" script specifies how to build the final root file system, i.e., how to pull out the necessary files
in "fs.src" into the "fs" directory. The "makeDevs" script specifies how to create the device files in the
target root file system.
For each profile, its directory "targets/<profile name>/fs" directory which is generated by the build
process, contains the final target root file system.
Broadcom Corporation
Page 14 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
Note that the “static” here implies that an application will be built as a static library. It is useful if you want
to build the application as the busybox applet. It DOES NOT mean that the application is a self-contained
application that statically links in C library code.
Step 2:
Modify the Makefile in your application source directory by adding 'dynamic' and 'static' target. The
following lists the Makefile of 'reaim'.
#############################################################
CFLAGS= -s -Os -fomit-frame-pointer
LDFLAGS= -Wl,-allow-shlib-undefined
ifeq ($(strip $(BUILD_REAIM)), static)
CFLAGS += -DBUILD_STATIC
endif
all: reaim
install:
install -m 755 reaim $(INSTALL_DIR)/bin
$(STRIP) $(INSTALL_DIR)/bin/reaim
dynamic: reaim install
static: reaim.a
reaim: reaim.c
$(CC) $(CFLAGS) $(LDFLAGS) -o reaim reaim.c
reaim.a: reaim.c
$(CC) $(CFLAGS) -c -o reaim.o reaim.c
$(AR) rcs reaim.a reaim.o
clean:
rm -f reaim reaim.o reaim.a
############################################################
Broadcom Corporation
Document 963XX-SWUM100-x Page 15
BCM963xx Linux Software Build Guide
'dynamic' target builds dynamic-linked executable application, ‘reaim’. 'static' target builds a static library,
for example, 'reaim.a'”.
In CFLAGS, '-Os' to enable optimization for size. (If -Os causes problem, go back to -O2)
Step 3:
Modify the source file that contains the 'main' function like the following:
#ifdef BUILD_STATIC
int reaim_main(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
Step 4:
In all your profiles, define whether your application is going to be built as dynamic-linked or static library,
like
BUILD_REAIM=dynamic or BUILD_REAIM=static
Step 5:
Add the application to the build framework and make it configurable through the GUI 'make menuconfig'.
Add the following line into targets/config.in file:
Step 6:
In the top-level Makefile, add the following:
Broadcom Corporation
Page 16 Document 963XX-SWUM100-x
Linux Software Build Guide BCM963xx
If you added the application as opensource code following the recommended way in step 1, you need to
add one more line before $(MAKE) command to untar the original source code tar ball.
Broadcom Corporation
Document 963XX-SWUM100-x Page 17