1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-03 21:09:42 +02:00

add initial support for the crisarchitecture used on foxboards to openwrt

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7439 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
blogic 2007-06-02 00:46:02 +00:00
parent 5bae61fcd1
commit 9b11307b07
235 changed files with 223626 additions and 3 deletions

View File

@ -0,0 +1,44 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
ARCH:=cris
BOARD:=etrax
BOARDNAME:=FOXBOARD (ETRAX 100LX)
FEATURES:=squashfs jffs2
LINUX_VERSION:=2.6.19.2
include $(INCLUDE_DIR)/kernel-build.mk
define Target/Description
Build fimware images for the FOXBOARD made by acmesystems.it
endef
define Kernel/Prepare/Fox
bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
if [ -d ./files ]; then $(CP) ./files/* $(LINUX_DIR)/; fi
if [ -d ./patches/generic_2.6 ]; then $(PATCH) $(LINUX_DIR) ./patches/generic_2.6; fi
if [ -d ./patches/cris ]; then $(PATCH) $(LINUX_DIR) ./patches/cris; fi
ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/include/asm-cris/arch-v10 $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/include/asm-cris/arch
ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/arch/cris/arch-v10 $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/arch/cris/arch
endef
define Kernel/Prepare
$(call Kernel/Prepare/Fox)
endef
include $(INCLUDE_DIR)/prereq.mk
$(eval $(call RequireCommand,/usr/local/cris/gcc-cris, \
Please install the binary cris toolchain. \
))
#include the profiles
-include profiles/*.mk
KERNELNAME:="zImage"
$(eval $(call BuildKernel))

View File

@ -0,0 +1,5 @@
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K stop
console::askfirst:/bin/ash --login
tts/0::askfirst:/bin/ash --login
tty1::askfirst:/bin/ash --login

View File

@ -0,0 +1,214 @@
CONFIG_BASE_SMALL=0
# CONFIG_BLK_DEV_INITRD is not set
CONFIG_CRIS=y
# CONFIG_ETRAX100LX is not set
CONFIG_ETRAX100LX_V2=y
# CONFIG_ETRAXFS is not set
# CONFIG_ETRAXFS_SIM is not set
CONFIG_ETRAX_ARCH_V10=y
# CONFIG_ETRAX_ARCH_V32 is not set
CONFIG_ETRAX_AXISFLASHMAP=y
# CONFIG_ETRAX_AXISFLASHMAP_MTD0WHOLE is not set
CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock1 rootfstype=squashfs,jffs2 init=/etc/preinit noinitrd console=ttyS0,115200"
# CONFIG_ETRAX_CSP0_LEDS is not set
# CONFIG_ETRAX_DEBUG_PORT0 is not set
# CONFIG_ETRAX_DEBUG_PORT1 is not set
# CONFIG_ETRAX_DEBUG_PORT2 is not set
# CONFIG_ETRAX_DEBUG_PORT3 is not set
CONFIG_ETRAX_DEBUG_PORT_NULL=y
CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x4
# CONFIG_ETRAX_DEF_R_PORT_G_DIR is not set
CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0xf0
CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1c
CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00
CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0x03
CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0xce
CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x09603737
CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002
CONFIG_ETRAX_DEF_R_WAITSTATES=0x95f8
CONFIG_ETRAX_DRAM_SIZE=32
CONFIG_ETRAX_DRAM_VIRTUAL_BASE=c0000000
CONFIG_ETRAX_DS1302=y
CONFIG_ETRAX_DS1302_RSTBIT=2
CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT=y
CONFIG_ETRAX_DS1302_SCLBIT=1
CONFIG_ETRAX_DS1302_SDABIT=0
CONFIG_ETRAX_DS1302_TRICKLE_CHARGE=0
CONFIG_ETRAX_ETHERNET=y
CONFIG_ETRAX_FAST_TIMER=y
CONFIG_ETRAX_FLASH1_SIZE=0
CONFIG_ETRAX_FLASH_BUSWIDTH=2
CONFIG_ETRAX_GPIO=y
CONFIG_ETRAX_I2C=y
CONFIG_ETRAX_I2C_CLK_PORT=1
CONFIG_ETRAX_I2C_DATA_PORT=0
# CONFIG_ETRAX_I2C_EEPROM is not set
CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C=y
# CONFIG_ETRAX_IDE is not set
CONFIG_ETRAX_LED1G=2
CONFIG_ETRAX_LED1R=2
CONFIG_ETRAX_LED2G=3
CONFIG_ETRAX_LED2R=3
CONFIG_ETRAX_LED3G=2
CONFIG_ETRAX_LED3R=2
CONFIG_ETRAX_NANDFLASH_BUSWIDTH=1
CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y
# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set
# CONFIG_ETRAX_NO_LEDS is not set
# CONFIG_ETRAX_NO_PHY is not set
CONFIG_ETRAX_PA_CHANGEABLE_BITS=0xFF
CONFIG_ETRAX_PA_CHANGEABLE_DIR=0xFF
CONFIG_ETRAX_PA_LEDS=y
CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF
CONFIG_ETRAX_PB_CHANGEABLE_DIR=0xFF
# CONFIG_ETRAX_PB_LEDS is not set
# CONFIG_ETRAX_PCF8563 is not set
CONFIG_ETRAX_PTABLE_SECTOR=0
CONFIG_ETRAX_RESCUE_SER0=y
# CONFIG_ETRAX_RESCUE_SER1 is not set
# CONFIG_ETRAX_RESCUE_SER2 is not set
# CONFIG_ETRAX_RESCUE_SER3 is not set
# CONFIG_ETRAX_RS485 is not set
CONFIG_ETRAX_RTC=y
CONFIG_ETRAX_SDRAM=y
CONFIG_ETRAX_SER0_CD_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1
CONFIG_ETRAX_SER0_DSR_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_DSR_ON_PB_BIT=-1
CONFIG_ETRAX_SER0_DTR_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_DTR_ON_PB_BIT=-1
# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_MIXED is not set
CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y
# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set
# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set
CONFIG_ETRAX_SER0_RI_ON_PA_BIT=-1
CONFIG_ETRAX_SER0_RI_ON_PB_BIT=-1
CONFIG_ETRAX_SER2_CD_ON_PA_BIT=7
CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1
CONFIG_ETRAX_SER2_DSR_ON_PA_BIT=6
CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1
CONFIG_ETRAX_SER2_DTR_ON_PA_BIT=4
CONFIG_ETRAX_SER2_DTR_ON_PB_BIT=-1
# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_MIXED is not set
# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE is not set
CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA=y
# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set
CONFIG_ETRAX_SER2_RI_ON_PA_BIT=5
CONFIG_ETRAX_SER2_RI_ON_PB_BIT=-1
CONFIG_ETRAX_SER3_CD_ON_PA_BIT=-1
CONFIG_ETRAX_SER3_CD_ON_PB_BIT=-1
CONFIG_ETRAX_SER3_DSR_ON_PA_BIT=-1
CONFIG_ETRAX_SER3_DSR_ON_PB_BIT=-1
CONFIG_ETRAX_SER3_DTR_ON_PA_BIT=-1
CONFIG_ETRAX_SER3_DTR_ON_PB_BIT=-1
# CONFIG_ETRAX_SER3_DTR_RI_DSR_CD_MIXED is not set
CONFIG_ETRAX_SER3_DTR_RI_DSR_CD_ON_NONE=y
# CONFIG_ETRAX_SER3_DTR_RI_DSR_CD_ON_PA is not set
# CONFIG_ETRAX_SER3_DTR_RI_DSR_CD_ON_PB is not set
CONFIG_ETRAX_SER3_RI_ON_PA_BIT=-1
CONFIG_ETRAX_SER3_RI_ON_PB_BIT=-1
CONFIG_ETRAX_SERIAL=y
# CONFIG_ETRAX_SERIAL_FAST_TIMER is not set
# CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is not set
CONFIG_ETRAX_SERIAL_PORT0=y
# CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT is not set
# CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN is not set
CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN=y
CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT=y
# CONFIG_ETRAX_SERIAL_PORT1 is not set
CONFIG_ETRAX_SERIAL_PORT2=y
CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y
CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y
# CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set
# CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set
CONFIG_ETRAX_SERIAL_PORT3=y
CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT=y
CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN=y
# CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_IN is not set
# CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_OUT is not set
CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS=5
# CONFIG_ETRAX_SOFT_SHUTDOWN is not set
# CONFIG_ETRAX_SYNCHRONOUS_SERIAL is not set
CONFIG_ETRAX_SYSFS_NODES=y
CONFIG_ETRAX_USB_HOST=y
CONFIG_ETRAX_USB_HOST_PORT1=y
CONFIG_ETRAX_USB_HOST_PORT2=y
# CONFIG_ETRAX_WATCHDOG is not set
CONFIG_FS_POSIX_ACL=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_IOMAP=y
# CONFIG_GEN_RTC is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_IDE is not set
CONFIG_INITRAMFS_SOURCE=""
CONFIG_IRQ_PER_CPU=y
CONFIG_JFFS2_FS_DEBUG=0
CONFIG_MTD=y
CONFIG_MTDRAM_ABS_POS=0x0
CONFIG_MTDRAM_ERASE_SIZE=128
CONFIG_MTDRAM_TOTAL_SIZE=0
# CONFIG_MTD_ABSENT is not set
CONFIG_MTD_BLOCK=y
# CONFIG_MTD_BLOCK2MTD is not set
CONFIG_MTD_CFI=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_AMDSTD=y
# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
# CONFIG_MTD_CFI_GEOMETRY is not set
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_CFI_INTELEXT is not set
# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
CONFIG_MTD_CFI_NOSWAP=y
# CONFIG_MTD_CFI_STAA is not set
CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_CHAR=y
# CONFIG_MTD_CMDLINE_PARTS is not set
CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_CONCAT=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOC2001PLUS is not set
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_MAP_BANK_WIDTH_1=y
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
CONFIG_MTD_MAP_BANK_WIDTH_2=y
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
CONFIG_MTD_MTDRAM=y
# CONFIG_MTD_OBSOLETE_CHIPS is not set
# CONFIG_MTD_ONENAND is not set
# CONFIG_MTD_OTP is not set
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_PHYSMAP is not set
# CONFIG_MTD_PLATRAM is not set
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_OOM_REBOOT is not set
# CONFIG_OVERRIDE_SCHED_STARVATION_LIMIT is not set
# CONFIG_RTC is not set
CONFIG_RWSEM_GENERIC_SPINLOCK=y
# CONFIG_SERIAL_8250 is not set
# CONFIG_SMP is not set
# CONFIG_SOFT_WATCHDOG is not set
# CONFIG_SPARSEMEM_STATIC is not set
# CONFIG_SVINTO_SIM is not set
# CONFIG_SYSTEM_PROFILER is not set
CONFIG_UID16=y
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_UNWIND_INFO is not set
CONFIG_USB=y
# CONFIG_USBPCWATCHDOG is not set
# CONFIG_USB_ARCH_HAS_EHCI is not set
# CONFIG_USB_ARCH_HAS_HCD is not set
# CONFIG_USB_ARCH_HAS_OHCI is not set
# CONFIG_USB_SERIAL_IR is not set
# CONFIG_BLK_DEV_INITRD is not set

View File

@ -0,0 +1,262 @@
/*
* Simple bitbanged-GPIO SPI driver for ETRAX FS et al.
*
* Copyright (c) 2007 Axis Communications AB
*
* Author: Hans-Peter Nilsson, inspired by earlier work by
* Andre Spanberg but mostly by copying large parts of
* spi_s3c24xx_gpio.c, hence also:
* Copyright (c) 2006 Ben Dooks
* Copyright (c) 2006 Simtec Electronics
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/types.h>
#include <linux/device.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <asm/io.h>
#include <asm/arch/board.h>
/* Our main driver state. */
struct crisv32_spi_hw_info {
struct crisv32_iopin sclk;
struct crisv32_iopin mosi;
struct crisv32_iopin miso;
struct crisv32_iopin cs;
};
/*
* The driver state hides behind the spi_bitbang state. We're
* responsible for allocating that, so we can get a little something
* for ourselves.
*/
struct crisv32_spi_gpio_devdata {
struct spi_bitbang bitbang;
struct crisv32_spi_hw_info pins;
};
/* Helper function getting the driver state from a spi_device. */
static inline struct crisv32_spi_hw_info *spidev_to_hw(struct spi_device *spi)
{
struct crisv32_spi_gpio_devdata *dd = spi_master_get_devdata(spi->master);
return &dd->pins;
}
/* The SPI-bitbang functions: see spi_bitbang.h at EXPAND_BITBANG_TXRX. */
static inline void setsck(struct spi_device *spi, int is_on)
{
crisv32_io_set(&spidev_to_hw(spi)->sclk, is_on != 0);
}
static inline void setmosi(struct spi_device *spi, int is_on)
{
crisv32_io_set(&spidev_to_hw(spi)->mosi, is_on != 0);
}
static inline u32 getmiso(struct spi_device *spi)
{
return crisv32_io_rd(&spidev_to_hw(spi)->miso) != 0 ? 1 : 0;
}
#define spidelay(x) ndelay(x)
#define EXPAND_BITBANG_TXRX
#include <linux/spi/spi_bitbang.h>
/*
* SPI-bitbang word transmit-functions for the four SPI modes,
* dispatching to the inlined functions we just included.
*/
static u32 crisv32_spi_gpio_txrx_mode0(struct spi_device *spi,
unsigned nsecs, u32 word, u8 bits)
{
return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);
}
static u32 crisv32_spi_gpio_txrx_mode1(struct spi_device *spi,
unsigned nsecs, u32 word, u8 bits)
{
return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, bits);
}
static u32 crisv32_spi_gpio_txrx_mode2(struct spi_device *spi,
unsigned nsecs, u32 word, u8 bits)
{
return bitbang_txrx_be_cpha0(spi, nsecs, 1, word, bits);
}
static u32 crisv32_spi_gpio_txrx_mode3(struct spi_device *spi,
unsigned nsecs, u32 word, u8 bits)
{
return bitbang_txrx_be_cpha1(spi, nsecs, 1, word, bits);
}
/* SPI-bitbang chip-select function. */
static void crisv32_spi_gpio_chipselect(struct spi_device *spi, int value)
{
if (spi->mode & SPI_CS_HIGH)
crisv32_io_set(&spidev_to_hw(spi)->cs,
value == BITBANG_CS_ACTIVE ? 1 : 0);
else
crisv32_io_set(&spidev_to_hw(spi)->cs,
value == BITBANG_CS_ACTIVE ? 0 : 1);
}
/* Platform-device probe function. */
static int __devinit crisv32_spi_gpio_probe(struct platform_device *dev)
{
struct spi_master *master;
struct crisv32_spi_gpio_devdata *dd;
struct resource *res;
struct crisv32_spi_gpio_controller_data *gc;
int ret = 0;
/*
* We need to get the controller data as a hardware resource,
* or else it wouldn't be available until *after* the
* spi_bitbang_start call!
*/
res = platform_get_resource_byname(dev, 0, "controller_data_ptr");
if (res == NULL) {
dev_err(&dev->dev, "can't get controller_data resource\n");
return -EIO;
}
gc = (struct crisv32_spi_gpio_controller_data *) res->start;
master = spi_alloc_master(&dev->dev, sizeof *dd);
if (master == NULL) {
dev_err(&dev->dev, "failed to allocate spi master\n");
ret = -ENOMEM;
goto err;
}
dd = spi_master_get_devdata(master);
platform_set_drvdata(dev, dd);
/*
* The device data asks for this driver, and holds the id
* number, which must be unique among the same-type devices.
* We use this as the number of this SPI bus.
*/
master->bus_num = dev->id;
/*
* Allocate pins. Note that thus being allocated as GPIO, we
* don't have to deconfigure them at the end or if something
* fails.
*/
if ((ret = crisv32_io_get_name(&dd->pins.cs, gc->cs)) != 0
|| (ret = crisv32_io_get_name(&dd->pins.miso, gc->miso)) != 0
|| (ret = crisv32_io_get_name(&dd->pins.mosi, gc->mosi)) != 0
|| (ret = crisv32_io_get_name(&dd->pins.sclk, gc->sclk)) != 0)
goto err_no_pins;
/* Set directions of the SPI pins. */
crisv32_io_set_dir(&dd->pins.cs, crisv32_io_dir_out);
crisv32_io_set_dir(&dd->pins.sclk, crisv32_io_dir_out);
crisv32_io_set_dir(&dd->pins.miso, crisv32_io_dir_in);
crisv32_io_set_dir(&dd->pins.mosi, crisv32_io_dir_out);
/* Set state of the SPI pins. */
dev_dbg(&dev->dev, "cs.port 0x%x, pin: %d\n"
dd->pins.cs.port, dd->pins.cs.bit);
/*
* Can't use crisv32_spi_gpio_chipselect(spi, 1) here; we
* don't have a proper "spi" until after spi_bitbang_start.
*/
crisv32_io_set(&dd->pins.cs, 1);
crisv32_io_set(&dd->pins.sclk, 0);
crisv32_io_set(&dd->pins.mosi, 0);
/* Setup SPI bitbang adapter hooks. */
dd->bitbang.master = spi_master_get(master);
dd->bitbang.chipselect = crisv32_spi_gpio_chipselect;
dd->bitbang.txrx_word[SPI_MODE_0] = crisv32_spi_gpio_txrx_mode0;
dd->bitbang.txrx_word[SPI_MODE_1] = crisv32_spi_gpio_txrx_mode1;
dd->bitbang.txrx_word[SPI_MODE_2] = crisv32_spi_gpio_txrx_mode2;
dd->bitbang.txrx_word[SPI_MODE_3] = crisv32_spi_gpio_txrx_mode3;
ret = spi_bitbang_start(&dd->bitbang);
if (ret)
goto err_no_bitbang;
printk (KERN_INFO "CRIS v32 SPI driver for GPIO"
" (cs: %s, miso: %s, mosi: %s, sclk: %s)\n",
gc->cs, gc->miso, gc->mosi, gc->sclk);
return 0;
err_no_bitbang:
spi_master_put(dd->bitbang.master);
err_no_pins:
platform_set_drvdata(dev, NULL);
err:
return ret;
}
/* Platform-device remove-function. */
static int __devexit crisv32_spi_gpio_remove(struct platform_device *dev)
{
struct crisv32_spi_gpio_devdata *dd = platform_get_drvdata(dev);
int ret;
ret = spi_bitbang_stop(&dd->bitbang);
if (ret != 0)
return ret;
spi_master_put(dd->bitbang.master);
platform_set_drvdata(dev, NULL);
return 0;
}
/*
* For the time being, there's no suspend/resume support to care
* about, so we let those handlers default to NULL.
*/
static struct platform_driver crisv32_spi_gpio_drv = {
.probe = crisv32_spi_gpio_probe,
.remove = __devexit_p(crisv32_spi_gpio_remove),
.driver = {
.name = "spi_crisv32_gpio",
.owner = THIS_MODULE,
},
};
/* Module init function. */
static int __devinit crisv32_spi_gpio_init(void)
{
return platform_driver_register(&crisv32_spi_gpio_drv);
}
/* Module exit function. */
static void __devexit crisv32_spi_gpio_exit(void)
{
platform_driver_unregister(&crisv32_spi_gpio_drv);
}
module_init(crisv32_spi_gpio_init);
module_exit(crisv32_spi_gpio_exit);
MODULE_DESCRIPTION("CRIS v32 SPI-GPIO Driver");
MODULE_AUTHOR("Hans-Peter Nilsson, <hp@axis.com>");
MODULE_LICENSE("GPL");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,141 @@
/* macros for debug output */
#define hcd_dbg(hcd, fmt, args...) \
dev_info(hcd->self.controller, fmt, ## args)
#define hcd_err(hcd, fmt, args...) \
dev_err(hcd->self.controller, fmt, ## args)
#define hcd_info(hcd, fmt, args...) \
dev_info(hcd->self.controller, fmt, ## args)
#define hcd_warn(hcd, fmt, args...) \
dev_warn(hcd->self.controller, fmt, ## args)
/*
#define devdrv_dbg(fmt, args...) \
printk(KERN_INFO "usb_devdrv dbg: ");printk(fmt, ## args)
*/
#define devdrv_dbg(fmt, args...) {}
#define devdrv_err(fmt, args...) \
printk(KERN_ERR "usb_devdrv error: ");printk(fmt, ## args)
#define devdrv_info(fmt, args...) \
printk(KERN_INFO "usb_devdrv: ");printk(fmt, ## args)
#define irq_dbg(fmt, args...) \
printk(KERN_INFO "crisv10_irq dbg: ");printk(fmt, ## args)
#define irq_err(fmt, args...) \
printk(KERN_ERR "crisv10_irq error: ");printk(fmt, ## args)
#define irq_warn(fmt, args...) \
printk(KERN_INFO "crisv10_irq warn: ");printk(fmt, ## args)
#define irq_info(fmt, args...) \
printk(KERN_INFO "crisv10_hcd: ");printk(fmt, ## args)
/*
#define rh_dbg(fmt, args...) \
printk(KERN_DEBUG "crisv10_rh dbg: ");printk(fmt, ## args)
*/
#define rh_dbg(fmt, args...) {}
#define rh_err(fmt, args...) \
printk(KERN_ERR "crisv10_rh error: ");printk(fmt, ## args)
#define rh_warn(fmt, args...) \
printk(KERN_INFO "crisv10_rh warning: ");printk(fmt, ## args)
#define rh_info(fmt, args...) \
printk(KERN_INFO "crisv10_rh: ");printk(fmt, ## args)
/*
#define tc_dbg(fmt, args...) \
printk(KERN_INFO "crisv10_tc dbg: ");printk(fmt, ## args)
*/
#define tc_dbg(fmt, args...) {while(0){}}
#define tc_err(fmt, args...) \
printk(KERN_ERR "crisv10_tc error: ");printk(fmt, ## args)
/*
#define tc_warn(fmt, args...) \
printk(KERN_INFO "crisv10_tc warning: ");printk(fmt, ## args)
*/
#define tc_warn(fmt, args...) {while(0){}}
#define tc_info(fmt, args...) \
printk(KERN_INFO "crisv10_tc: ");printk(fmt, ## args)
/* Debug print-outs for various traffic types */
#define intr_warn(fmt, args...) \
printk(KERN_INFO "crisv10_intr warning: ");printk(fmt, ## args)
/*
#define intr_dbg(fmt, args...) \
printk(KERN_DEBUG "crisv10_intr dbg: ");printk(fmt, ## args)
*/
#define intr_dbg(fmt, args...) {while(0){}}
#define isoc_err(fmt, args...) \
printk(KERN_ERR "crisv10_isoc error: ");printk(fmt, ## args)
/*
#define isoc_warn(fmt, args...) \
printk(KERN_INFO "crisv10_isoc warning: ");printk(fmt, ## args)
*/
#define isoc_warn(fmt, args...) {while(0){}}
/*
#define isoc_dbg(fmt, args...) \
printk(KERN_INFO "crisv10_isoc dbg: ");printk(fmt, ## args)
*/
#define isoc_dbg(fmt, args...) {while(0){}}
/*
#define timer_warn(fmt, args...) \
printk(KERN_INFO "crisv10_timer warning: ");printk(fmt, ## args)
*/
#define timer_warn(fmt, args...) {while(0){}}
/*
#define timer_dbg(fmt, args...) \
printk(KERN_INFO "crisv10_timer dbg: ");printk(fmt, ## args)
*/
#define timer_dbg(fmt, args...) {while(0){}}
/* Debug printouts for events related to late finishing of URBs */
/*
#define late_dbg(fmt, args...) \
printk(KERN_INFO "crisv10_late dbg: ");printk(fmt, ## args)
*/
#define late_dbg(fmt, args...) {while(0){}}
#define late_warn(fmt, args...) \
printk(KERN_INFO "crisv10_late warning: ");printk(fmt, ## args)
/*
#define errno_dbg(fmt, args...) \
printk(KERN_INFO "crisv10_errno dbg: ");printk(fmt, ## args)
*/
#define errno_dbg(fmt, args...) {while(0){}}
#define dma_dbg(fmt, args...) \
printk(KERN_INFO "crisv10_dma dbg: ");printk(fmt, ## args)
#define dma_err(fmt, args...) \
printk(KERN_ERR "crisv10_dma error: ");printk(fmt, ## args)
#define dma_warn(fmt, args...) \
printk(KERN_INFO "crisv10_dma warning: ");printk(fmt, ## args)
#define dma_info(fmt, args...) \
printk(KERN_INFO "crisv10_dma: ");printk(fmt, ## args)
#define str_dir(pipe) \
(usb_pipeout(pipe) ? "out" : "in")
#define str_type(pipe) \
({ \
char *s = "?"; \
switch (usb_pipetype(pipe)) { \
case PIPE_ISOCHRONOUS: s = "iso"; break; \
case PIPE_INTERRUPT: s = "intr"; break; \
case PIPE_CONTROL: s = "ctrl"; break; \
case PIPE_BULK: s = "bulk"; break; \
}; \
s; \
})

View File

@ -0,0 +1,10 @@
#ifndef __MTD_MTDRAM_H__
#define __MTD_MTDRAM_H__
#ifdef __KERNEL__
#include <linux/mtd/mtd.h>
int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
unsigned long size, char *name);
#endif /* __KERNEL__ */
#endif /* __MTD_MTDRAM_H__ */

View File

@ -0,0 +1,5 @@
config AXIS_FIMAGE
bool "Build fimage"
depends LINUX_2_6_ETRAX
default y

View File

@ -0,0 +1,55 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
FOXBOARD:=custom MCM 416 816 832
FOXBOARD_4MB:=MCM 416
FOXBOARD_8MB:=custom 816 832
define Image/BuildKernel
for f in $(FOXBOARD); do \
cp $(KDIR)/vmlinuz_$$$$f $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-zImage_$$$$f; \
done
endef
define Image/Prepare
for f in $(FOXBOARD); do \
cp $(LINUX_DIR)/arch/cris/boot/zImage_$$$$f $(KDIR)/vmlinuz_$$$$f; \
done
$(MAKE) -C ./e100boot/
$(MAKE) -C ./mkfimage/
$(INSTALL_BIN) ./boot_linux $(BIN_DIR)
endef
define Image/Build/generic
for f in $(2); do \
mkfimage $(KDIR)/vmlinuz_$$$$f $(KDIR)/vmlinuz_$$$$f.tmp ; \
cat $(KDIR)/vmlinuz_$$$$f.tmp $(KDIR)/root.$(1) > $(KDIR)/fimage.$(1)_$$$$f.tmp; \
dd if=$(KDIR)/fimage.$(1)_$$$$f.tmp of=$(KDIR)/fimage.$(1)_$$$$f bs=$(3) conv=sync; \
cp $(KDIR)/fimage.$(1)_$$$$f $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-fimage_$$$$f; \
done
endef
define Image/Build/jffs2-64k
$(call prepare_generic_jffs-64k,$(KDIR)/root.jff2-64k)
$(call Image/Build/generic,$(1),$(FOXBOARD_4MB),4194304)
$(call Image/Build/generic,$(1),$(FOXBOARD_8MB),8388608)
endef
define Image/Build/squashfs
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
$(call Image/Build/generic,$(1),$(FOXBOARD_4MB),4194304)
$(call Image/Build/generic,$(1),$(FOXBOARD_8MB),8388608)
endef
define Image/Build
$(call Image/Build/$(1),$(1))
endef
$(eval $(call BuildImage))

View File

@ -0,0 +1,512 @@
#!/usr/bin/perl -w
#*****************************************************************************
#!
#! FILE NAME : boot_linux
#!
#! PARAMETERS : -b <bootimage> the name of the boot image to use
#! -d <device> the interface to use, e.g., eth1
#! (defaults is eth0)
#! -f save it in flash memory at address 0x10000
#! -F save it in flash memory at address 0
#! -h show some help
#! -i <image> name of the image to use (default is fimage)
#! -o <offset> the offset in the flash where the flashing
#! starts
#! -O <offset> the offset in the image file where the
#! flashing starts from
#! -p print the resulting etrax100boot command
#! instead of executing it
#! -s <size> how much to flash (default is the size of
#! the flash minus the offset specified using
#! -o or -f)
#! -S <size> the size of the flash
#!
#! All sizes and offsets above can be specified as decimal
#! numbers, or as hexadecimal numbers by prefixing them with 0x.
#! It is also possible to use the suffixes k and M to specify
#! kilo (1024) or mega (1048576).
#!
#! DESCRIPTION: Extract the start of the image and any registers that should
#! be set from the kimage or fimage file, and then boot it.
#!
#! FUNCTIONS : convert_size
#! extract_hw_settings
#! get_dword
#! calculate_sdram_init
#! sdram_command
#! print_help
#!
#!----------------------------------------------------------------------------
#! HISTORY
#!
#! $Log: boot_linux,v $
#! Revision 1.16 2004/11/01 16:32:27 starvik
#! Corrected help text to avoid confusion
#!
#! Revision 1.15 2003/01/29 11:48:57 pkj
#! Calculate a flash size large enough for the given image if the
#! -S option is not specified.
#!
#! Revision 1.14 2002/11/18 14:40:09 pkj
#! Make use of the --loop option to etrax100boot when initialising
#! SDRAM memories. This requires a lot fewer options to be passed
#! to the boot loader.
#!
#! Revision 1.13 2002/08/15 16:29:02 pkj
#! * The -S option now accepts the size in bytes (just like the -s option).
#! For backwards compatibility it still assumes sizes of 16 and less to
#! be specified in MB.
#! * The suffixes k and M can now be used with all sizes and offsets to
#! specify them in kilo or mega.
#!
#! Revision 1.12 2002/08/15 15:27:34 pkj
#! Use $opts{'x'} instead of $opt_x.
#!
#! Revision 1.11 2002/07/04 17:06:39 pkj
#! * No longer specifies a bootfile by default (not needed any longer).
#! * Implemented option -b to specify a bootfile.
#! * Removed references to option -l (it was never implemented).
#!
#! Revision 1.10 2002/06/04 11:50:23 starvik
#! Check if mrs_data is specified in kernelconfig (necessary for MCM)
#!
#! Revision 1.9 2002/01/29 10:38:26 pkj
#! Change illegal to invalid.
#!
#! Revision 1.8 2001/09/13 12:32:10 pkj
#! * Added option -S to specify the size of the flash (in MB), as -s
#! is used to specify how much to flash nowadays.
#! * Made the default size of the flash depend on the size of the image
#! file. If it is bigger than 0x200100 then the flash is assumed to
#! be 4 MB, otherwise it is assumed to be 2 MB.
#! * Added verification of various options.
#!
#! Revision 1.7 2001/09/13 10:25:11 pkj
#! Minor clean-up.
#!
#! Revision 1.6 2001/06/29 10:05:16 pkj
#! Corrected check for SDRAM.
#!
#! Revision 1.5 2001/06/29 09:11:55 pkj
#! Synchronised boot_elinux and boot_linux.
#!
#!----------------------------------------------------------------------------
#! (C) Copyright 2001, Axis Communications AB, LUND, SWEDEN
#!****************************************************************************
# $Id: boot_linux,v 1.16 2004/11/01 16:32:27 starvik Exp $
#****************** INCLUDE FILES SECTION ************************************
use strict;
use Getopt::Std;
use File::Basename;
#****************** VARIABLE DECLARATION SECTION *****************************
use vars qw($my_name %opts);
use vars qw($text_start $cmd);
use vars qw($image_name $image_size);
use vars qw($offset $source_offset $flash_size $flashing_size);
use vars qw($sdram_timing_address $sdram_config_address);
use vars qw($sdram_precharge $sdram_nop $sdram_refresh $sdram_mrs);
#****************** CONSTANT SECTION *****************************************
# Register addresses
$sdram_timing_address = "b0000008";
$sdram_config_address = "b000000c";
# SDRAM commands
$sdram_precharge = 3;
$sdram_nop = 0;
$sdram_refresh = 2;
$sdram_mrs = 1;
#****************** MAIN PROGRAM SECTION *************************************
# The name of this program.
$my_name = basename($0);
# Get options
getopts('b:d:fFhi:o:O:ps:S:', \%opts);
&print_help if ($opts{'h'});
# Name and existance of the image
$image_name = ($opts{'i'} ? $opts{'i'} : 'fimage');
die "Could not find the image $image_name!\n" unless (-s $image_name);
if ($opts{'f'} || $opts{'F'})
{
$image_size = -s $image_name;
$offset = ($opts{'f'} ? 0x10000 : 0);
$offset = &convert_size($opts{'o'}) if (defined($opts{'o'}));
die("$my_name: Invalid destination offset\n") if ($offset !~ /^\d+$/);
my $base_name = basename($image_name);
if ($base_name eq 'timage' || $base_name eq 'flash1.img')
{
$source_offset = 0;
}
else
{
$source_offset = $offset;
}
$source_offset = &convert_size($opts{'O'}) if (defined($opts{'O'}));
die("$my_name: Invalid source offset\n") if ($source_offset !~ /^\d+$/);
die("$my_name: Source offset > image size\n") if ($source_offset > $image_size);
if (defined($opts{'S'}))
{
# Backwards compatibility to allow specifying the flash size in MB
# without using an M suffix
$opts{'S'} .= 'M' if ($opts{'S'} =~ /^\d+$/ && $opts{'S'} <= 16);
$flash_size = &convert_size($opts{'S'});
}
else
{
# Calculate a flash size large enough for the image without the checksum
# and HWID.
$flash_size = ($image_size - $source_offset + $offset) & 0xFFFF0000;
}
die("$my_name: Invalid flash size\n") if ($flash_size !~ /^\d+$/);
die("$my_name: Destination offset > flash size\n") if ($offset > $flash_size);
if (defined($opts{'s'}))
{
$flashing_size = &convert_size($opts{'s'});
}
else
{
$flashing_size = $flash_size - $offset;
}
die("$my_name: Invalid size to flash\n") if ($flashing_size !~ /^\d+$/);
if ($flashing_size > $flash_size - $offset)
{
$flashing_size = $flash_size - $offset;
printf("Warning: Flashing size limited to 0x%lx due to the offset (0x%lx) and flash size (0x%lx).\n", $flashing_size, $offset, $flash_size);
}
if ($flashing_size > $image_size - $source_offset)
{
$flashing_size = $image_size - $source_offset;
printf("Warning: Flashing size limited to 0x%lx due to the offset (0x%lx) and image size (0x%lx).\n", $flashing_size, $source_offset, $image_size);
}
}
# Create the command line to boot the image
if (system('./etrax100boot --help > /dev/null') == 0)
{
$cmd = './etrax100boot';
}
elsif (system('svinto_boot --help > /dev/null') == 0)
{
$cmd = 'svinto_boot';
}
else
{
die("Cannot find e100boot program in your PATH!\n");
}
$cmd .= " --device $opts{'d'}" if ($opts{'d'});
$cmd .= &extract_hw_settings;
$cmd .= " --bootfile $opts{'b'}" if ($opts{'b'});
$cmd .= " --file $image_name $text_start";
if ($opts{'f'} || $opts{'F'})
{
$cmd .= sprintf(" --flash %lx %lx %lx --jump 0",
hex($text_start) + $source_offset, $offset, $flashing_size);
}
else
{
$cmd .= " --jump $text_start";
}
if ($opts{'p'})
{
print "Command:\n$cmd\n";
}
else
{
system($cmd);
}
exit 0;
#****************** FUNCTION DEFINITION SECTION ******************************
#*****************************************************************************
##
## FUNCTION NAME: convert_size
##
##****************************************************************************
sub convert_size
{
my($arg) = @_;
my $size;
if ($arg =~ /^0x([\da-fA-F]+)([kM])?$/)
{
$size = hex($1);
}
elsif ($arg =~ /^(\d+)([kM])?$/)
{
$size = $1;
}
else
{
return -1;
}
if (!defined($2))
{
return $size;
}
elsif ($2 eq 'k')
{
return $size * 1024;
}
elsif ($2 eq 'M')
{
return $size * 1048576;
}
}
#*****************************************************************************
##
## FUNCTION NAME: extract_hw_settings
##
##****************************************************************************
sub extract_hw_settings
{
my $data;
my $dbg_port;
my $sdram_enabled;
my $return_value = "";
my $sdram_config;
# The hw information table has the following format
#
# "HW_PARAM_MAGIC"
# text_start (dword)
# serial debg port (dword)
# sdram enabled (dword)
# register address (dword)
# register value (dword)
# ...
# 0
open(FILE, "$image_name") || die("Could not open '$image_name'");
while (<FILE>)
{
if (m/HW_PARAM_MAGIC/g)
{
# Seek to first byte after magic
seek(FILE, -length($_) + pos($_), 1);
last;
}
}
$text_start = &get_dword;
$dbg_port = &get_dword;
$sdram_enabled = int(&get_dword);
while (1)
{
my $register = &get_dword;
my $value = &get_dword;
last if ($register eq "00000000");
if ($sdram_enabled)
{
if ($register eq $sdram_config_address)
{
$sdram_config = $value;
}
elsif ($register eq $sdram_timing_address)
{
$return_value .= &calculate_sdram_init($value, $sdram_config);
next;
}
}
$return_value .= " --setreg $register $value";
}
close(FILE);
return $return_value;
}
#*****************************************************************************
##
## FUNCTION NAME: get_dword
##
##****************************************************************************
sub get_dword
{
my $data;
read(FILE, $data, 4);
return unpack("H8", pack("V", unpack("N", $data)));
}
#*****************************************************************************
##
## FUNCTION NAME: calculate_sdram_init
##
##****************************************************************************
sub calculate_sdram_init
{
# Refer to ETRAX 100LX Designers Reference for a description of SDRAM
# initialization
my $sdram_init_val = hex($_[0]);
my $sdram_config_val = hex($_[1]);
my $bus_width = $sdram_config_val & 0x00800000;
my $speed;
my $cas_latency;
my $mrs_data;
my $temp;
my $return_value;
my $value;
$mrs_data = ($sdram_init_val & 0x00ff0000) >> 16;
$sdram_init_val &= 0x8000ffff; # Make sure mrs data is 0
$sdram_init_val |= 0x80000000; # Make sure sdram is enabled
$speed = $sdram_init_val & 0x1000;
$cas_latency = $sdram_init_val & 0x3;
if ($speed) # 100 MHz
{
$cas_latency += 2;
}
else # 50 MHz
{
$cas_latency += 1;
}
# Calculate value of mrs_data
# CAS latency = 2 && bus_width = 32 => 0x40
# CAS latency = 3 && bus_width = 32 => 0x60
# CAS latency = 2 && bus_width = 16 => 0x20
# CAS latency = 3 && bus_width = 16 => 0x30
if ($mrs_data == 0)
{
if ($bus_width == 0) # 16 bits
{
$mrs_data = $cas_latency == 2 ? 0x20 : 0x30;
}
else # 32 bits
{
$mrs_data = $cas_latency == 2 ? 0x40 : 0x60;
}
}
$temp = $sdram_init_val | 0x0000c000; # Disable refresh
$return_value .= &sdram_command($temp);
$return_value .= " --pause 20000";
$return_value .= &sdram_command($temp, $sdram_precharge);
$return_value .= &sdram_command($temp, $sdram_nop);
$return_value .= " --setreg +0 7";
$return_value .= " --label label1";
$return_value .= &sdram_command($temp, $sdram_refresh);
$return_value .= &sdram_command($temp, $sdram_nop);
$return_value .= " --loop +0 label1";
$return_value .= &sdram_command($temp, $sdram_mrs, $mrs_data);
$return_value .= &sdram_command($temp, $sdram_nop);
$return_value .= &sdram_command($sdram_init_val);
return $return_value;
}
#*****************************************************************************
##
## FUNCTION NAME: sdram_command
##
##****************************************************************************
sub sdram_command
{
my($temp, $value, $mrs_data) = @_;
$value ||= 0;
if ($value == $sdram_mrs)
{
$value = sprintf("%lx", $temp | ($value << 9) | ($mrs_data << 16));
}
else
{
$value = sprintf("%lx", $temp | ($value << 9));
}
return " --setreg $sdram_timing_address $value";
}
#*****************************************************************************
##
## FUNCTION NAME: print_help
##
##****************************************************************************
sub print_help
{
print "\nAXIS $my_name, ", '$Revision: 1.16 $ $Date: 2004/11/01 16:32:27 $ ', "\n";
die <<EOT;
Copyright (C) 2001-2002 Axis Communications AB
DESCRIPTION:
This program is used to boot (and flash) a linux image to a box.
It tries to extract the required ETRAX 100 settings from the image file.
SYNTAX:
$my_name [options]
OPTIONS:
-b <bootfile> : The boot image to use.
-d <device> : The network interface to use, default is eth0.
-f : Save the image in the flash memory starting at
address 0x10000.
-F : Save the image in the flash memory starting at
address 0.
-h : Print this help text.
-i <image> : The path and name of the image to use, default
is fimage.
-o <offset> : The offset in the flash where the flashing starts.
-O <offset> : The offset in the image file where the flashing
starts from.
-p : Print the resulting etrax100boot command instead
of executing it.
-s <size> : How much to flash (default is the size of the
flash minus the offset specified using -o or -f).
-S <size> : The size of the flash.
All sizes and offsets above can be specified as decimal numbers, or as
hexadecimal numbers by prefixing them with 0x. It is also possible to use
the suffixes k and M to specify kilo (1024) or mega (1048576).
EOT
}
#****************** END OF FILE boot_linux ***********************************

View File

@ -0,0 +1,32 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=e100boot
PKG_VERSION:=0.1
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
CRLF_WORKAROUND=1
include $(INCLUDE_DIR)/package.mk
define Build/Compile
mkdir -p $(PKG_BUILD_DIR)
cp -r ./src/* $(PKG_BUILD_DIR)
make -C $(PKG_BUILD_DIR)
endef
define Build/InstallDev
$(INSTALL_BIN) $(PKG_BUILD_DIR)/sbl/e100boot $(BIN_DIR)/etrax100boot
endef
$(eval $(call Build/DefaultTargets))

View File

@ -0,0 +1,26 @@
Copyright (c) 2004, 2005 Axis Communications AB. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Axis Communications AB nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY AXIS COMMUNCATIONS AB ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

View File

@ -0,0 +1,70 @@
#
# Top Makefile for e100boot
# $Id: Makefile,v 1.20 2003/06/04 12:22:23 pkj Exp $
#
# Change these paths if necessary. Can also be specified on cmdline as
# 'make INSTALL_PATH=/foo/bar/'.
INSTALL_NAME = e100boot
INSTALL_PATH = /usr/local
INSTALL_PATH_BIN = $(INSTALL_PATH)/bin
INSTALL_PATH_DOC = $(INSTALL_PATH)/man/man1
DIRS = libpcap-0.4 sbl doc
-include $(AXIS_TOP_DIR)/tools/build/Rules.axis
ifdef prefix
INSTALL_PATH = $(prefix)
endif
INSTALL ?= install
all: conf $(DIRS)
@for d in $(DIRS); do \
echo -e "\n### Making $$d"; \
$(MAKE) -C $$d || exit; \
done
conf: $(DIRS)
@for d in $(DIRS); do \
if [ -x $$d/configure ] && [ ! -e $$d/Makefile ]; then \
echo -e "\n### Configuring $$d"; \
cd $$d; ./configure || exit; cd ..; \
fi; \
done
tar: clean
@echo -e "\n### Making tarball."
tar -C ../ -zcf e100boot.tgz --exclude e100boot.tgz --exclude RCS --exclude CVS e100boot
install: all
$(INSTALL) -d $(INSTALL_PATH_BIN) $(INSTALL_PATH_DOC)
$(INSTALL) sbl/e100boot.stripped $(INSTALL_PATH_BIN)/$(INSTALL_NAME)
$(INSTALL) -m 0644 doc/e100boot.1 $(INSTALL_PATH_DOC)/$(INSTALL_NAME).1
install.setuid:
@echo -e "\n### Make install.setuid"; \
if ! [ -e $(INSTALL_PATH_BIN)/$(INSTALL_NAME) ]; then \
echo -e "\n### Binary $(INSTALL_PATH_BIN)/$(INSTALL_NAME) does not exist! Make install first."; \
elif [ `id -u` = 0 ]; then \
chown root.root $(INSTALL_PATH_BIN)/$(INSTALL_NAME); \
chmod +s $(INSTALL_PATH_BIN)/$(INSTALL_NAME); \
else \
echo "### You must do this as root!"; \
fi
clean:
@for d in $(DIRS); do \
if [ -e $$d/Makefile ]; then \
echo -e "\n### Cleaning $$d"; \
$(MAKE) -C $$d clean || exit; \
fi; \
done
configsubs: conf configsubs-dirs
configsubs-dirs:
$(MAKE) -C libpcap-0.4 configsubs
$(MAKE) -C sbl configsubs

View File

@ -0,0 +1,25 @@
#
# Makefile to generate .ima files for e100boot
#
# Hacked by ronny, rehacked by ronny
#
# $Id: Makefile,v 1.26 2003/03/13 14:18:31 cii Exp $
#
DIRS := net net_noleds ser ser_noleds
all: $(DIRS)
@for d in $(DIRS); do \
echo -e "\n### Making $$d"; \
make -C $$d || exit; \
done
@echo "***************************************************************"
@./free_size
@echo "***************************************************************"
clean:
rm -f *.ima
@for d in $(DIRS); do \
echo -e "\n### Cleaning $$d"; \
make -C $$d clean || exit; \
done;

View File

@ -0,0 +1,42 @@
#!/bin/sh
#
# Calculates the size left in ETRAX cache when bootloader is loaded.
#
BOOT_FILE=`dirname $0`/net/net.out
HEADER_FILE=`dirname $0`/src/e100boot.h
for FILE in $BOOT_FILE $HEADER_FILE; do
if [ ! -f $FILE ]; then
echo "Could not find the file \"$FILE\"!"
exit 1
fi
done
# The cache size is given in hex
CACHE_SIZE=2000
BSS_SIZE=`nm-cris $BOOT_FILE | grep Ebss | cut -d ' ' -f 1 | tr a-f A-F`
TEXT_SIZE=`nm-cris $BOOT_FILE | grep Stext | cut -d ' ' -f 1 | tr a-f A-F`
IO_BUF_END=`grep IO_BUF_END $HEADER_FILE | awk '{ print $3 }' | \
cut -d x -f 2 | tr a-f A-F`
IO_BUF_START=`grep IO_BUF_START $HEADER_FILE | awk '{ print $3 }' | \
cut -d x -f 2 | tr a-f A-F`
FREE_SIZE=`echo "ibase=16 ; \
$CACHE_SIZE - \
($BSS_SIZE - $TEXT_SIZE + $IO_BUF_END - $IO_BUF_START)" | \
bc`
echo "Free cache size when cbl is loaded will be:"
echo -e "\t$FREE_SIZE bytes - size of stack"
if [ $FREE_SIZE -lt 0 ]; then
echo "Bootloader is too large! You will have to do some optimizing..."
exit 1
fi
exit 0

View File

@ -0,0 +1,6 @@
#
# $Id: Makefile,v 1.1 2002/07/01 14:36:40 pkj Exp $
#
IMAGE := net.ima
include ../rules.cbl

View File

@ -0,0 +1,3 @@
common.o: ../src/common.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1,3 @@
common_init.o: ../src/common_init.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1 @@
crt0.o: ../src/crt0.S

View File

@ -0,0 +1 @@
char e100boot_version[] = "This bootloader was built by root on Wed May 16 21:31:41 CEST 2007.\r\n";

View File

@ -0,0 +1 @@
e100boot_version.o: e100boot_version.c

View File

@ -0,0 +1 @@
flash.o: ../src/flash.c ../src/e100boot.h ../src/compiler.h

View File

@ -0,0 +1,2 @@
hwregs.o: ../src/hwregs.c ../src/compiler.h ../src/hwregs.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h

View File

@ -0,0 +1,2 @@
net_init.o: ../src/net_init.c ../src/sv_addr_ag.h ../src/sv_addr.agh \
../src/e100boot.h ../src/compiler.h

View File

@ -0,0 +1,6 @@
#
# $Id: Makefile,v 1.1 2002/07/01 14:36:51 pkj Exp $
#
IMAGE := net_noleds.ima
include ../rules.cbl

View File

@ -0,0 +1,3 @@
common.o: ../src/common.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1,3 @@
common_init.o: ../src/common_init.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1 @@
crt0.o: ../src/crt0.S

View File

@ -0,0 +1 @@
char e100boot_version[] = "This bootloader was built by root on Wed May 16 21:31:43 CEST 2007.\r\n";

View File

@ -0,0 +1 @@
e100boot_version.o: e100boot_version.c

View File

@ -0,0 +1 @@
flash.o: ../src/flash.c ../src/e100boot.h ../src/compiler.h

View File

@ -0,0 +1,2 @@
hwregs.o: ../src/hwregs.c ../src/compiler.h ../src/hwregs.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h

View File

@ -0,0 +1,2 @@
net_init.o: ../src/net_init.c ../src/sv_addr_ag.h ../src/sv_addr.agh \
../src/e100boot.h ../src/compiler.h

View File

@ -0,0 +1,55 @@
#
# $Id: rules.cbl,v 1.4 2005/04/20 11:18:54 starvik Exp $
#
VPATH := .:../src
ifeq ($(findstring _noleds,$(IMAGE)),_noleds)
USE_LEDS := 0
else
USE_LEDS := 1
endif
MAKEFLAGS := r
INCS := -I.
DEFS := -DUSE_LEDS=$(USE_LEDS)
CFLAGS := -Os -Wall -Wmissing-prototypes -W -Wa,-N -nostdinc $(INCS) $(DEFS) -MMD
ASFLAGS := $(CFLAGS)
LNFLAGS := -Wl,--section-start,.startup=0x380000f0 -nostdlib -Os -Wl,-T../src/ldscript
CC := cris-axis-elf-gcc
OUT := $(patsubst %.ima,%.out,$(IMAGE))
OBJS = crt0.o common_init.o
ifeq ($(findstring net,$(IMAGE)),net)
OBJS += net_init.o
else
OBJS += ser_init.o
endif
OBJS += common.o flash.o hwregs.o e100boot_version.o
all: ../$(IMAGE)
$(OUT): $(OBJS) ldscript
$(CC) -o $@ $(LNFLAGS) $(OBJS)
../%.ima: %.out
bin-cris -o $@ $<
@find $@ -printf '# Size of image $@ is %s bytes.\n\n'
$(OBJS): ../rules.cbl Makefile
# We don't want this to be a dummy and be recreated every time we build,
# only after a make clean
e100boot_version.c:
@echo "Generating version file....."
@echo 'char e100boot_version[] = "This bootloader was built by '`id -u -n`' on '`date`'.\r\n";' > $@
dummy:
clean:
rm -rf *.o *.d *.out *.ima deps e100boot_version.c
ifneq ($(MAKECMDGOALS),clean)
-include *.d
endif

Binary file not shown.

View File

@ -0,0 +1,6 @@
#
# $Id: Makefile,v 1.1 2002/07/01 14:37:01 pkj Exp $
#
IMAGE := ser.ima
include ../rules.cbl

View File

@ -0,0 +1,3 @@
common.o: ../src/common.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1,3 @@
common_init.o: ../src/common_init.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1 @@
crt0.o: ../src/crt0.S

View File

@ -0,0 +1 @@
char e100boot_version[] = "This bootloader was built by root on Wed May 16 21:31:44 CEST 2007.\r\n";

View File

@ -0,0 +1 @@
e100boot_version.o: e100boot_version.c

View File

@ -0,0 +1 @@
flash.o: ../src/flash.c ../src/e100boot.h ../src/compiler.h

View File

@ -0,0 +1,2 @@
hwregs.o: ../src/hwregs.c ../src/compiler.h ../src/hwregs.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h

Binary file not shown.

View File

@ -0,0 +1,3 @@
ser_init.o: ../src/ser_init.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/sv_addr_ag.h ../src/sv_addr.agh ../src/e100boot.h

View File

@ -0,0 +1,6 @@
#
# $Id: Makefile,v 1.1 2002/07/01 14:37:10 pkj Exp $
#
IMAGE := ser_noleds.ima
include ../rules.cbl

View File

@ -0,0 +1,3 @@
common.o: ../src/common.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1,3 @@
common_init.o: ../src/common_init.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/e100boot.h

View File

@ -0,0 +1 @@
crt0.o: ../src/crt0.S

View File

@ -0,0 +1 @@
char e100boot_version[] = "This bootloader was built by root on Wed May 16 21:31:46 CEST 2007.\r\n";

View File

@ -0,0 +1 @@
e100boot_version.o: e100boot_version.c

View File

@ -0,0 +1 @@
flash.o: ../src/flash.c ../src/e100boot.h ../src/compiler.h

View File

@ -0,0 +1,2 @@
hwregs.o: ../src/hwregs.c ../src/compiler.h ../src/hwregs.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h

View File

@ -0,0 +1,3 @@
ser_init.o: ../src/ser_init.c ../src/hwregs.h ../src/compiler.h \
../src/debug.h ../src/project.h ../src/hwregs_def.h ../src/hwregs_int.h \
../src/sv_addr_ag.h ../src/sv_addr.agh ../src/e100boot.h

View File

@ -0,0 +1,486 @@
#include "hwregs.h"
#include "e100boot.h"
static void toggle_led(void);
static void read_load_info(void);
static void decode_load_info(void);
static void read_file(byte* addr, udword size);
#if USE_PRINT_DESCR
static void print_descr(dma_descr_T *d);
#endif
static int memory_test(udword addr, udword size, udword *failed_address);
static void memory_dump(udword *from, udword *to);
extern byte _Stext[];
extern byte _Edata[];
#ifdef USE_BAUDRATE_CHANGING
byte change_baudrate;
udword new_baudrate;
#endif
void
level2_boot(void)
{
#if USE_LEDS
REG_SET(R_PORT_PA_DATA, data_out, 0xaa);
#endif
#if 0
io_buf_next = (byte*)IO_BUF_START;
io_buf_cur = (byte*)IO_BUF_START;
#endif
#if 1
send_string("\r\n\r\nDevice ID = ");
send_hex(ntohl(tx_header.id), NL);
send_string(e100boot_version);
#endif
#if 1
{
udword sum = 0;
byte *b;
for (b = (byte*)_Stext; b != (byte*)_Edata; b++) {
sum += *b;
}
send_string("Checksum of bootloader is ");
send_hex(sum, NL);
}
#endif
read_load_info();
__asm__ volatile ("jump _start");
}
void
toggle_led(void)
{
#if USE_LEDS
REG_SET(R_PORT_PA_DATA, data_out, 0x55);
while (1) {
REG_SET(R_PORT_PA_DATA, data_out, ~REG_GET(R_PORT_PA_READ, data_in));
{
volatile udword i;
for (i = 0; i != 2000000; i++)
;
}
}
#else
while (1) {
}
#endif
}
void
read_load_info(void)
{
#ifdef USE_BAUDRATE_CHANGING
change_baudrate = 0;
#endif
send_string("Waiting for load info.\r\n");
send_ack();
read_file((byte*)IO_BUF_START, IO_BUF_END - IO_BUF_START - CRC_LEN);
send_string("Got load info.\r\n");
decode_load_info();
#ifdef USE_BAUDRATE_CHANGING
if (change_baudrate) {
REG_WR(R_SERIAL0_BAUD, new_baudrate);
{
udword i = 0;
while (i++ < 1000000)
;
}
send_ack();
}
#endif
toggle_led();
}
void
decode_load_info(void)
{
udword *type_p = (udword*)IO_BUF_START;
udword failed_address;
udword i;
command_T *cmd;
while (type_p != (udword*)(IO_BUF_END - CRC_LEN)) { /* !!! */
// send_hex(type_p, NL);
*type_p = ntohl(*type_p);
// send_hex(*type_p, NL);
type_p++;
}
// memory_dump(IO_BUF_START, IO_BUF_END);
cmd = (command_T*)IO_BUF_START;
while (cmd->type) {
switch (cmd->type) {
case PACKET_INFO:
send_string("PACKET_INFO\r\n");
send_hex(cmd->args.packet_info.addr, NL);
send_hex(cmd->args.packet_info.size, NL);
seq--;
send_ack();
seq++;
read_file((byte*)cmd->args.packet_info.addr, cmd->args.packet_info.size);
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.packet_info;
break;
case SET_REGISTER:
send_string("SET_REGISTER\r\n");
send_hex(cmd->args.set_register.addr, NL);
send_hex(cmd->args.set_register.val, NL);
*(udword*)cmd->args.set_register.addr = cmd->args.set_register.val;
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.set_register;
break;
case GET_REGISTER:
send_string("GET_REGISTER\r\n");
send_hex(cmd->args.get_register.addr, NL);
send_hex(*(udword*)cmd->args.get_register.addr, NL);
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.get_register;
break;
case PAUSE_LOOP:
send_string("PAUSE_LOOP\r\n");
send_hex(cmd->args.pause_loop.pause, NL);
for (i = cmd->args.pause_loop.pause; i; i--)
;
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.pause_loop;
break;
case MEM_VERIFY:
send_string("MEM_VERIFY\r\n");
send_hex(cmd->args.mem_verify.addr, NL);
send_hex(cmd->args.mem_verify.val, NL);
if (*(udword*)cmd->args.mem_verify.addr != cmd->args.mem_verify.val) {
send_string("verify failed\r\n");
goto decode_failed;
}
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.mem_verify;
break;
case MEM_TEST:
send_string("MEM_TEST\r\n");
send_hex(cmd->args.mem_test.from, NL);
send_hex(cmd->args.mem_test.to, NL);
if (!memory_test(cmd->args.mem_test.from,
cmd->args.mem_test.to,
&failed_address)) {
send_string("### Memory test failed at ");
send_hex(failed_address, NL);
memory_dump((udword*)DWORD_ALIGN(failed_address - 64),
(udword*)DWORD_ALIGN(failed_address + 64));
goto decode_failed;
}
send_string("Passed memory test.\r\n");
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.mem_test;
break;
case MEM_DUMP:
send_string("MEM_DUMP\r\n");
send_hex(cmd->args.mem_dump.from_addr, NL);
send_hex(cmd->args.mem_dump.to_addr, NL);
memory_dump((udword*)cmd->args.mem_dump.from_addr,
(udword*)cmd->args.mem_dump.to_addr);
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.mem_dump;
break;
case MEM_CLEAR:
send_string("MEM_CLEAR\r\n");
send_hex(cmd->args.mem_clear.from_addr, NL);
send_hex(cmd->args.mem_clear.to_addr, NL);
for (i = cmd->args.mem_clear.from_addr;
i <= cmd->args.mem_clear.to_addr;
i++) {
*(byte*)i = 0x00;
}
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.mem_clear;
break;
case FLASH:
send_string("FLASH\r\n");
send_hex((udword)cmd->args.flash.source, NL);
send_hex(cmd->args.flash.offset, NL);
send_hex(cmd->args.flash.size, NL);
if ((i = flash_write(cmd->args.flash.source,
cmd->args.flash.offset,
cmd->args.flash.size)) != ERR_FLASH_OK) {
if (i == ERR_FLASH_VERIFY) {
udword size =
(cmd->args.flash.size < 65536 ? cmd->args.flash.size : 65536);
/* Try to erase the first block(s) we tried to flash to prevent a
unit which failed to flash correctly from booting */
flash_write(NULL, cmd->args.flash.offset, size);
}
goto decode_failed;
}
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.flash;
break;
case JUMP:
#if 1
/* for the printf function in our libc */
REG_WR(R_DMA_CH8_FIRST, *(udword*)&tx_header.dest[0]);
REG_WR(R_DMA_CH9_FIRST, *(uword*)&tx_header.dest[4]);
// REG_WR(R_NETWORK_SA_1, &tx_header.dest[4]);
// REG_WR(R_NETWORK_SA_2, tx_header.id);
#endif
send_string("JUMP\r\n");
send_hex(cmd->args.jump.addr, NL);
send_string("END\r\n");
__asm__ volatile ("jump %0" :: "r" (cmd->args.jump.addr));
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.jump;
break;
case LOOP:
send_string("LOOP\r\n");
send_hex(cmd->args.bne.addr, NL);
send_hex(cmd->args.bne.target, NL);
if (*(udword*)cmd->args.bne.addr) {
(*(udword*)cmd->args.bne.addr)--;
(byte*)cmd = cmd->args.bne.target;
}
else {
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.bne;
}
break;
#ifdef USE_BAUDRATE_CHANGING
case BAUDRATE:
send_string("BAUDRATE\r\n");
send_hex(cmd->args.br.baudrate, NL);
new_baudrate = cmd->args.br.baudrate;
(byte*)cmd += sizeof cmd->type + sizeof cmd->args.br;
break;
#endif
default:
send_string("### Unknown type: ");
send_hex(cmd->type, NL);
goto decode_failed;
break;
}
}
decode_failed:
send_string("END\r\n");
}
void
read_file(byte* addr, udword size)
{
udword nbr_read_last;
udword sum;
byte *b;
byte *from;
/* send_string(">read_file\r\n"); */
nbr_read = 0;
nbr_read_last = 0;
target_address = (udword)addr;
if (interface == NETWORK) {
rx_descr2.buf = (udword)addr;
bytes_to_read = size;
rx_descr2.sw_len = size + CRC_LEN > 1500 ? 1500 : size + CRC_LEN;
/* rx_descr2.sw_len = 1500; */
REG_SET(R_DMA_CH1_FIRST, first, (udword)&rx_descr);
/* Restart receiver so descriptor is re-read. */
REG_SET(R_DMA_CH1_CMD, cmd, reset);
while (REG_EQL(R_DMA_CH1_CMD, cmd, reset)) {
}
REG_SET(R_DMA_CH1_CMD, cmd, start);
while (1) {
/* send_hex(rx_descr2.hw_len, NL); */
from = (byte*)rx_descr2.buf;
if (read_data()) {
if (nbr_read < size) {
REG_SET(R_DMA_CH1_CMD, cmd, start);
}
#if USE_PRINT_DESCR
print_descr(&rx_descr);
print_descr(&rx_descr2);
#endif
#if 0
send_string("Read ");
send_hex(rx_descr2.hw_len - CRC_LEN, NO_NL);
send_string(" bytes. ");
send_hex((udword)from, NO_NL);
send_string(" - ");
send_hex(rx_descr2.buf-1, NO_NL);
send_string(" (");
send_hex(nbr_read, NO_NL);
send_string("/");
send_hex(size, NO_NL);
send_string(")\r\n");
#endif
nbr_read_last = nbr_read;
/* from = (byte*)rx_descr2.buf; */
if (nbr_read >= size) {
break;
}
}
}
}
else { /* interface != NETWORK */
while (nbr_read < size) {
read_data();
}
}
sum = 0;
for (b = addr; b != (byte*)(addr+size); b++) {
sum += *b;
}
send_string("Checksum of file is ");
send_hex(sum, NL);
/* memory_dump((udword*)addr, (udword*)addr+size); */
/* send_string("<read_file\r\n"); */
}
#if USE_PRINT_DESCR
void
print_descr(dma_descr_T *d)
{
send_string("Descriptor at ");
send_hex((udword)d, NL);
send_string("ctrl : ");
send_hex(d->ctrl, NL);
send_string("sw_len : ");
send_hex(d->sw_len, NL);
send_string("next : ");
send_hex(d->next, NL);
send_string("buf : ");
send_hex(d->buf, NL);
send_string("status : ");
send_hex(d->status, NL);
send_string("hw_len : ");
send_hex(d->hw_len, NL);
}
#endif
int
memory_test(udword from, udword to, udword *failed_address)
{
udword i;
udword j;
byte b;
/* At each dword (but bytewise) write the inverse of the adress,
check that it worked, then write the inverse of the last byte
written. Exit on fail. The memory after a successfull test will
be:
0xC0000000 : 0xC0000000 0xC0000004 0xC0000008 0xC000000C
0xC0000010 : 0xC0000010 0xC0000014 0xC0000018 0xC000001C
*/
for (i = from; i < to; i += 4) {
for (j = 0; (j != sizeof(udword)) && (i+j < to); j++) {
b = ((~i) >> (j*8)) & 0xff;
*(volatile byte*)(i+j) = b;
if (*(volatile byte*)(i+j) == b) {
*(volatile byte*)(i+j) = ~b;
}
else {
*failed_address = i+j;
send_string("### Memory test 1 failed at ");
send_hex(*failed_address, NL);
return FALSE;
}
}
}
/* Run through entire region, check bytewise that the dwords contain
the address to the dword. Exit on fail. */
for (i = from; i < to; i += 4) {
for (j = 0; (j != sizeof(udword)) && (i+j < to); j++) {
b = (i >> (j*8)) & 0xff;
if (*(volatile byte*)(i+j) != b) {
*failed_address = i+j;
send_string("### Memory test 2 failed at ");
send_hex(*failed_address, NL);
return FALSE;
}
}
}
return TRUE;
}
void
memory_dump(udword *from, udword *to)
{
udword *i = from;
int j;
for (; i <= to; i += 4) {
send_hex((udword)i, NO_NL);
send_string(" :");
for(j = 0; j != 4 && (i+j <= to); j++) {
send_string(" ");
send_hex(*(udword*)(i+j), NO_NL);
}
send_string("\r\n");
}
}

View File

@ -0,0 +1,209 @@
/*****************************************************************************
*!
*! FILE NAME : common_init.c
*!
*! DESCRIPTION: This piece of code is loaded at bootstrap and is put in the
*! cache at 0x380000F0. Depending of how R_BUS_STATUS<2:1> is
*! set different kinds of bootstrap is performed.
*!
*! 00 - Normal boot. No bootstrap is performed and this code
*! is never loaded.
*! 01 - Serial boot. 784 bytes is loaded and execution starts
*! at 0x380000F0.
*! 11 - Parallel boot. 784 bytes is loaded and execution starts
*! at 0x380000F0.
*! 10 - Network boot. 1484 bytes is loaded and execution start
*! at 0x380000F4.
*!
*! ---------------------------------------------------------------------------
*! HISTORY
*!
*! DATE NAME CHANGES
*! ---- ---- -------
*! 980326 Ronny Ranerup Initial version
*! Sep 20 1999 Jonas Dellenvall Added port3 debug support
*! 20020206 ronny Yeah, and I removed it again...
*!
*! ---------------------------------------------------------------------------
*! (C) Copyright 1998-2002, Axis Communications AB, LUND, SWEDEN
*!***************************************************************************/
/*
Misc notes:
It is very important to keep this file short. This and the boot
interface specific parts must fit into the first boot packet.
*/
/****************** INCLUDE FILES SECTION ***********************************/
#include "hwregs.h"
#include "e100boot.h"
/****************** CONSTANT AND MACRO SECTION ******************************/
/****************** TYPE DEFINITION SECTION *********************************/
/****************** LOCAL FUNCTION DECLARATION SECTION **********************/
static int timeout(void);
/****************** GLOBAL VARIABLE DECLARATION SECTION *********************/
udword nbr_read; /* How many bytes has been read from current file */
byte interface; /* Which I/O interface is the current one */
byte set_dest; /* Have we set the destination address in tx_header */
udword last_timeout;
struct packet_header_T tx_header;
dma_descr_T tx_descr; /* For packet header */
dma_descr_T tx_descr2; /* packet data */
struct packet_header_T rx_header;
dma_descr_T rx_descr; /* For packet header */
dma_descr_T rx_descr2; /* packet data */
udword seq; /* Sequence number of next wanted packet */
byte serial_up;
/****************** LOCAL VARIABLE DECLARATION SECTION **********************/
/****************** FUNCTION DEFINITION SECTION *****************************/
void
crt1(void)
{
/* Do this only once so we don't reset the timers and destroy the 32
bit timer-register used as random number generator */
REG_SET__R_TIMER_CTRL(
timerdiv1, 0,
timerdiv0, 0,
presc_timer1, normal,
i1, clr,
tm1, run,
clksel1, cascade0,
presc_ext, prescale,
i0, clr,
tm0, run,
clksel0, c9600Hz);
REG_SET__R_TIMER_CTRL(
timerdiv1, 0,
timerdiv0, 0,
presc_timer1, normal,
i1, nop,
tm1, run,
clksel1, cascade0,
presc_ext, prescale,
i0, nop,
tm0, run,
clksel0, c9600Hz);
start();
}
void
start(void)
{
#if USE_LEDS
REG_SET__R_PORT_PA_DIR(
dir7, output,
dir6, output,
dir5, output,
dir4, output,
dir3, output,
dir2, output,
dir1, output,
dir0, input); /* not for prodtest */
REG_SET__R_PORT_PA_DATA(data_out, 0);
REG_SET__R_PORT_PB_DIR(
dir7, output,
dir6, output,
dir5, output,
dir4, output,
dir3, output,
dir2, output,
dir1, output,
dir0, output);
REG_SET__R_PORT_PB_DATA(data_out, 0xff);
#endif
/* We must initialize all (global) variables here, since the .data
and .bss area are used before they are loaded. */
//serial_up = FALSE;
nbr_read = 0;
/* Get a random value to use as id. */
tx_header.id = htonl(REG_RD(R_TIMER_DATA));
/* timer01 is used as timer. */
last_timeout = REG_GET(R_TIMER01_DATA, count);
interface = REG_GET(R_BUS_STATUS, boot) - 1; /* 0,1,2 */
rx_descr2.status = 0;
/* Initialize the boot interface */
init_interface();
send_ack(); /* Ack the first bootpacket, i.e. this code. seq 0. */
while (1) {
if (read_data()) {
if (nbr_read >= (udword)bytes_to_read) {
break;
}
else if (interface == NETWORK) {
REG_SET(R_DMA_CH1_CMD, cmd, start);
}
}
}
#if USE_LEDS
REG_SET(R_PORT_PA_DATA, data_out, 0x55);
#endif
level2_boot();
}
int
read_data(void)
{
if (handle_read()) {
return TRUE;
}
if (timeout()) {
send_ack();
}
return FALSE;
}
int
timeout(void)
{
volatile int now = REG_GET(R_TIMER01_DATA, count);
int elapsed;
int wait_time = 9600;
elapsed = last_timeout - now;
if (elapsed < 0) {
elapsed = -elapsed;
}
if (elapsed > wait_time) {
last_timeout = now;
return TRUE;
}
return FALSE;
}
/****************** END OF FILE common_init.c *******************************/

View File

@ -0,0 +1,10 @@
#ifndef _COMPILER_H
#define _COMPILER_H
typedef int dword;
typedef unsigned int udword;
typedef signed short word;
typedef unsigned short uword;
typedef unsigned char byte;
#endif

View File

@ -0,0 +1,17 @@
.global crt0 ; Needed because of a bug in binutils
.global _target_address
.global _bytes_to_read
.section .startup, "ax"
nop
nop
crt0:
move.d 0x38001f00, sp
jump _crt1
_bytes_to_read: .dword 0x12345678
_target_address: .dword 0x87654321

View File

@ -0,0 +1,332 @@
/* $Id: e100boot.h,v 1.9 2003/12/16 09:04:07 magnusmn Exp $ */
#include "compiler.h"
#define DMA_DESCR__out_priority__BITNR 5
#define DMA_DESCR__out_priority__WIDTH 1
#define DMA_DESCR__out_priority__normal 0
#define DMA_DESCR__out_priority__high 1
#define DMA_DESCR__ecp_cmd__BITNR 4
#define DMA_DESCR__ecp_cmd__WIDTH 1
#define DMA_DESCR__ecp_cmd__normal 0
#define DMA_DESCR__ecp_cmd__high 1
#define DMA_DESCR__tx_err__BITNR 4
#define DMA_DESCR__tx_err__WIDTH 1
#define DMA_DESCR__tx_err__enable 1
#define DMA_DESCR__tx_err__disable 0
#define DMA_DESCR__intr__BITNR 3
#define DMA_DESCR__intr__WIDTH 1
#define DMA_DESCR__intr__enable 1
#define DMA_DESCR__intr__disable 0
#define DMA_DESCR__wait__BITNR 2
#define DMA_DESCR__wait__WIDTH 1
#define DMA_DESCR__wait__enable 1
#define DMA_DESCR__wait__disable 0
#define DMA_DESCR__eop__BITNR 1
#define DMA_DESCR__eop__WIDTH 1
#define DMA_DESCR__eop__enable 1
#define DMA_DESCR__eop__disable 0
#define DMA_DESCR__eol__BITNR 0
#define DMA_DESCR__eol__WIDTH 1
#define DMA_DESCR__eol__enable 1
#define DMA_DESCR__eol__disable 0
#define DMA_DESCR__sw_len__BITNR 0
#define DMA_DESCR__sw_len__WIDTH 16
#define DMA_DESCR__next__BITNR 0
#define DMA_DESCR__next__WIDTH 32
#define DMA_DESCR__buf__BITNR 0
#define DMA_DESCR__buf__WIDTH 32
#define DMA_DESCR__fifo_len__BITNR 8
#define DMA_DESCR__fifo_len__WIDTH 7
#define DMA_DESCR__crc_err__BITNR 7
#define DMA_DESCR__crc_err__WIDTH 1
#define DMA_DESCR__crc_err__enable 1
#define DMA_DESCR__crc_err__disable 0
#define DMA_DESCR__align_err__BITNR 6
#define DMA_DESCR__align_err__WIDTH 1
#define DMA_DESCR__align_err__enable 1
#define DMA_DESCR__align_err__disable 0
#define DMA_DESCR__in_priority__BITNR 5
#define DMA_DESCR__in_priority__WIDTH 1
#define DMA_DESCR__in_priority__high 1
#define DMA_DESCR__in_priority__normal 0
#define DMA_DESCR__stop__BITNR 4
#define DMA_DESCR__stop__WIDTH 1
#define DMA_DESCR__rd_eop__BITNR 1
#define DMA_DESCR__rd_eop__WIDTH 1
#define DMA_DESCR__hw_len__BITNR 0
#define DMA_DESCR__hw_len__WIDTH 16
#define SET_ETHER_ADDR(a0_0,a0_1,a0_2,a0_3,a0_4,a0_5,a1_0,a1_1,a1_2,a1_3,a1_4,a1_5) \
*R_NETWORK_SA_0 = a0_0 | (a0_1 << 8) | (a0_2 << 16) | (a0_3 << 24); \
*R_NETWORK_SA_1 = a0_4 | (a0_5 << 8) | (a1_0 << 16) | (a1_1 << 24); \
*R_NETWORK_SA_2 = a1_2 | (a1_3 << 8) | (a1_4 << 16) | (a1_5 << 24);
#define DWORD_ALIGN(x) ((x) & 0xfffffffc)
#define CRC_LEN 4
#define TRUE 1
#define FALSE 0
#define NL 1
#define NO_NL 0
#define SERIAL 0
#define NETWORK 1
#define PARALLEL 2
#define STRING 0
#define INT 1
#define ACK 2
#define BOOT_PACKET 3
#define BOOT_CMDS 4
#define NET_INT 5
#define NET_INT_NL 6
#define JUMP 1
#define MEM_TEST 2
#define PACKET_INFO 3
#define SET_REGISTER 4
#define GET_REGISTER 5
#define MEM_DUMP 6
#define MEM_CLEAR 7
#define MEM_VERIFY 8
#define FLASH 9
#define PAUSE_LOOP 10
#define LOOP 11
#define BAUDRATE 12
#define ERR_FLASH_OK 0
#define ERR_FLASH_NONE 1
#define ERR_FLASH_TOO_SMALL 2
#define ERR_FLASH_VERIFY 3
#define ERR_FLASH_ERASE 4
#define TIMEOUT_LIMIT ( ((6250 * 1000) / 0xffff) / 2)
#define TX_CTRL_EOP \
(IO_STATE(DMA_DESCR, intr, disable) |\
IO_STATE(DMA_DESCR, wait, enable) |\
IO_STATE(DMA_DESCR, eop, enable) |\
IO_STATE(DMA_DESCR, eol, enable))
#define TX_CTRL \
(IO_STATE(DMA_DESCR, intr, disable) |\
IO_STATE(DMA_DESCR, wait, disable) |\
IO_STATE(DMA_DESCR, eop, disable) |\
IO_STATE(DMA_DESCR, eol, disable))
#define LOAD_ADDRESS 0x38001000
#define SIZEOF_BOOT_LEVEL_1 2048
/* This is where the commands are transfered to. */
#define IO_BUF_START 0x38001f00
#define IO_BUF_END 0x380020f0 /* bootcode start + cache size */
/* This should only be used in the cbl, but if we compile the sbl for
* elinux then __CRIS__ will be defined, and these are already defined
* in uC-libc. Check that __linux__ is not defined as well!
*/
#if defined(__CRIS__) && !defined(__linux__)
#define NULL ((void*)0)
static inline udword
htonl(udword x)
{
__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
return(x);
}
#ifndef ntohl
#define ntohl(x) htonl(x)
#endif
static inline uword
htons(uword x)
{
__asm__ ("swapb %0" : "=r" (x) : "0" (x));
return(x);
}
#ifndef ntohs
#define ntohs(x) htons(x)
#endif
#endif
/*#define ntohs(x) \*/
/*((unsigned short)((((unsigned short)(x) & 0x00ffU) << 8) | \*/
/* (((unsigned short)(x) & 0xff00U) >> 8)))*/
/* */
/*#define ntohl(x) \*/
/*((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \*/
/* (((unsigned long int)(x) & 0x0000ff00U) << 8) | \*/
/* (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \*/
/* (((unsigned long int)(x) & 0xff000000U) >> 24)))*/
struct packet_header_T /* Size = 38 */
{
byte dest[6];
byte src[6];
uword length;
udword snap1;
udword snap2;
udword tag;
udword seq;
udword type;
udword id;
} __attribute__ ((packed));
typedef struct dma_descr_T {
uword sw_len; /* 0-1 */
uword ctrl; /* 2-3 */
udword next; /* 4-7 */
udword buf; /* 8-11 */
uword hw_len; /* 12-13 */
uword status; /* 14-15 */
} dma_descr_T;
typedef struct packet_info_T {
udword addr;
udword size;
} packet_info_T;
typedef struct set_register_T {
udword addr;
udword val;
} set_register_T;
typedef struct get_register_T {
udword addr;
} get_register_T;
typedef struct pause_loop_T {
udword pause;
} pause_loop_T;
typedef struct mem_verify_T {
udword addr;
udword val;
} mem_verify_T;
typedef struct mem_test_T {
udword from;
udword to;
} mem_test_T;
typedef struct mem_dump_T {
udword from_addr;
udword to_addr;
} mem_dump_T;
typedef struct mem_clear_T {
udword from_addr;
udword to_addr;
} mem_clear_T;
typedef struct flash_T {
unsigned char *source;
udword offset;
udword size;
} flash_T;
typedef struct jump_T {
udword addr;
} jump_T;
typedef struct bne_T {
udword addr;
udword target;
} bne_T;
typedef struct br_T {
udword baudrate;
} br_T;
typedef struct command_T {
udword type;
union {
packet_info_T packet_info;
set_register_T set_register;
get_register_T get_register;
pause_loop_T pause_loop;
mem_verify_T mem_verify;
mem_test_T mem_test;
mem_dump_T mem_dump;
mem_clear_T mem_clear;
flash_T flash;
jump_T jump;
bne_T bne;
br_T br;
} args;
} command_T;
#define NETWORK_HEADER_LENGTH sizeof(struct packet_header_T)
void crt1(void);
void start(void);
void level2_boot(void);
int read_data(void);
int handle_network_read(void);
int flash_write(const unsigned char *source, unsigned int offset, unsigned int size);
void init_interface(void);
int handle_read(void);
void send_ack(void);
void send_string(char *str);
void send_hex(udword v, byte nl);
extern char e100boot_version[];
extern volatile udword bytes_to_read;
extern volatile udword target_address;
extern udword nbr_read;
extern byte interface;
extern byte set_dest;
extern udword last_timeout;
extern byte *io_buf_next;
extern byte *io_buf_cur;
extern struct packet_header_T tx_header;
extern dma_descr_T tx_descr;
extern dma_descr_T tx_descr2;
extern struct packet_header_T rx_header;
extern dma_descr_T rx_descr;
extern dma_descr_T rx_descr2;
extern uword timeout_limit;
extern udword seq;
extern byte serial_up;
enum { /* Available in: */
d_eol = (1 << 0), /* flags */
d_eop = (1 << 1), /* flags & status */
d_wait = (1 << 2), /* flags */
d_int = (1 << 3), /* flags */
d_txerr = (1 << 4), /* flags */
d_stop = (1 << 4), /* status */
d_ecp = (1 << 4), /* flags & status */
d_pri = (1 << 5), /* flags & status */
d_alignerr = (1 << 6), /* status */
d_crcerr = (1 << 7) /* status */
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
SECTIONS
{
. = 0x380000f0;
__Stext = .;
.text :
{
KEEP (*(.startup))
KEEP (*(.text))
*(.text.*)
KEEP (*(.rodata))
*(.rodata.*)
} =0
__Etext = .;
.data :
{
__Sdata = .;
KEEP (*(.data))
*(.data.*)
}
__Edata = .;
. = ALIGN (4);
__Sbss = .;
.bss :
{
/* The network crc will land in the first four bytes of the
bss. Move the variables out of the way. */
. = . + 12;
*(.bss.*)
*(COMMON)
}
__Ebss = .;
}

View File

@ -0,0 +1,218 @@
#define net_init init_interface
#define handle_network_read handle_read
#define send_network_ack send_ack
#define send_network_string send_string
#define send_network_hex send_hex
#include "sv_addr_ag.h"
#include "e100boot.h"
static void start_network_trans(void);
void
net_init(void)
{
*R_NETWORK_GA_1 = *R_NETWORK_GA_0 = 0;
SET_ETHER_ADDR(0x01,0x40,0x8c,0x00,0x01,0x00,
0x01,0x40,0x8c,0x00,0x01,0x00);
*R_NETWORK_REC_CONFIG =
IO_STATE (R_NETWORK_REC_CONFIG, duplex, half) |
IO_STATE (R_NETWORK_REC_CONFIG, bad_crc, discard) |
IO_STATE (R_NETWORK_REC_CONFIG, oversize, discard) |
IO_STATE (R_NETWORK_REC_CONFIG, undersize, discard) |
IO_STATE (R_NETWORK_REC_CONFIG, all_roots, discard) |
IO_STATE (R_NETWORK_REC_CONFIG, broadcast, discard) |
IO_STATE (R_NETWORK_REC_CONFIG, individual, discard) |
IO_STATE (R_NETWORK_REC_CONFIG, ma1, disable) |
IO_STATE (R_NETWORK_REC_CONFIG, ma0, enable);
*R_NETWORK_MGM_CTRL =
IO_FIELD(R_NETWORK_MGM_CTRL, txd_pins, 0) |
IO_FIELD(R_NETWORK_MGM_CTRL, txer_pin, 0) |
IO_FIELD(R_NETWORK_MGM_CTRL, mdck, 0) |
IO_STATE(R_NETWORK_MGM_CTRL, mdoe, disable) |
IO_FIELD(R_NETWORK_MGM_CTRL, mdio, 0);
*R_NETWORK_TR_CTRL =
(IO_STATE (R_NETWORK_TR_CTRL, clr_error, clr) |
IO_STATE (R_NETWORK_TR_CTRL, delay, none) |
IO_STATE (R_NETWORK_TR_CTRL, cancel, dont) |
IO_STATE (R_NETWORK_TR_CTRL, cd, enable) |
IO_STATE (R_NETWORK_TR_CTRL, pad, enable) |
IO_STATE (R_NETWORK_TR_CTRL, crc, enable) |
IO_STATE (R_NETWORK_TR_CTRL, retry, enable));
*R_NETWORK_GEN_CONFIG =
IO_STATE (R_NETWORK_GEN_CONFIG, loopback, off) |
IO_STATE (R_NETWORK_GEN_CONFIG, frame, ether) |
IO_STATE (R_NETWORK_GEN_CONFIG, vg, off) |
IO_STATE (R_NETWORK_GEN_CONFIG, phy, mii_clk) |
IO_STATE (R_NETWORK_GEN_CONFIG, enable, on);
*R_DMA_CH0_CMD = IO_STATE(R_DMA_CH0_CMD, cmd, reset);
*R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, reset);
rx_descr.sw_len = NETWORK_HEADER_LENGTH;
rx_descr.ctrl = TX_CTRL;
rx_descr.next = (udword)&rx_descr2;
rx_descr.buf = (udword)&rx_header;
rx_descr2.sw_len = 1500;
rx_descr2.ctrl = TX_CTRL_EOP;
rx_descr2.buf = target_address;
/* Endian dependent, but saves a few bytes... */
*(udword*)&tx_header.src[0] = htonl(0x02408c00);
*(uword*)&tx_header.src[4] = htons(0x0100);
tx_header.length = htons(64);
tx_header.snap1 = htonl(0xaaaa0300);
tx_header.snap2 = htonl(0x408c8856);
tx_header.tag = htonl(0xfffffffe);
tx_header.seq = 0;
tx_header.type = 0;
tx_descr.sw_len = NETWORK_HEADER_LENGTH;
tx_descr.ctrl = TX_CTRL_EOP;
tx_descr.buf = (udword)&tx_header;
set_dest = FALSE;
seq = 0;
*R_DMA_CH1_FIRST = (udword)&rx_descr;
*R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, start);
}
int
handle_network_read(void)
{
if (!(rx_descr2.status & d_eop)) {
return FALSE;
}
/* Even if wasn't to us, we must do this... */
rx_descr2.status = 0;
*R_DMA_CH1_FIRST = (udword)&rx_descr;
/* Was it to me? */
if (ntohl(rx_header.seq) == (seq+1)) {
interface = NETWORK;
last_timeout = *R_TIMER_DATA >> IO_BITNR(R_TIMER_DATA, timer0);
nbr_read += rx_descr2.hw_len - CRC_LEN;
rx_descr2.buf += rx_descr2.hw_len - CRC_LEN;
rx_descr2.sw_len = bytes_to_read - nbr_read - CRC_LEN < 1500 ?
bytes_to_read - nbr_read + CRC_LEN: 1500; /* FIX!!!!! */
rx_descr2.sw_len = rx_descr2.sw_len + NETWORK_HEADER_LENGTH < 64
? 64 - NETWORK_HEADER_LENGTH : rx_descr2.sw_len; /* Less than minimum eth packet? */
seq++;
send_network_ack();
}
return TRUE;
}
void
send_network_ack(void)
{
/* send_serial_string(">send_network_ack.\r\n"); */
if (!set_dest) { /* Copy destination address from first received packet */
set_dest = TRUE;
/* If we have done a bootrom network boot, source address is in a different
place... */
if (((*R_BUS_STATUS & IO_MASK(R_BUS_STATUS, boot))
>> IO_BITNR(R_BUS_STATUS, boot)) - 1 == NETWORK) {
*(udword*)&tx_header.dest[0] = *(udword*)0x380000dc;
*(uword*)&tx_header.dest[4] = *(uword*)0x380000e0;
}
else {
*(udword*)&tx_header.dest[0] = *(udword*)&rx_header.src[0];
*(uword*)&tx_header.dest[4] = *(uword*)&rx_header.src[4];
}
}
#if 1
tx_header.seq = htonl(seq);
tx_header.type = htonl(ACK);
#else
tx_header.seq = htonl(seq);
tx_header.type = htonl(bytes_to_read);
tx_header.id = htonl(target_address);
/* tx_header.id already set in start(). */
#endif
tx_descr.ctrl = TX_CTRL_EOP;
tx_descr.sw_len = NETWORK_HEADER_LENGTH;
start_network_trans();
}
void
start_network_trans(void)
{
/* send_serial_string(">start_network_trans\r\n"); */
/* Clear possible underrun or excessive retry errors */
/* *R_NETWORK_TR_CTRL = */
/* (IO_STATE (R_NETWORK_TR_CTRL, clr_error, clr) | */
/* IO_STATE (R_NETWORK_TR_CTRL, delay, none) | */
/* IO_STATE (R_NETWORK_TR_CTRL, cancel, dont) | */
/* IO_STATE (R_NETWORK_TR_CTRL, cd, enable) | */
/* IO_STATE (R_NETWORK_TR_CTRL, pad, enable) | */
/* IO_STATE (R_NETWORK_TR_CTRL, crc, enable) | */
/* IO_STATE (R_NETWORK_TR_CTRL, retry, enable)); */
*R_DMA_CH0_FIRST = (udword)&tx_descr;
*R_DMA_CH0_CMD = IO_STATE(R_DMA_CH0_CMD, cmd, start);
while(*R_DMA_CH0_FIRST)
;
}
void
send_network_string(char *str)
{
int i;
tx_descr.next = (udword)&tx_descr2;
tx_descr.ctrl = TX_CTRL;
for (i = 0; str[i]; i++) /* strlen */
;
tx_header.type = STRING;
tx_descr2.ctrl = TX_CTRL_EOP;
tx_descr2.buf = (udword)str;
tx_descr2.sw_len = i+1;
start_network_trans();
}
void
send_network_hex(udword v, byte nl)
{
tx_descr.next = (udword)&tx_descr2;
tx_descr.ctrl = TX_CTRL;
tx_header.type = nl ? htonl(NET_INT_NL) : htonl(NET_INT);
/* Pause so we don't saturate network. */
/* Hehe, the asm will fool gcc to not remove the loop even though it
probably should. If we volatile i the code will be a few bytes
longer than this version. Well I really did it like this just
because it is possible... */
{
udword i;
for(i = 0; i != 16384; i++)
__asm__ ("");
}
v = htonl(v);
tx_descr2.ctrl = TX_CTRL_EOP;
tx_descr2.buf = (udword)&v;
tx_descr2.sw_len = (uword)sizeof(udword);
start_network_trans();
}

View File

@ -0,0 +1,10 @@
#define REG_NO_SHADOW 1
#define REG_NO_INIT_SHADOW 1
#define USE_GROUP__Serial_port_registers 1
#define USE_GROUP__Network_interface_registers 1
#define USE_GROUP__Parallel_printer_port_registers 1
#define USE_GROUP__Timer_registers 1
#define USE_GROUP__General_port_configuration_registers 1
#define USE_GROUP__Bus_interface_configuration_registers 1
#define USE_GROUP__DMA_registers 1

View File

@ -0,0 +1,117 @@
#define ser_init init_interface
#define handle_serial_read handle_read
#define send_serial_ack send_ack
#define send_serial_string send_string
#define send_serial_hex send_hex
#include "hwregs.h"
#include "sv_addr_ag.h"
#include "e100boot.h"
void
ser_init(void)
{
REG_SET__R_SERIAL0_XOFF
(
tx_stop, enable,
auto_xoff, disable,
xoff_char, 0
);
REG_SET__R_SERIAL0_BAUD
(
tr_baud, c9600Hz,
rec_baud, c9600Hz
);
REG_SET__R_SERIAL0_REC_CTRL
(
dma_err, stop,
rec_enable, enable,
rts_, inactive,
sampling, middle,
rec_stick_par, normal,
rec_par, even,
rec_par_en, disable,
rec_bitnr, rec_8bit
);
REG_SET__R_SERIAL0_TR_CTRL
(
txd, 0,
tr_enable, enable,
auto_cts, disabled,
stop_bits, one_bit,
tr_stick_par, normal,
tr_par, even,
tr_par_en, disable,
tr_bitnr, tr_8bit
);
serial_up = TRUE;
}
#define SER_MASK (IO_MASK(R_SERIAL0_READ, data_avail) | IO_MASK(R_SERIAL0_READ, data_in))
int
handle_serial_read(void)
{
udword status_and_data_in = *R_SERIAL0_READ & SER_MASK;
if (status_and_data_in & IO_STATE(R_SERIAL0_READ, data_avail, yes)) {
*(char*)(target_address + nbr_read++) = status_and_data_in & 0xff; /* ugly mask */
last_timeout = REG_GET(R_TIMER0_DATA, count);
return TRUE;
}
return FALSE;
}
void
send_serial_ack(void)
{
while (!REG_EQL(R_SERIAL0_STATUS, tr_ready, ready))
;
REG_ISET(0, R_SERIAL0_TR_DATA, data_out, '+');
}
void
send_serial_string(char *str)
{
int i;
for (i = 0; str[i];) {
if (REG_IEQL(0, R_SERIAL0_STATUS, tr_ready, ready)) {
REG_ISET(0, R_SERIAL0_TR_DATA, data_out, str[i]);
i++;
}
}
}
void
send_serial_hex(udword v, byte nl)
{
int i;
byte buf[13];
byte nybble;
buf[0] = '0';
buf[1] = 'x';
buf[10] = '\r';
buf[11] = '\n';
buf[12] = '\0';
if (nl == FALSE) {
buf[10] = '\0';
}
for (i = 0; i != 8; i++) {
nybble = (v >> (i*4)) & 0xf;
if (nybble > 9) {
nybble += 7;
}
buf[7-i+2] = nybble + '0';
}
send_serial_string(buf);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,137 @@
/*!**************************************************************************
*!
*! MACROS:
*! IO_MASK(reg,field)
*! IO_STATE(reg,field,state)
*! IO_EXTRACT(reg,field,val)
*! IO_STATE_VALUE(reg,field,state)
*! IO_BITNR(reg,field)
*! IO_WIDTH(reg,field)
*! IO_FIELD(reg,field,val)
*! IO_RD(reg)
*! All moderegister addresses and fields of these.
*!
*!**************************************************************************/
#ifndef __sv_addr_ag_h__
#define __sv_addr_ag_h__
#define __test_sv_addr__ 0
/*------------------------------------------------------------
!* General macros to manipulate moderegisters.
!*-----------------------------------------------------------*/
/* IO_MASK returns a mask for a specified bitfield in a register.
Note that this macro doesn't work when field width is 32 bits. */
#define IO_MASK(reg, field) IO_MASK_ (reg##_, field##_)
#define IO_MASK_(reg_, field_) \
( ( ( 1 << reg_##_##field_##_WIDTH ) - 1 ) << reg_##_##field_##_BITNR )
/* IO_STATE returns a constant corresponding to a one of the symbolic
states that the bitfield can have. (Shifted to correct position) */
#define IO_STATE(reg, field, state) IO_STATE_ (reg##_, field##_, _##state)
#define IO_STATE_(reg_, field_, _state) \
( reg_##_##field_##_state << reg_##_##field_##_BITNR )
/* IO_EXTRACT returns the masked and shifted value corresponding to the
bitfield can have. */
#define IO_EXTRACT(reg, field, val) IO_EXTRACT_ (reg##_, field##_, val)
#define IO_EXTRACT_(reg_, field_, val) ( (( ( ( 1 << reg_##_##field_##_WIDTH ) \
- 1 ) << reg_##_##field_##_BITNR ) & (val)) >> reg_##_##field_##_BITNR )
/* IO_STATE_VALUE returns a constant corresponding to a one of the symbolic
states that the bitfield can have. (Not shifted) */
#define IO_STATE_VALUE(reg, field, state) \
IO_STATE_VALUE_ (reg##_, field##_, _##state)
#define IO_STATE_VALUE_(reg_, field_, _state) ( reg_##_##field_##_state )
/* IO_FIELD shifts the val parameter to be aligned with the bitfield
specified. */
#define IO_FIELD(reg, field, val) IO_FIELD_ (reg##_, field##_, val)
#define IO_FIELD_(reg_, field_, val) ((val) << reg_##_##field_##_BITNR)
/* IO_BITNR returns the starting bitnumber of a bitfield. Bit 0 is
LSB and the returned bitnumber is LSB of the field. */
#define IO_BITNR(reg, field) IO_BITNR_ (reg##_, field##_)
#define IO_BITNR_(reg_, field_) (reg_##_##field_##_BITNR)
/* IO_WIDTH returns the width, in bits, of a bitfield. */
#define IO_WIDTH(reg, field) IO_WIDTH_ (reg##_, field##_)
#define IO_WIDTH_(reg_, field_) (reg_##_##field_##_WIDTH)
/*--- Obsolete. Kept for backw compatibility. ---*/
/* Reads (or writes) a byte/uword/udword from the specified mode
register. */
#define IO_RD(reg) (*(volatile udword*)(reg))
#define IO_RD_B(reg) (*(volatile byte*)(reg))
#define IO_RD_W(reg) (*(volatile uword*)(reg))
#define IO_RD_D(reg) (*(volatile udword*)(reg))
/*------------------------------------------------------------
!* Start addresses of the different memory areas.
!*-----------------------------------------------------------*/
#define MEM_CSE0_START (0x00000000)
#define MEM_CSE1_START (0x04000000)
#define MEM_CSR0_START (0x08000000)
#define MEM_CSR1_START (0x0c000000)
#define MEM_CSP0_START (0x10000000)
#define MEM_CSP1_START (0x14000000)
#define MEM_CSP2_START (0x18000000)
#define MEM_CSP3_START (0x1c000000)
#define MEM_CSP4_START (0x20000000)
#define MEM_CSP5_START (0x24000000)
#define MEM_CSP6_START (0x28000000)
#define MEM_CSP7_START (0x2c000000)
#define MEM_DRAM_START (0x40000000)
#define MEM_NON_CACHEABLE (0x80000000)
/*------------------------------------------------------------
!* Type casts used in mode register macros, making pointer
!* dereferencing possible. Empty in assembler.
!*-----------------------------------------------------------*/
#ifndef __ASSEMBLER__
# define IO_TYPECAST_UDWORD (volatile udword*)
# define IO_TYPECAST_RO_UDWORD (const volatile udword*)
# define IO_TYPECAST_UWORD (volatile uword*)
# define IO_TYPECAST_RO_UWORD (const volatile uword*)
# define IO_TYPECAST_BYTE (volatile byte*)
# define IO_TYPECAST_RO_BYTE (const volatile byte*)
#else
# define IO_TYPECAST_UDWORD
# define IO_TYPECAST_RO_UDWORD
# define IO_TYPECAST_UWORD
# define IO_TYPECAST_RO_UWORD
# define IO_TYPECAST_BYTE
# define IO_TYPECAST_RO_BYTE
#endif
/*------------------------------------------------------------*/
#include "sv_addr.agh"
#if __test_sv_addr__
/* IO_MASK( R_BUS_CONFIG , CE ) */
IO_MASK( R_WAITSTATES , SRAM_WS )
IO_MASK( R_TEST , W32 )
IO_STATE( R_BUS_CONFIG, CE, DISABLE )
IO_STATE( R_BUS_CONFIG, CE, ENABLE )
IO_STATE( R_DRAM_TIMING, REF, IVAL2 )
IO_MASK( R_DRAM_TIMING, REF )
IO_MASK( R_EXT_DMA_0_STAT, TFR_COUNT ) >> IO_BITNR( R_EXT_DMA_0_STAT, TFR_COUNT )
IO_RD(R_EXT_DMA_0_STAT) & IO_MASK( R_EXT_DMA_0_STAT, S )
== IO_STATE( R_EXT_DMA_0_STAT, S, STARTED )
#endif
#endif /* ifndef __sv_addr_ag_h__ */

View File

@ -0,0 +1,17 @@
OBJS=e100boot.1 e100boot.html
all: $(OBJS)
%.1: %.pod
pod2man $< > $@
%.html: %.pod
pod2html $< > $@
@rm -f pod2htmd.x~~ pod2htmi.x~~
clean:
rm -f *cache *~
# The 'clean' doesn't remove the generated documentation as we want
# them in the distribution.

View File

@ -0,0 +1,401 @@
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "E100BOOT 1"
.TH E100BOOT 1 "2003-12-16" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
e100boot \- Network and serial port bootloader for the ETRAX100 CPU.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fBe100boot\fR [\fB\-\-device\fR \fIdevicename\fR]
[\fB\-\-file\fR \fIfilename\fR|\- \fIaddr\fR [\fIsize\fR]]
[\fB\-\-flash\fR \fIram-source\fR \fIflash-offset\fR \fIsize\fR] [\fB\-\-pause\fR \fIiter\fR]
[\fB\-\-memtest\fR \fIaddr\fR \fIaddr\fR] [\fB\-\-memclear\fR \fIaddr\fR \fIaddr\fR]
[\fB\-\-memdump\fR \fIaddr\fR \fIaddr\fR] [\fB\-\-setreg\fR \fIaddr\fR|\fIregname\fR \fIval\fR]
[\fB\-\-getreg\fR \fIaddr\fR|\fIregname\fR] [\fB\-\-verify\fR \fIaddr\fR \fIval\fR]
[\fB\-\-label\fR \fIlabel\fR] [\fB\-\-loop\fR \fIaddr\fR \fIlabel\fR] [\fB\-\-5400\fR] [\fB\-\-5600\fR]
[\fB\-\-testcard\fR] [\fB\-\-devboard\fR] [\fB\-\-testcardlx\fR] [\fB\-\-network\fR] [\fB\-\-serial\fR]
[\fB\-\-baudrate\fR \fIbaudrate\fR] [\fB\-\-bootfile\fR \fIfile\fR] [\fB\-\-jump\fR \fIaddr\fR]
[\fB\-\-tofiles\fR] [\fB\-\-cmdsonly\fR] [\fB\-\-images\fR] [\fB\-\-noleds\fR] [\fB\-\-help\fR]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This boot loader facilitates loading of files over the network or a
serial port to an \s-1ETRAX100\s0. It can also be used for fairly extensive
hardware debugging as you can read and write to any memory addresses,
including the \s-1ETRAX100\s0 registers. You can also perform memory checks
and dumps and copy data to flash memories.
.PP
The first packet (or the first 784 bytes in the case of serial boot)
sent to Etrax100 is loaded into the cache. The code in this packet is
executed and loads the rest of the boot loader into the cache. The
cache is the only thing we can be sure of exists on all \s-1ETRAX100\s0
products, so the boot loader is limited to the size of the cache,
8KB. If further boot loading code is needed you have to set up
external memory and load another boot loader into it, but this is
rarely needed.
.PP
Two programs are involved in this boot loading, one is the program on
your workstation that sends the packets to \s-1ETRAX100\s0, this is called
the server boot loader or \s-1SBL\s0. The other program is the one in
\&\s-1ETRAX100\s0 that receives packets from the \s-1SBL\s0 and acts upon the data
therein, this is called the client boot loader or \s-1CBL\s0.
.PP
We don't want to edit and recompile the \s-1CBL\s0 each time we want to load
level two to different parts of memory, like we do on different
products. We also want to change things like the setup of external
memory before we load data into it. To make the boot loading as
flexible as possible and separate the \s-1CBL\s0 from level two we send a
configuration packet to it. After this packet we load other files, if
we want to.
.PP
The configuration packet can contain information to the \s-1CBL\s0 which lets
you: initialize external memory, read and write to all \s-1ETRAX100\s0
registers, read and write to any part of memory, load as many other
files as you like to any part of memory you like, etc. The
configuration packet is generated on the fly by the \s-1SBL\s0.
.PP
Since the \s-1CBL\s0 is unaware of which product it will be loaded on, it
doesn't do product specific initialization like setting up the
memory. This must be done with the configuration packet.
.Sh "Debugging printout"
.IX Subsection "Debugging printout"
When doing network boot the debugging printout from the \s-1CBL\s0 in \s-1ETRAX\s0
is transmitted back over the network and printed by e100boot. When
doing serial boot that interface will be used. So in either case you
will not need any other software or hardware to receive the debugging
printout.
.Sh "Creating binaries"
.IX Subsection "Creating binaries"
The files containing code to be loaded on the \s-1ETRAX100\s0 must be
stripped using the standard \s-1GCC\s0 binutils.
.Sh "How it works, things you don't want to know."
.IX Subsection "How it works, things you don't want to know."
ack, timeout bla, bla... \s-1RTFS\s0.
.Sh "Compilation and code"
.IX Subsection "Compilation and code"
Noteworthy is that two separate \s-1ETRAX100\s0 binaries are created, one for
network boot and one for serial boot. They actually contain exactly
the same code, but linked in different order. This is because the code
to load the rest of the bootloader over a specific interface must be
contained in the first data sent to the \s-1ETRAX100\s0 and it is too
difficult to cram the code for both interfaces in the beginning of the
same binary. Hence two files.
.PP
Other stuff you don't want to know is that the cache is mapped from
0x380000f0 to 0x380020f0. Code starts at the first address followed by
data up to the symbol \fIEbss\fR. At the other end is the buffer for boot
commands (addresses defined by \fI\s-1IO_BUF_START\s0\fR and \fI\s-1IO_BUF_END\s0\fR below
which the stack lies and hopefully the stack and \fIEbss\fR will never
meet...
.PP
The serial data is loaded from 0x380000f0 to 0x380003ff before
execution starts.
.SH "OPTIONS"
.IX Header "OPTIONS"
The options are done in the order specified on the command line, so
you probably want to do any memory setup before loading a file to the
memory, and you probably do not want to perform a memory test after
you have loaded a file to that memory.
.PP
All addresses and sizes must be in hex with optional '0x' prefix, or a
\&\s-1ETRAX100\s0 register name. Since the \fB\-\-setreg\fR and \fB\-\-getreg\fR options
only can be performed on dword aligned dwords only the registers that
conform to this can be named.
.PP
Note also that all addresses must be in uncached memory (bit 31 set),
as the bootloader lies in the cache. If you access any uncached
address during boot, the bootloader will be destroyed without warning.
.PP
It is also possible to specify an address as \fI+address\fR, in which
case it is considered to be relative to \fI\s-1IO_BUF_START\s0\fR. This is
especially useful in combination with the \fB\-\-loop\fR option below.
.IP "\fB\-\-baudrate\fR \fIbaudrate\fR" 4
.IX Item "--baudrate baudrate"
Set baudrate for files loaded after the boot loader.
.IP "\fB\-\-bootfile\fR \fIfilename\fR" 4
.IX Item "--bootfile filename"
Which boot image to send to \s-1ETRAX\s0 instead of the default ones.
.IP "\fB\-\-cmdsonly\fR" 4
.IX Item "--cmdsonly"
Write the commands to file e100boot.cmds.
.IP "\fB\-\-devboard\fR" 4
.IX Item "--devboard"
Sets registers for the developer board.
.IP "\fB\-\-device\fR \fIdevicename\fR" 4
.IX Item "--device devicename"
Which device to send packets on. For network boot the default is
eth0. For serial boot it is ttyS0.
.IP "\fB\-\-file\fR \fIfilename\fR|\- \fIaddress\fR [\fIsize\fR]" 4
.IX Item "--file filename|- address [size]"
The file to load and the address to load it to. If file is loaded on
stdin, specify filename '\-' followed by a size. Size need only be
given in this case. You can load as many files as you want, each
specified with a \fB\-\-file\fR.
.IP "\fB\-\-flash\fR \fIram-source flash-offset size\fR" 4
.IX Item "--flash ram-source flash-offset size"
Copies the specified \s-1RAM\s0 area to the flash.
.IP "\fB\-\-getreg\fR \fIaddress\fR|\fIregname\fR" 4
.IX Item "--getreg address|regname"
Print value of memory location. Must be uncached address.
.IP "\fB\-\-help\fR" 4
.IX Item "--help"
Print the help information.
.IP "\fB\-\-images\fR" 4
.IX Item "--images"
Print information about the internal boot images, then exit.
.IP "\fB\-\-jump\fR \fIaddress\fR" 4
.IX Item "--jump address"
Jump to specified address.
.IP "\fB\-\-label\fR \fIlabel\fR" 4
.IX Item "--label label"
Define a label to be used as target by the \fB\-\-loop\fR command. This
command is only used by the \s-1SBL\s0 to calculate the address for the
\&\fB\-\-loop\fR and does not take up any space in the configuration packet.
.IP "\fB\-\-loop\fR \fIcheck-address label\fR" 4
.IX Item "--loop check-address label"
If the contents of check-address is nonzero it is decremented and the
command parser continues parsing at the label.
.Sp
If no external memory is initialized yet it can be convenient to use
an address in the area occupied by the configuration packet. Run
e100boot with \fB\-\-help\fR to see which addresses the commands are stored
at. The size of the commands are four bytes for each command plus four
bytes per argument to the command.
.IP "\fB\-\-memclear\fR \fIstart-address end-address\fR" 4
.IX Item "--memclear start-address end-address"
Clears the specified memory area.
.IP "\fB\-\-memdump\fR \fIstart-address end-address\fR" 4
.IX Item "--memdump start-address end-address"
Prints the contents of the specified memory area.
.IP "\fB\-\-memtest\fR \fIstart-address end-address\fR" 4
.IX Item "--memtest start-address end-address"
Does a fairly extensive test of the specified memory area. Not only
catches defect memories but also catches things like wrong memory
setups where memory addresses are mirrored onto each other.
.IP "\fB\-\-network\fR" 4
.IX Item "--network"
Perform a network boot.
.IP "\fB\-\-noleds\fR" 4
.IX Item "--noleds"
When using the internal images use a version that does not toggle
general port \s-1PA\s0 or \s-1PB\s0 in \s-1ETRAX\s0 during the boot procedure.
.IP "\fB\-\-pause\fR \fIiterations\fR" 4
.IX Item "--pause iterations"
How many \fIiterations\fR to do of an empty loop.
.IP "\fB\-\-serial\fR" 4
.IX Item "--serial"
Do a serial boot.
.IP "\fB\-\-setreg\fR \fIaddress\fR|\fIregname\fR \fIvalue\fR" 4
.IX Item "--setreg address|regname value"
Load dword to dword aligned memory location.
.IP "\fB\-\-testcard\fR" 4
.IX Item "--testcard"
Configures the memories for the \s-1ETRAX\s0 100 testcard.
.IP "\fB\-\-testcardlx\fR" 4
.IX Item "--testcardlx"
Configures the memories for the \s-1ETRAX100\s0 \s-1LX\s0 testcard.
.IP "\fB\-\-tofiles\fR" 4
.IX Item "--tofiles"
Write packets to files e100boot.seq[0..]. Does not transmit the data.
.IP "\fB\-\-verify\fR \fIaddress value\fR" 4
.IX Item "--verify address value"
Verify that memory contains dword. If not loader will stop. This is to
avoid booting the wrong unit. If you have the units ethernet address
in the flash memory you can check for that.
.IP "\fB\-\-5400\fR" 4
.IX Item "--5400"
Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5400
printserver.
.IP "\fB\-\-5600\fR" 4
.IX Item "--5600"
Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5600
printserver.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
If you have a stripped binary (file.ima) linked to 0x08000000 that you want
to boot via the network, do this:
.PP
\&\fBe100boot \-\-file file.ima 88000000 \-\-jump 08000000\fR
.PP
Or something like this. Sets waitstates to zero and loads two files,
the first from stdin:
.PP
\&\fBcat file.ima | e100boot \-\-memtest 88000000 8801ffff \-\-memclear
88000000 8801ffff \-\-setreg b0000000 0 \-\-getreg b0000000 \-\-file \-
88000000 a000 \-\-file file2.ima 88010000 \-\-memdump 88000000 880000ff
\&\-\-jump 08000000\fR
.PP
Or this, enables 16 bit parallel port and flashes the led on \s-1PA0:\s0
.PP
\&\fBe100boot \-\-testcardlx \-\-setreg R_PORT_PA_SET 0x00000000 \-\-setreg
R_GEN_CONFIG 0x80000004 \-\-setreg R_PAR0_CONFIG 0x00000200 \-\-setreg
R_PORT_G_DATA 0x00000000 \-\-pause 0x02000000 \-\-setreg R_PORT_G_DATA
0xffffffff \-\-pause 0x02000000 \-\-setreg R_PORT_G_DATA 0x00000000 \-\-loop
0x38001e0b 0x38001e60\fR
.PP
Setup the memory, test the \s-1SRAM\s0, print the contents of the first 256
bytes of \s-1SRAM\s0, clear \s-1SRAM\s0, test the \s-1DRAM\s0, print R_DMA_CH0_CMD, load a
file to \s-1SRAM\s0, load another file to \s-1SRAM\s0, load file to \s-1DRAM\s0, jump to
code in \s-1SRAM\s0.
.PP
\&\fBe100boot \-\-setreg b0000000 1000 \-\-setreg b0000008 00006543 \-\-setreg
b000000c 12966060 \-\-memtest 88000000 80000 \-\-memdump 88000000 880000ff
\&\-\-memclear 88000000 80000 \-\-memtest c0000000 400000 \-\-getreg b00001d0
\&\-\-file file1.ima 88000000 \-\-file file2.ima 88010000 \-\-file file3.ima
c0000000 \-\-jump 88000000\fR
.PP
Boot Linux on the testcard.
.PP
\&\fBe100boot \-\-setreg b0000000 1000 \-\-setreg b0000008 6557 \-\-setreg
b000000c 1b988080 \-\-file timage c0000500 \-\-jump 40000500\fR
.PP
Booting over serial port and using labels to flash the leds on port
\&\s-1PA\s0.
.PP
\&\fBe100boot \-\-serial \-\-device /dev/ttyS1 \-\-baudrate 9600 \-\-label first
\&\-\-setreg 0x380020e0 00000001 \-\-setreg R_PORT_PA_SET 0x0000ff00 \-\-pause
0x02000000 \-\-setreg R_PORT_PA_SET 0x0000ffff \-\-pause 0x02000000 \-\-loop
0x380020e0 first\fR
.SH "BUGS"
.IX Header "BUGS"
You're kidding, right? Check \s-1AUTHOR\s0 below. The only thing
would be the hubris of the author, but that I consider a feature. If
you find any other 'features' report them to
technology@axis.com. Don't bother the author directly, he is busy
playing PlayStation2.
.SH "COPYING"
.IX Header "COPYING"
Copyright © 1996\-2002 Axis Communications \s-1AB\s0.
.SH "AUTHOR"
.IX Header "AUTHOR"
Written by Ronny Ranerup.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
The fine source, which you can get at http://developer.axis.com.

View File

@ -0,0 +1,395 @@
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>e100boot - Network and serial port bootloader for the ETRAX100 CPU.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<ul>
<li><a href="#debugging_printout">Debugging printout</a></li>
<li><a href="#creating_binaries">Creating binaries</a></li>
<li><a href="#how_it_works__things_you_don_t_want_to_know_">How it works, things you don't want to know.</a></li>
<li><a href="#compilation_and_code">Compilation and code</a></li>
</ul>
<li><a href="#options">OPTIONS</a></li>
<li><a href="#examples">EXAMPLES</a></li>
<li><a href="#bugs">BUGS</a></li>
<li><a href="#copying">COPYING</a></li>
<li><a href="#author">AUTHOR</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>e100boot - Network and serial port bootloader for the ETRAX100 CPU.</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p><strong>e100boot</strong> [<strong>--device</strong> <em>devicename</em>]
[<strong>--file</strong> <em>filename</em>|- <em>addr</em> [<em>size</em>]]
[<strong>--flash</strong> <em>ram-source</em> <em>flash-offset</em> <em>size</em>] [<strong>--pause</strong> <em>iter</em>]
[<strong>--memtest</strong> <em>addr</em> <em>addr</em>] [<strong>--memclear</strong> <em>addr</em> <em>addr</em>]
[<strong>--memdump</strong> <em>addr</em> <em>addr</em>] [<strong>--setreg</strong> <em>addr</em>|<em>regname</em> <em>val</em>]
[<strong>--getreg</strong> <em>addr</em>|<em>regname</em>] [<strong>--verify</strong> <em>addr</em> <em>val</em>]
[<strong>--label</strong> <em>label</em>] [<strong>--loop</strong> <em>addr</em> <em>label</em>] [<strong>--5400</strong>] [<strong>--5600</strong>]
[<strong>--testcard</strong>] [<strong>--devboard</strong>] [<strong>--testcardlx</strong>] [<strong>--network</strong>] [<strong>--serial</strong>]
[<strong>--baudrate</strong> <em>baudrate</em>] [<strong>--bootfile</strong> <em>file</em>] [<strong>--jump</strong> <em>addr</em>]
[<strong>--tofiles</strong>] [<strong>--cmdsonly</strong>] [<strong>--images</strong>] [<strong>--noleds</strong>] [<strong>--help</strong>]</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This boot loader facilitates loading of files over the network or a
serial port to an ETRAX100. It can also be used for fairly extensive
hardware debugging as you can read and write to any memory addresses,
including the ETRAX100 registers. You can also perform memory checks
and dumps and copy data to flash memories.</p>
<p>The first packet (or the first 784 bytes in the case of serial boot)
sent to Etrax100 is loaded into the cache. The code in this packet is
executed and loads the rest of the boot loader into the cache. The
cache is the only thing we can be sure of exists on all ETRAX100
products, so the boot loader is limited to the size of the cache,
8KB. If further boot loading code is needed you have to set up
external memory and load another boot loader into it, but this is
rarely needed.</p>
<p>Two programs are involved in this boot loading, one is the program on
your workstation that sends the packets to ETRAX100, this is called
the server boot loader or SBL. The other program is the one in
ETRAX100 that receives packets from the SBL and acts upon the data
therein, this is called the client boot loader or CBL.</p>
<p>We don't want to edit and recompile the CBL each time we want to load
level two to different parts of memory, like we do on different
products. We also want to change things like the setup of external
memory before we load data into it. To make the boot loading as
flexible as possible and separate the CBL from level two we send a
configuration packet to it. After this packet we load other files, if
we want to.</p>
<p>The configuration packet can contain information to the CBL which lets
you: initialize external memory, read and write to all ETRAX100
registers, read and write to any part of memory, load as many other
files as you like to any part of memory you like, etc. The
configuration packet is generated on the fly by the SBL.</p>
<p>Since the CBL is unaware of which product it will be loaded on, it
doesn't do product specific initialization like setting up the
memory. This must be done with the configuration packet.</p>
<p>
</p>
<h2><a name="debugging_printout">Debugging printout</a></h2>
<p>When doing network boot the debugging printout from the CBL in ETRAX
is transmitted back over the network and printed by e100boot. When
doing serial boot that interface will be used. So in either case you
will not need any other software or hardware to receive the debugging
printout.</p>
<p>
</p>
<h2><a name="creating_binaries">Creating binaries</a></h2>
<p>The files containing code to be loaded on the ETRAX100 must be
stripped using the standard GCC binutils.</p>
<p>
</p>
<h2><a name="how_it_works__things_you_don_t_want_to_know_">How it works, things you don't want to know.</a></h2>
<p>ack, timeout bla, bla... RTFS.</p>
<p>
</p>
<h2><a name="compilation_and_code">Compilation and code</a></h2>
<p>Noteworthy is that two separate ETRAX100 binaries are created, one for
network boot and one for serial boot. They actually contain exactly
the same code, but linked in different order. This is because the code
to load the rest of the bootloader over a specific interface must be
contained in the first data sent to the ETRAX100 and it is too
difficult to cram the code for both interfaces in the beginning of the
same binary. Hence two files.</p>
<p>Other stuff you don't want to know is that the cache is mapped from
0x380000f0 to 0x380020f0. Code starts at the first address followed by
data up to the symbol <em>Ebss</em>. At the other end is the buffer for boot
commands (addresses defined by <em>IO_BUF_START</em> and <em>IO_BUF_END</em> below
which the stack lies and hopefully the stack and <em>Ebss</em> will never
meet...</p>
<p>The serial data is loaded from 0x380000f0 to 0x380003ff before
execution starts.</p>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<p>The options are done in the order specified on the command line, so
you probably want to do any memory setup before loading a file to the
memory, and you probably do not want to perform a memory test after
you have loaded a file to that memory.</p>
<p>All addresses and sizes must be in hex with optional '0x' prefix, or a
ETRAX100 register name. Since the <strong>--setreg</strong> and <strong>--getreg</strong> options
only can be performed on dword aligned dwords only the registers that
conform to this can be named.</p>
<p>Note also that all addresses must be in uncached memory (bit 31 set),
as the bootloader lies in the cache. If you access any uncached
address during boot, the bootloader will be destroyed without warning.</p>
<p>It is also possible to specify an address as <em>+address</em>, in which
case it is considered to be relative to <em>IO_BUF_START</em>. This is
especially useful in combination with the <strong>--loop</strong> option below.</p>
<dl>
<dt><strong><a name="item__2d_2dbaudrate_baudrate"><strong>--baudrate</strong> <em>baudrate</em></a></strong>
<dd>
<p>Set baudrate for files loaded after the boot loader.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dbootfile_filename"><strong>--bootfile</strong> <em>filename</em></a></strong>
<dd>
<p>Which boot image to send to ETRAX instead of the default ones.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dcmdsonly"><strong>--cmdsonly</strong></a></strong>
<dd>
<p>Write the commands to file e100boot.cmds.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2ddevboard"><strong>--devboard</strong></a></strong>
<dd>
<p>Sets registers for the developer board.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2ddevice_devicename"><strong>--device</strong> <em>devicename</em></a></strong>
<dd>
<p>Which device to send packets on. For network boot the default is
eth0. For serial boot it is ttyS0.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dfile_filename_7c_2d_address__5bsize_5d"><strong>--file</strong> <em>filename</em>|- <em>address</em> [<em>size</em>]</a></strong>
<dd>
<p>The file to load and the address to load it to. If file is loaded on
stdin, specify filename '-' followed by a size. Size need only be
given in this case. You can load as many files as you want, each
specified with a <strong>--file</strong>.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dflash_ram_2dsource_flash_2doffset_size"><strong>--flash</strong> <em>ram-source flash-offset size</em></a></strong>
<dd>
<p>Copies the specified RAM area to the flash.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dgetreg_address_7cregname"><strong>--getreg</strong> <em>address</em>|<em>regname</em></a></strong>
<dd>
<p>Print value of memory location. Must be uncached address.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dhelp"><strong>--help</strong></a></strong>
<dd>
<p>Print the help information.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dimages"><strong>--images</strong></a></strong>
<dd>
<p>Print information about the internal boot images, then exit.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2djump_address"><strong>--jump</strong> <em>address</em></a></strong>
<dd>
<p>Jump to specified address.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dlabel_label"><strong>--label</strong> <em>label</em></a></strong>
<dd>
<p>Define a label to be used as target by the <strong>--loop</strong> command. This
command is only used by the SBL to calculate the address for the
<strong>--loop</strong> and does not take up any space in the configuration packet.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dloop_check_2daddress_label"><strong>--loop</strong> <em>check-address label</em></a></strong>
<dd>
<p>If the contents of check-address is nonzero it is decremented and the
command parser continues parsing at the label.</p>
</dd>
<dd>
<p>If no external memory is initialized yet it can be convenient to use
an address in the area occupied by the configuration packet. Run
e100boot with <strong>--help</strong> to see which addresses the commands are stored
at. The size of the commands are four bytes for each command plus four
bytes per argument to the command.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dmemclear_start_2daddress_end_2daddress"><strong>--memclear</strong> <em>start-address end-address</em></a></strong>
<dd>
<p>Clears the specified memory area.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dmemdump_start_2daddress_end_2daddress"><strong>--memdump</strong> <em>start-address end-address</em></a></strong>
<dd>
<p>Prints the contents of the specified memory area.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dmemtest_start_2daddress_end_2daddress"><strong>--memtest</strong> <em>start-address end-address</em></a></strong>
<dd>
<p>Does a fairly extensive test of the specified memory area. Not only
catches defect memories but also catches things like wrong memory
setups where memory addresses are mirrored onto each other.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dnetwork"><strong>--network</strong></a></strong>
<dd>
<p>Perform a network boot.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dnoleds"><strong>--noleds</strong></a></strong>
<dd>
<p>When using the internal images use a version that does not toggle
general port PA or PB in ETRAX during the boot procedure.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dpause_iterations"><strong>--pause</strong> <em>iterations</em></a></strong>
<dd>
<p>How many <em>iterations</em> to do of an empty loop.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dserial"><strong>--serial</strong></a></strong>
<dd>
<p>Do a serial boot.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dsetreg_address_7cregname_value"><strong>--setreg</strong> <em>address</em>|<em>regname</em> <em>value</em></a></strong>
<dd>
<p>Load dword to dword aligned memory location.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dtestcard"><strong>--testcard</strong></a></strong>
<dd>
<p>Configures the memories for the ETRAX 100 testcard.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dtestcardlx"><strong>--testcardlx</strong></a></strong>
<dd>
<p>Configures the memories for the ETRAX100 LX testcard.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dtofiles"><strong>--tofiles</strong></a></strong>
<dd>
<p>Write packets to files e100boot.seq[0..]. Does not transmit the data.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2dverify_address_value"><strong>--verify</strong> <em>address value</em></a></strong>
<dd>
<p>Verify that memory contains dword. If not loader will stop. This is to
avoid booting the wrong unit. If you have the units ethernet address
in the flash memory you can check for that.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2d5400"><strong>--5400</strong></a></strong>
<dd>
<p>Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5400
printserver.</p>
</dd>
</li>
<dt><strong><a name="item__2d_2d5600"><strong>--5600</strong></a></strong>
<dd>
<p>Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5600
printserver.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p>If you have a stripped binary (file.ima) linked to 0x08000000 that you want
to boot via the network, do this:</p>
<p><strong>e100boot --file file.ima 88000000 --jump 08000000</strong></p>
<p>Or something like this. Sets waitstates to zero and loads two files,
the first from stdin:</p>
<p><strong>cat file.ima | e100boot --memtest 88000000 8801ffff --memclear
88000000 8801ffff --setreg b0000000 0 --getreg b0000000 --file -
88000000 a000 --file file2.ima 88010000 --memdump 88000000 880000ff
--jump 08000000</strong></p>
<p>Or this, enables 16 bit parallel port and flashes the led on PA0:</p>
<p><strong>e100boot --testcardlx --setreg R_PORT_PA_SET 0x00000000 --setreg
R_GEN_CONFIG 0x80000004 --setreg R_PAR0_CONFIG 0x00000200 --setreg
R_PORT_G_DATA 0x00000000 --pause 0x02000000 --setreg R_PORT_G_DATA
0xffffffff --pause 0x02000000 --setreg R_PORT_G_DATA 0x00000000 --loop
0x38001e0b 0x38001e60</strong></p>
<p>Setup the memory, test the SRAM, print the contents of the first 256
bytes of SRAM, clear SRAM, test the DRAM, print R_DMA_CH0_CMD, load a
file to SRAM, load another file to SRAM, load file to DRAM, jump to
code in SRAM.</p>
<p><strong>e100boot --setreg b0000000 1000 --setreg b0000008 00006543 --setreg
b000000c 12966060 --memtest 88000000 80000 --memdump 88000000 880000ff
--memclear 88000000 80000 --memtest c0000000 400000 --getreg b00001d0
--file file1.ima 88000000 --file file2.ima 88010000 --file file3.ima
c0000000 --jump 88000000</strong></p>
<p>Boot Linux on the testcard.</p>
<p><strong>e100boot --setreg b0000000 1000 --setreg b0000008 6557 --setreg
b000000c 1b988080 --file timage c0000500 --jump 40000500</strong></p>
<p>Booting over serial port and using labels to flash the leds on port
PA.</p>
<p><strong>e100boot --serial --device /dev/ttyS1 --baudrate 9600 --label first
--setreg 0x380020e0 00000001 --setreg R_PORT_PA_SET 0x0000ff00 --pause
0x02000000 --setreg R_PORT_PA_SET 0x0000ffff --pause 0x02000000 --loop
0x380020e0 first</strong></p>
<p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>You're kidding, right? Check <a href="#author">AUTHOR</a> below. The only thing
would be the hubris of the author, but that I consider a feature. If
you find any other 'features' report them to
<a href="mailto:technology@axis.com.">technology@axis.com.</a> Don't bother the author directly, he is busy
playing PlayStation2.</p>
<p>
</p>
<hr />
<h1><a name="copying">COPYING</a></h1>
<p>Copyright © 1996-2002 Axis Communications AB.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Written by Ronny Ranerup.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p>The fine source, which you can get at <a href="http://developer.axis.com.">http://developer.axis.com.</a></p>
</body>
</html>

View File

@ -0,0 +1,314 @@
=head1 NAME
e100boot - Network and serial port bootloader for the ETRAX100 CPU.
=head1 SYNOPSIS
B<e100boot> [B<--device> I<devicename>]
[B<--file> I<filename>|- I<addr> [I<size>]]
[B<--flash> I<ram-source> I<flash-offset> I<size>] [B<--pause> I<iter>]
[B<--memtest> I<addr> I<addr>] [B<--memclear> I<addr> I<addr>]
[B<--memdump> I<addr> I<addr>] [B<--setreg> I<addr>|I<regname> I<val>]
[B<--getreg> I<addr>|I<regname>] [B<--verify> I<addr> I<val>]
[B<--label> I<label>] [B<--loop> I<addr> I<label>] [B<--5400>] [B<--5600>]
[B<--testcard>] [B<--devboard>] [B<--testcardlx>] [B<--network>] [B<--serial>]
[B<--baudrate> I<baudrate>] [B<--bootfile> I<file>] [B<--jump> I<addr>]
[B<--tofiles>] [B<--cmdsonly>] [B<--images>] [B<--noleds>] [B<--help>]
=head1 DESCRIPTION
This boot loader facilitates loading of files over the network or a
serial port to an ETRAX100. It can also be used for fairly extensive
hardware debugging as you can read and write to any memory addresses,
including the ETRAX100 registers. You can also perform memory checks
and dumps and copy data to flash memories.
The first packet (or the first 784 bytes in the case of serial boot)
sent to Etrax100 is loaded into the cache. The code in this packet is
executed and loads the rest of the boot loader into the cache. The
cache is the only thing we can be sure of exists on all ETRAX100
products, so the boot loader is limited to the size of the cache,
8KB. If further boot loading code is needed you have to set up
external memory and load another boot loader into it, but this is
rarely needed.
Two programs are involved in this boot loading, one is the program on
your workstation that sends the packets to ETRAX100, this is called
the server boot loader or SBL. The other program is the one in
ETRAX100 that receives packets from the SBL and acts upon the data
therein, this is called the client boot loader or CBL.
We don't want to edit and recompile the CBL each time we want to load
level two to different parts of memory, like we do on different
products. We also want to change things like the setup of external
memory before we load data into it. To make the boot loading as
flexible as possible and separate the CBL from level two we send a
configuration packet to it. After this packet we load other files, if
we want to.
The configuration packet can contain information to the CBL which lets
you: initialize external memory, read and write to all ETRAX100
registers, read and write to any part of memory, load as many other
files as you like to any part of memory you like, etc. The
configuration packet is generated on the fly by the SBL.
Since the CBL is unaware of which product it will be loaded on, it
doesn't do product specific initialization like setting up the
memory. This must be done with the configuration packet.
=head2 Debugging printout
When doing network boot the debugging printout from the CBL in ETRAX
is transmitted back over the network and printed by e100boot. When
doing serial boot that interface will be used. So in either case you
will not need any other software or hardware to receive the debugging
printout.
=head2 Creating binaries
The files containing code to be loaded on the ETRAX100 must be
stripped using the standard GCC binutils.
=head2 How it works, things you don't want to know.
ack, timeout bla, bla... RTFS.
=head2 Compilation and code
Noteworthy is that two separate ETRAX100 binaries are created, one for
network boot and one for serial boot. They actually contain exactly
the same code, but linked in different order. This is because the code
to load the rest of the bootloader over a specific interface must be
contained in the first data sent to the ETRAX100 and it is too
difficult to cram the code for both interfaces in the beginning of the
same binary. Hence two files.
Other stuff you don't want to know is that the cache is mapped from
0x380000f0 to 0x380020f0. Code starts at the first address followed by
data up to the symbol I<Ebss>. At the other end is the buffer for boot
commands (addresses defined by I<IO_BUF_START> and I<IO_BUF_END> below
which the stack lies and hopefully the stack and I<Ebss> will never
meet...
The serial data is loaded from 0x380000f0 to 0x380003ff before
execution starts.
=head1 OPTIONS
The options are done in the order specified on the command line, so
you probably want to do any memory setup before loading a file to the
memory, and you probably do not want to perform a memory test after
you have loaded a file to that memory.
All addresses and sizes must be in hex with optional '0x' prefix, or a
ETRAX100 register name. Since the B<--setreg> and B<--getreg> options
only can be performed on dword aligned dwords only the registers that
conform to this can be named.
Note also that all addresses must be in uncached memory (bit 31 set),
as the bootloader lies in the cache. If you access any uncached
address during boot, the bootloader will be destroyed without warning.
It is also possible to specify an address as I<+address>, in which
case it is considered to be relative to I<IO_BUF_START>. This is
especially useful in combination with the B<--loop> option below.
=over 4
=item B<--baudrate> I<baudrate>
Set baudrate for files loaded after the boot loader.
=item B<--bootfile> I<filename>
Which boot image to send to ETRAX instead of the default ones.
=item B<--cmdsonly>
Write the commands to file e100boot.cmds.
=item B<--devboard>
Sets registers for the developer board.
=item B<--device> I<devicename>
Which device to send packets on. For network boot the default is
eth0. For serial boot it is ttyS0.
=item B<--file> I<filename>|- I<address> [I<size>]
The file to load and the address to load it to. If file is loaded on
stdin, specify filename '-' followed by a size. Size need only be
given in this case. You can load as many files as you want, each
specified with a B<--file>.
=item B<--flash> I<ram-source flash-offset size>
Copies the specified RAM area to the flash.
=item B<--getreg> I<address>|I<regname>
Print value of memory location. Must be uncached address.
=item B<--help>
Print the help information.
=item B<--images>
Print information about the internal boot images, then exit.
=item B<--jump> I<address>
Jump to specified address.
=item B<--label> I<label>
Define a label to be used as target by the B<--loop> command. This
command is only used by the SBL to calculate the address for the
B<--loop> and does not take up any space in the configuration packet.
=item B<--loop> I<check-address label>
If the contents of check-address is nonzero it is decremented and the
command parser continues parsing at the label.
If no external memory is initialized yet it can be convenient to use
an address in the area occupied by the configuration packet. Run
e100boot with B<--help> to see which addresses the commands are stored
at. The size of the commands are four bytes for each command plus four
bytes per argument to the command.
=item B<--memclear> I<start-address end-address>
Clears the specified memory area.
=item B<--memdump> I<start-address end-address>
Prints the contents of the specified memory area.
=item B<--memtest> I<start-address end-address>
Does a fairly extensive test of the specified memory area. Not only
catches defect memories but also catches things like wrong memory
setups where memory addresses are mirrored onto each other.
=item B<--network>
Perform a network boot.
=item B<--noleds>
When using the internal images use a version that does not toggle
general port PA or PB in ETRAX during the boot procedure.
=item B<--pause> I<iterations>
How many I<iterations> to do of an empty loop.
=item B<--serial>
Do a serial boot.
=item B<--setreg> I<address>|I<regname> I<value>
Load dword to dword aligned memory location.
=item B<--testcard>
Configures the memories for the ETRAX 100 testcard.
=item B<--testcardlx>
Configures the memories for the ETRAX100 LX testcard.
=item B<--tofiles>
Write packets to files e100boot.seq[0..]. Does not transmit the data.
=item B<--verify> I<address value>
Verify that memory contains dword. If not loader will stop. This is to
avoid booting the wrong unit. If you have the units ethernet address
in the flash memory you can check for that.
=item B<--5400>
Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5400
printserver.
=item B<--5600>
Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5600
printserver.
=back
=head1 EXAMPLES
If you have a stripped binary (file.ima) linked to 0x08000000 that you want
to boot via the network, do this:
B<e100boot --file file.ima 88000000 --jump 08000000>
Or something like this. Sets waitstates to zero and loads two files,
the first from stdin:
B<cat file.ima | e100boot --memtest 88000000 8801ffff --memclear
88000000 8801ffff --setreg b0000000 0 --getreg b0000000 --file -
88000000 a000 --file file2.ima 88010000 --memdump 88000000 880000ff
--jump 08000000>
Or this, enables 16 bit parallel port and flashes the led on PA0:
B<e100boot --testcardlx --setreg R_PORT_PA_SET 0x00000000 --setreg
R_GEN_CONFIG 0x80000004 --setreg R_PAR0_CONFIG 0x00000200 --setreg
R_PORT_G_DATA 0x00000000 --pause 0x02000000 --setreg R_PORT_G_DATA
0xffffffff --pause 0x02000000 --setreg R_PORT_G_DATA 0x00000000 --loop
0x38001e0b 0x38001e60>
Setup the memory, test the SRAM, print the contents of the first 256
bytes of SRAM, clear SRAM, test the DRAM, print R_DMA_CH0_CMD, load a
file to SRAM, load another file to SRAM, load file to DRAM, jump to
code in SRAM.
B<e100boot --setreg b0000000 1000 --setreg b0000008 00006543 --setreg
b000000c 12966060 --memtest 88000000 80000 --memdump 88000000 880000ff
--memclear 88000000 80000 --memtest c0000000 400000 --getreg b00001d0
--file file1.ima 88000000 --file file2.ima 88010000 --file file3.ima
c0000000 --jump 88000000>
Boot Linux on the testcard.
B<e100boot --setreg b0000000 1000 --setreg b0000008 6557 --setreg
b000000c 1b988080 --file timage c0000500 --jump 40000500>
Booting over serial port and using labels to flash the leds on port
PA.
B<e100boot --serial --device /dev/ttyS1 --baudrate 9600 --label first
--setreg 0x380020e0 00000001 --setreg R_PORT_PA_SET 0x0000ff00 --pause
0x02000000 --setreg R_PORT_PA_SET 0x0000ffff --pause 0x02000000 --loop
0x380020e0 first>
=head1 BUGS
You're kidding, right? Check L<AUTHOR|"AUTHOR"> below. The only thing
would be the hubris of the author, but that I consider a feature. If
you find any other 'features' report them to
technology@axis.com. Don't bother the author directly, he is busy
playing PlayStation2.
=head1 COPYING
Copyright © 1996-2002 Axis Communications AB.
=head1 AUTHOR
Written by Ronny Ranerup.
=head1 SEE ALSO
The fine source, which you can get at http://developer.axis.com.

View File

@ -0,0 +1,2 @@
.

View File

@ -0,0 +1,2 @@
.

View File

@ -0,0 +1,267 @@
@(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/CHANGES,v 1.1 1999/08/26 10:05:17 johana Exp $ (LBL)
v0.4 Sat Jul 25 12:40:09 PDT 1998
- Fix endian problem with DLT_NULL devices. From FreeBSD via Bill
Fenner (fenner@parc.xerox.com)
- Fix alignment problem with FDDI under DLPI. This was causing core
dumps under Solaris.
- Added configure options to disable flex and bison. Resulted from a
bug report by barnett@grymoire.crd.ge.com (Bruce Barnett). Also added
options to disable gcc and to force a particular packet capture type.
- Added support for Fore ATM interfaces (qaa and fa) under IRIX. Thanks
to John Hawkinson (jhawk@mit.edu)
- Change Linux PPP and SLIP to use DLT_RAW since the kernel does not
supply any "link layer" data.
- Change Linux to use SIOCGIFHWADDR ioctl to determine link layer type.
Thanks to Thomas Sailer (sailer@ife.ee.ethz.ch)
- Change IRIX PPP to use DLT_RAW since the kernel does not supply any
"link layer" data.
- Modified to support the new BSD/OS 2.1 PPP and SLIP link layer header
formats.
- Added some new SGI snoop interface types. Thanks to Steve Alexander
(sca@refugee.engr.sgi.com)
- Fixes for HP-UX 10.20 (which is similar to HP-UX 9). Thanks to
Richard Allen (ra@hp.is) and Steinar Haug (sthaug@nethelp.no)
- Fddi supports broadcast as reported by Jeff Macdonald
(jeff@iacnet.com). Also correct ieee802 and arcnet.
- Determine Linux pcap buffer size at run time or else it might not be
big enough for some interface types (e.g. FDDI). Thanks to Jes
Sorensen (Jes.Sorensen@cern.ch)
- Fix some linux alignment problems.
- Document promisc argument to pcap_open_live(). Reported by Ian Marsh
(ianm@sics.se)
- Support Metricom radio packets under Linux. Thanks to Kevin Lai
(laik@gunpowder.stanford.edu)
- Bind to interface name under Linux to avoid packets from multiple
interfaces on multi-homed hosts. Thanks to Kevin Lai
(laik@gunpowder.stanford.edu)
- Change L_SET to SEEK_SET for HP-UX. Thanks to Roland Roberts
(rroberts@muller.com)
- Fixed an uninitialized memory reference found by Kent Vander Velden
(graphix@iastate.edu)
- Fixed lex pattern for IDs to allow leading digits. As reported by
Theo de Raadt (deraadt@cvs.openbsd.org)
- Fixed Linux include file problems when using GNU libc.
- Ifdef ARPHRD_FDDI since not all versions of the Linux kernel have it.
Reported reported by Eric Jacksch (jacksch@tenebris.ca)
- Fixed bug in pcap_dispatch() that kept it from returning on packet
timeouts.
- Changed ISLOOPBACK() macro when IFF_LOOPBACK isn't available to check
for "lo" followed by an eos or digit (newer versions of Linux
apparently call the loopback "lo" instead of "lo0").
- Fixed Linux networking include files to use ints instead of longs to
avoid problems with 64 bit longs on the alpha. Thanks to Cristian
Gafton (gafton@redhat.com)
v0.3 Sat Nov 30 20:56:27 PST 1996
- Added Linux support.
- Fixed savefile bugs.
- Solaris x86 fix from Tim Rylance (t.rylance@elsevier.nl)
- Add support for bpf kernel port filters.
- Remove duplicate atalk protocol table entry. Thanks to Christian
Hopps (chopps@water.emich.edu)
- Fixed pcap_lookupdev() to ignore nonexistent devices. This was
reported to happen under BSD/OS by David Vincenzetti
(vince@cryptonet.it)
- Avoid solaris compiler warnings. Thanks to Bruce Barnett
(barnett@grymoire.crd.ge.com)
v0.2.1 Sun Jul 14 03:02:26 PDT 1996
- Fixes for HP-UX 10. Thanks in part to to Thomas Wolfram
(wolf@prz.tu-berlin.de) and Rick Jones (raj@hpisrdq.cup.hp.com)
- Added support for SINIX. Thanks to Andrej Borsenkow
(borsenkow.msk@sni.de)
- Fixes for AIX (although this system is not yet supported). Thanks to
John Hawkinson (jhawk@mit.edu)
- Use autoconf's idea of the top level directory in install targets.
Thanks to John Hawkinson.
- Add missing autoconf packet capture result message. Thanks to Bill
Fenner (fenner@parc.xerox.com)
- Fixed padding problems in the pf module.
- Fixed some more alignment problems on the alpha.
- Added explicit netmask support. Thanks to Steve Nuchia
(steve@research.oknet.com)
- Fixed to handle raw ip addresses such as 0.0.0.1 without "left
justifing"
- Add "sca" keyword (for DEC cluster services) as suggested by Terry
Kennedy (terry@spcvxa.spc.edu)
- Add "atalk" keyword as suggested by John Hawkinson.
- Add "igrp" keyword.
- Fixed HID definition in grammar.y to be a string, not a value.
- Use $CC when checking gcc version. Thanks to Carl Lindberg
(carl_lindberg@blacksmith.com)
- Removed obsolete reference to pcap_immediate() from the man page.
Michael Stolarchuk (mts@terminator.rs.itd.umich.edu)
- DLT_NULL has a 4 byte family header. Thanks to Jeffrey Honig
(jch@bsdi.com)
v0.2 Sun Jun 23 02:28:42 PDT 1996
- Add support for HP-UX. Resulted from code contributed by Tom Murray
(tmurray@hpindck.cup.hp.com) and Philippe-Andri Prindeville
(philipp@res.enst.fr)
- Update INSTALL with a reminder to install include files. Thanks to
Mark Andrews (mandrews@aw.sgi.com)
- Fix bpf compiler alignment bug on the alpha.
- Use autoconf to detect architectures that can't handle misaligned
accesses.
- Added loopback support for snoop. Resulted from report Steve
Alexander (sca@engr.sgi.com)
v0.1 Fri Apr 28 18:11:03 PDT 1995
- Fixed compiler and optimizer bugs. The BPF filter engine uses unsigned
comparison operators, while the code generator and optimizer assumed
signed semantics in several places. Thanks to Charlie Slater
(cslater@imatek.com) for pointing this out.
- Removed FDDI ifdef's, they aren't really needed. Resulted from report
by Gary Veum (veum@boa.gsfc.nasa.gov).
- Add pcap-null.c which allows offline use of libpcap on systems that
don't support live package capture. This feature resulting from a
request from Jan van Oorschot (j.p.m.voorschot@et.tudelft.nl).
- Make bpf_compile() reentrant. Fix thanks to Pascal Hennequin
(Pascal.Hennequin@hugo.int-evry.fr).
- Port to GNU autoconf.
- Fix pcap-dlpi.c to work with isdn. Resulted from report by Flemming
Johansen (fsj@csd.cri.dk).
- Handle multi-digit interface unit numbers (aka ppa's) under dlpi.
Resulted from report by Daniel Ehrlich (ehrlich@cse.psu.edu).
- Fix pcap-dlpi.c to work in non-promiscuous mode. Resulted from report
by Jeff Murphy (jcmurphy@acsu.buffalo.edu).
- Add support for "long jumps". Thanks to Jeffrey Mogul
(mogul@pa.dec.com).
- Fix minor problems when compiling with BDEBUG as noticed by Scott
Bertilson (scott@unet.umn.edu).
- Declare sys_errlist "const char *const" to avoid problems under
FreeBSD. Resulted from report by jher@eden.com.
v0.0.6 Fri Apr 28 04:07:13 PDT 1995
- Add missing variable declaration missing from 0.0.6
v0.0.5 Fri Apr 28 00:22:21 PDT 1995
- Workaround for problems when pcap_read() returns 0 due to the timeout
expiring.
v0.0.4 Thu Apr 20 20:41:48 PDT 1995
- Change configuration to not use gcc v2 flags with gcc v1.
- Fixed a bug in pcap_next(); if pcap_dispatch() returns 0, pcap_next()
should also return 0. Thanks to Richard Stevens (rstevens@noao.edu).
- Fixed configure to test for snoop before dlpi to avoid problems under
IRIX 5. Thanks to J. Eric Townsend (jet@abulafia.genmagic.com).
- Hack around deficiency in Ultrix's make.
- Fix two bugs related to the Solaris pre-5.3.2 bufmod bug; handle
savefiles that have more than snapshot bytes of data in them (so we
can read old savefiles) and avoid writing such files.
- Added checkioctl which is used with gcc to check that the
"fixincludes" script has been run.
v0.0.3 Tue Oct 18 18:13:46 PDT 1994
- Fixed configure to test for snoop before dlpi to avoid problems under
IRIX 5. Thanks to J. Eric Townsend (jet@abulafia.genmagic.com).
v0.0.2 Wed Oct 12 20:56:37 PDT 1994
- Implement timeout in the dlpi pcap_open_live(). Thanks to Richard
Stevens.
- Determine pcap link type from dlpi media type. Resulted from report
by Mahesh Jethanandani (mahesh@npix.com).
v0.0.1 Fri Jun 24 14:50:57 PDT 1994
- Fixed bug in nit_setflags() in pcap-snit.c. The streams ioctl timeout
wasn't being initialized sometimes resulting in an "NIOCSFLAGS:
Invalid argument" error under OSF/1. Reported by Matt Day
(mday@artisoft.com) and Danny Mitzel (dmitzel@whitney.hitc.com).
- Turn on FDDI support by default.
v0.0 Mon Jun 20 19:20:16 PDT 1994
- Initial release.
- Fixed bug with greater/less keywords, reported by Mark Andrews
(mandrews@alias.com).
- Fix bug where '|' was defined as BPF_AND instead of BPF_OR, reported
by Elan Amir (elan@leeb.cs.berkeley.edu).
- Machines with little-endian byte ordering are supported thanks to
Jeff Mogul.
- Add hack for version 2.3 savefiles which don't have caplen and len
swapped thanks to Vern Paxson.
- Added "&&" and "||" aliases for "and" and "or" thanks to Vern Paxson.
- Added length, inbound and outbound keywords.

View File

@ -0,0 +1,50 @@
CHANGES
FILES
INSTALL
Makefile.in
README
SUNOS4
VERSION
aclocal.m4
bpf/net/bpf.h
bpf/net/bpf_filter.c
bpf_image.c
config.guess
config.sub
configure
configure.in
etherent.c
ethertype.h
gencode.c
gencode.h
grammar.y
inet.c
install-sh
lbl/gnuc.h
lbl/os-solaris2.h
lbl/os-sunos4.h
lbl/os-ultrix4.h
linux-include/netinet/if_ether.h
linux-include/netinet/ip_var.h
mkdep
nametoaddr.c
optimize.c
pcap-bpf.c
pcap-dlpi.c
pcap-enet.c
pcap-int.h
pcap-linux.c
pcap-namedb.h
pcap-nit.c
pcap-nit.h
pcap-null.c
pcap-pf.c
pcap-pf.h
pcap-snit.c
pcap-snoop.c
pcap.3
pcap.c
pcap.h
ppp.h
savefile.c
scanner.l

View File

@ -0,0 +1,328 @@
@(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/INSTALL,v 1.1 1999/08/26 10:05:18 johana Exp $ (LBL)
To build libpcap, first customize any paths in Makefile.in, then run
"./configure" (a shell script). The configure script will determine
your system attributes and generate an appropriate Makefile from
Makefile.in. Next run "make". If everything goes well you can su to
root and run "make install", "make install-incl" and "make
install-man". However, you need not install libpcap if you just want to
build tcpdump; just make sure the tcpdump and libpcap directory trees
have the same parent directory.
If configure says:
configure: warning: cannot determine packet capture interface
configure: warning: (see INSTALL for more info)
then your system either does not support packet capture or your system
does support packet capture but libpcap does not support that
particular type. (If you have HP-UX, see below.) If your system uses a
packet capture not supported by libpcap, please send us patches; don't
forget to include an autoconf fragment suitable for use in
configure.in.
It is possible to override the default packet capture type, although
the circumstance where this works are limited. For example if you have
installed bpf under SunOS 4 and wish to build a snit libpcap:
./configure --with-pcap=snit
Another example is to force a supported packet capture type in the case
where the configure scripts fails to detect it.
You will need an ANSI C compiler to build libpcap. The configure script
will abort if your compiler is not ANSI compliant. If this happens, use
the GNU C compiler, available via anonymous ftp:
ftp://prep.ai.mit.edu/pub/gnu/gcc-*.tar.gz
Note well: If you use gcc, you may need to run its "fixincludes"
script. Running fixincludes is not required with later versions of gcc
and in some cases (e.g. Solaris 2.5) causes problems when run. The
configure script will abort with:
checking for ANSI ioctl definitions... yes
configure: error: see the INSTALL for more info
if it detects if the fixincludes needs to be run. If the fixincludes
test in configure passes, you're probably ok.
If you use flex, you must use version 2.4.6 or higher. The configure
script automatically detects the version of flex and will not use it
unless it is new enough. You can use "flex -V" to see what version you
have (unless it's really old). The current version of flex is available
via anonymous ftp:
ftp://ftp.ee.lbl.gov/flex-*.tar.Z
As of this writing, the current version is 2.5.4.
If you use bison, you must use flex (and visa versa). The configure
script automatically falls back to lex and yacc if both flex and bison
are not found.
Sometimes the stock C compiler does not interact well with flex and
bison. The list of problems includes undefined references for alloca.
You can get around this by installing gcc or manually disabling flex
and bison with:
./configure --without-flex --without-bison
If your system only has AT&T lex, this is okay unless your libpcap
program uses other lex/yacc generated code. (Although it's possible to
map the yy* identifiers with a script, we use flex and bison so we
don't feel this is necessary.)
Some systems support the Berkeley Packet Filter natively; for example
out of the box OSF and BSD/OS have bpf. If your system does not support
bpf, you will need to pick up:
ftp://ftp.ee.lbl.gov/bpf-*.tar.Z
Note well: you MUST have kernel source for your operating system in
order to install bpf. An exception is SunOS 4; the bpf distribution
includes replacement kernel objects for some of the standard SunOS 4
network device drivers. See the bpf INSTALL document for more
information.
If you use Solaris, there is a bug with bufmod(7) that is fixed in
Solaris 2.3.2 (aka SunOS 5.3.2). Setting a snapshot length with the
broken bufmod(7) results in data be truncated from the FRONT of the
packet instead of the end. The work around is to not set a snapshot
length but this results in performance problems since the entire packet
is copied to user space. If you must run an older version of Solaris,
there is a patch available from Sun; ask for bugid 1149065. After
installing the patch, use "setenv BUFMOD_FIXED" to enable use of
bufmod(7). However, we recommend you run a more current release of
Solaris.
If you use the SPARCompiler, you must be careful to not use the
/usr/ucb/cc interface. If you do, you will get bogus warnings and
perhaps errors. Either make sure your path has /opt/SUNWspro/bin
before /usr/ucb or else:
setenv CC /opt/SUNWspro/bin/cc
before running configure. (You might have to do a "make distclean"
if you already ran configure once).
Also note that "make depend" won't work; while all of the known
universe uses -M, the SPARCompiler uses -xM to generate makefile
dependencies.
If you are trying to do packet capture with a FORE ATM card, you may or
may not be able to. They usually only release their driver in object
code so unless their driver supports packet capture, there's not much
libpcap can do.
If you get an error like:
tcpdump: recv_ack: bind error 0x???
when using DLPI, look for the DL_ERROR_ACK error return values, usually
in /usr/include/sys/dlpi.h, and find the corresponding value.
Under OSF, packet capture must be enabled before it can be used. For
instructions on how to enable packet filter support, see:
ftp://ftp.digital.com/pub/Digital/dec-faq/Digital-UNIX
Once you enable packet filter support, your OSF system will support bpf
natively.
Under Ultrix, packet capture must be enabled before it can be used. For
instructions on how to enable packet filter support, see:
ftp://ftp.digital.com/pub/Digital/dec-faq/ultrix
If you use HP-UX, you must have at least version 9 and either the
version of cc that supports ANSI C (cc -Aa) or else use the GNU C
compiler. You must also buy the optional streams package. If you don't
have:
/usr/include/sys/dlpi.h
/usr/include/sys/dlpi_ext.h
then you don't have the streams package. In addition, we believe you
need to install the "9.X LAN and DLPI drivers cumulative" patch
(PHNE_6855) to make the version 9 DLPI work with libpcap.
It's been reported that the DLPI streams package is standard starting
with HP-UX 10.
The HP implementation of DLPI is a little bit eccentric. Unlike
Solaris, you must attach /dev/dlpi instead of the specific /dev/*
network pseudo device entry in order to capture packets. The ppa is
based on the ifnet "index" number. Under HP-UX 9, it is necessary to
read /dev/kmem and the kernel symbol file (/hp-ux). Under HP-UX 10,
dlpi can provide information for determining the ppa. It does not seem
to be possible to trace the loopback interface. Unlike other DLPI
implementations, PHYS implies MULTI and SAP and you get an error if you
try to enable more than one promiscous more than one promiscuous mode
at a time. Finally, testing shows that there can't be more than one
simultaneous dlpi user per network interface and you cannot capture
outbound packets.
If you use Linux, this version of libpcap is known to compile and run
under Red Hat 4.0 with the 2.0.25 kernel. It may work with earlier 2.X
versions but is guaranteed not to work with 1.X kernels. Running more
than one libpcap program at a time can cause problems since promiscuous
mode is implemented by twiddlin the interface flags from the libpcap
application. Also, packet timestamps aren't very good. This appears to
be due to haphazard handling of the timestamp in the kernel.
Note well: there is rumoured to be a version of tcpdump floating around
called 3.0.3 that includes libpcap and is supposed to support Linux.
You should be advised that the Network Research Group at LBNL never
generated a release with this version number. We note with interest
that a standard cracker trick to get people to install trojans is to
distribute bogus packages that have a version number higher than the
current release. We also note with annoyance that 90% of the Linux
related bug reports we get are due to changes made to unofficial
versions of our page. If you are having trouble but aren't using a
version that came from ftp.ee.lbl.gov, please try that before
submitting a bug report!
If you use AIX, you may not be able to build libpcap from this release.
Although AIX 4 ships with tcpdump, it is an old version that predates
libpcap. We do not have an AIX system in house so it's impossible for
us to test AIX patches submitted to us. We are told that you must link
against /lib/pse.exp, that you must use AIX cc or a GNU C compiler
newer than 2.7.2 and that you may need to run strload before running a
libpcap application. Also, it may be necessary to run the configure
script as root in order for it to detect that bpf is available. Another
workaround is to use:
./configure --with-pcap=bpf
If you use NeXTSTEP, you will not be able to build libpcap from this
release. We hope to support this operating system in some future
release of libpcap.
If you use SINIX, you should be able to build libpcap from this
release. It is known to compile and run on SINIX-Y/N 5.42 with the C-DS
V1.0 or V1.1 compiler. But note that in some releases of SINIX, yacc
emits incorrect code; if grammar.y fails to compile, change every
occurence of:
#ifdef YYDEBUG
to:
#if YYDEBUG
Another workaround is to use flex and bison.
If you use SCO, you might have trouble building libpcap from this
release. We do not have a machine running SCO and have not had reports
of anyone successfully building on it. Since SCO apparently supports
dlpi, it's possible the current version works. Meanwhile, sco provides
a tcpdump binary as part of their "Network/Security Tools" package:
http://www.sco.com/technology/internet/goodies/#SECURITY
There is also a README that explains how to enable packet capture.
If you use UnixWare, you will not be able to build libpcap from this
release. We hope to support this operating system in some future
release of libpcap. Meanwhile, there appears to be an UnixWare port of
libpcap 0.0 (and tcpdump 3.0) in:
ftp://ftp1.freebird.org/pub/mirror/freebird/internet/systools/
UnixWare appears to use a hacked version of DLPI.
If linking tcpdump fails with "Undefined: _alloca" when using bison on
a Sun4, your version of bison is broken. In any case version 1.16 or
higher is recommended (1.14 is known to cause problems 1.16 is known to
work). Either pick up a current version from:
ftp://prep.ai.mit.edu/pub/gnu/bison.tar.gz
or hack around it by inserting the lines:
#ifdef __GNUC__
#define alloca __builtin_alloca
#else
#ifdef sparc
#include <alloca.h>
#else
char *alloca ();
#endif
#endif
right after the (100 line!) GNU license comment in bison.simple, remove
grammar.[co] and fire up make again.
If you use SunOS 4, your kernel must support streams NIT. If you run a
libpcap program and it dies with:
/dev/nit: No such device
You must add streams NIT support to your kernel configuration, run
config and boot the new kernel.
If you are running a version of SunOS earlier than 4.1, you will need
to replace the Sun supplied /sys/sun{3,4,4c}/OBJ/nit_if.o with the
appropriate version from this distribution's SUNOS4 subdirectory and
build a new kernel:
nit_if.o.sun3-sunos4 (any flavor of sun3)
nit_if.o.sun4c-sunos4.0.3c (SS1, SS1+, IPC, SLC, etc.)
nit_if.o.sun4-sunos4 (Sun4's not covered by
nit_if.o.sun4c-sunos4.0.3c)
These nit replacements fix a bug that makes nit essentially unusable in
pre-SunOS 4.1. In addition, our sun4c-sunos4.0.3c nit gives you
timestamps to the resolution of the SS-1 clock (1 us) rather than the
lousy 20ms timestamps Sun gives you (tcpdump will print out the full
timestamp resolution if it finds it's running on a SS-1).
FILES
-----
CHANGES - description of differences between releases
FILES - list of files exported as part of the distribution
INSTALL - this file
Makefile.in - compilation rules (input to the configure script)
README - description of distribution
SUNOS4 - pre-SunOS 4.1 replacement kernel nit modules
VERSION - version of this release
aclocal.m4 - autoconf macros
bpf/net - copies of bpf_filter.c and bpf.h
bpf_filter.c - symlink to bpf/net/bpf_filter.c
bpf_image.c - bpf disassembly routine
config.guess - autoconf support
config.sub - autoconf support
configure - configure script (run this first)
configure.in - configure script source
etherent.c - /etc/ethers support routines
ethertype.h - ethernet protocol types and names definitions
gencode.c - bpf code generation routines
gencode.h - bpf code generation definitions
grammar.y - filter string grammar
inet.c - network routines
install-sh - BSD style install script
lbl/gnuc.h - gcc macros and defines
lbl/os-*.h - os dependent defines and prototypes
linux-include/* - network include files missing on Linux
mkdep - construct Makefile dependency list
nametoaddr.c - hostname to address routines
net - symlink to bpf/net
optimize.c - bpf optimization routines
pcap-bpf.c - BSD Packet Filter support
pcap-dlpi.c - Data Link Provider Interface support
pcap-enet.c - enet support
pcap-int.h - internal libpcap definitions
pcap-namedb.h - public libpcap name database definitions
pcap-nit.c - Network Interface Tap support
pcap-nit.h - Network Interface Tap definitions
pcap-null.c - dummy monitor support (allows offline use of libpcap)
pcap-pf.c - Packet Filter support
pcap-pf.h - Packet Filter definitions
pcap-snit.c - Streams based Network Interface Tap support
pcap-snoop.c - Snoop network monitoring support
pcap.3 - manual entry
pcap.c - pcap utility routines
pcap.h - public libpcap definitions
ppp.h - Point to Point Protocol definitions
savefile.c - offline support
scanner.l - filter string scanner

View File

@ -0,0 +1,173 @@
# Generated automatically from Makefile.in by configure.
# $Id: Makefile.in,v 1.7 2002/09/18 15:29:46 pkj Exp $
# Copyright (c) 1993, 1994, 1995, 1996
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that: (1) source code distributions
# retain the above copyright notice and this paragraph in its entirety, (2)
# distributions including binary code include the above copyright notice and
# this paragraph in its entirety in the documentation or other materials
# provided with the distribution, and (3) all advertising materials mentioning
# features or use of this software display the following acknowledgement:
# ``This product includes software developed by the University of California,
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
# the University nor the names of its contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/Makefile.in,v 1.7 2002/09/18 15:29:46 pkj Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
#
# Top level hierarchy
prefix = /usr/local
exec_prefix = ${prefix}
# Pathname of directory to install the include files
INCLDEST = ${prefix}/include
# Pathname of directory to install the library
LIBDEST = ${exec_prefix}/lib
# Pathname of directory to install the man page
MANDEST = ${prefix}/man
# VPATH
srcdir = .
#
# You shouldn't need to edit anything below.
#
CFLAGS =
CC = gcc
AR = ar
INSTALL = install_elinux -p
RANLIB = ranlib
prefix =
AXIS_USABLE_LIBS = UCLIBC GLIBC
-include $(AXIS_TOP_DIR)/tools/build/Rules.axis
ifndef AXIS_BUILDTYPE
prefix = /usr/local
endif
CCOPT = -O2
INCLS = -I. -Ilinux-include
DEFS = -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1
# Standard CFLAGS
CFLAGS += $(CCOPT) $(INCLS) $(DEFS)
#
# Flex and bison allow you to specify the prefixes of the global symbols
# used by the generated parser. This allows programs to use lex/yacc
# and link against libpcap. If you don't have flex or bison, get them.
#
LEX = flex -Ppcap_
YACC = bison -y -p pcap_
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
.c.o:
@rm -f $@
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
PSRC = pcap-linux.c
CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \
etherent.c savefile.c bpf_filter.c bpf_image.c
GENSRC = scanner.c grammar.c version.c
SRC = $(PSRC) $(CSRC) $(GENSRC)
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
# hack the extra indirection
OBJ = $(PSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o)
HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
ethertype.h gencode.h gnuc.h
GENHDR = \
tokdefs.h
TAGHDR = \
bpf/net/bpf.h
TAGFILES = \
$(SRC) $(HDR) $(TAGHDR)
CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
all: libpcap.a
libpcap.a: $(OBJ)
@rm -f $@
$(AR) rc $@ $(OBJ)
$(RANLIB) $@
scanner.c: $(srcdir)/scanner.l
@rm -f $@
$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
scanner.o: scanner.c tokdefs.h
tokdefs.h: grammar.c
grammar.c: $(srcdir)/grammar.y
@rm -f grammar.c tokdefs.h
$(YACC) -d $<
mv y.tab.c grammar.c
mv y.tab.h tokdefs.h
grammar.o: grammar.c
@rm -f $@
$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
version.o: version.c
version.c: $(srcdir)/VERSION
@rm -f $@
sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
install: force
$(INSTALL) -m 444 -o bin -g bin libpcap.a $(DESTDIR)$(LIBDEST)/libpcap.a
$(RANLIB) $(DESTDIR)$(LIBDEST)/libpcap.a
install-incl: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.h \
$(DESTDIR)$(INCLDEST)/pcap.h
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap-namedb.h \
$(DESTDIR)$(INCLDEST)/pcap-namedb.h
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/net/bpf.h \
$(DESTDIR)$(INCLDEST)/net/bpf.h
install-man: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.3 \
$(DESTDIR)$(MANDEST)/man3/pcap.3
clean:
rm -f $(CLEANFILES)
distclean:
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
gnuc.h os-proto.h bpf_filter.c net
tags: $(TAGFILES)
ctags -wtd $(TAGFILES)
tar: force
@cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
list="" ; tar="tar chFFf" ; \
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
echo \
"rm -f ../$$name; ln -s $$dir ../$$name" ; \
rm -f ../$$name; ln -s $$dir ../$$name ; \
echo \
"(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
(cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
echo \
"rm -f ../$$name" ; \
rm -f ../$$name
force: /tmp
depend: $(GENSRC) force
./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)

View File

@ -0,0 +1,2 @@
conf:
./configure

View File

@ -0,0 +1,173 @@
# $Id: Makefile.in,v 1.7 2002/09/18 15:29:46 pkj Exp $
# Copyright (c) 1993, 1994, 1995, 1996
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that: (1) source code distributions
# retain the above copyright notice and this paragraph in its entirety, (2)
# distributions including binary code include the above copyright notice and
# this paragraph in its entirety in the documentation or other materials
# provided with the distribution, and (3) all advertising materials mentioning
# features or use of this software display the following acknowledgement:
# ``This product includes software developed by the University of California,
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
# the University nor the names of its contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/Makefile.in,v 1.7 2002/09/18 15:29:46 pkj Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
#
# Top level hierarchy
prefix = @prefix@
exec_prefix = @exec_prefix@
# Pathname of directory to install the include files
INCLDEST = @includedir@
# Pathname of directory to install the library
LIBDEST = @libdir@
# Pathname of directory to install the man page
MANDEST = @mandir@
# VPATH
srcdir = @srcdir@
VPATH = @srcdir@
#
# You shouldn't need to edit anything below.
#
CFLAGS =
CC = @CC@
AR = ar
INSTALL = @INSTALL@
RANLIB = @V_RANLIB@
prefix =
AXIS_USABLE_LIBS = UCLIBC GLIBC
-include $(AXIS_TOP_DIR)/tools/build/Rules.axis
ifndef AXIS_BUILDTYPE
prefix = @prefix@
endif
CCOPT = @V_CCOPT@
INCLS = -I. @V_INCLS@
DEFS = @DEFS@
# Standard CFLAGS
CFLAGS += $(CCOPT) $(INCLS) $(DEFS)
#
# Flex and bison allow you to specify the prefixes of the global symbols
# used by the generated parser. This allows programs to use lex/yacc
# and link against libpcap. If you don't have flex or bison, get them.
#
LEX = @V_LEX@
YACC = @V_YACC@
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
.c.o:
@rm -f $@
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
PSRC = pcap-@V_PCAP@.c
CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \
etherent.c savefile.c bpf_filter.c bpf_image.c
GENSRC = scanner.c grammar.c version.c
SRC = $(PSRC) $(CSRC) $(GENSRC)
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
# hack the extra indirection
OBJ = $(PSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o)
HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
ethertype.h gencode.h gnuc.h
GENHDR = \
tokdefs.h
TAGHDR = \
bpf/net/bpf.h
TAGFILES = \
$(SRC) $(HDR) $(TAGHDR)
CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
all: libpcap.a
libpcap.a: $(OBJ)
@rm -f $@
$(AR) rc $@ $(OBJ)
$(RANLIB) $@
scanner.c: $(srcdir)/scanner.l
@rm -f $@
$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
scanner.o: scanner.c tokdefs.h
tokdefs.h: grammar.c
grammar.c: $(srcdir)/grammar.y
@rm -f grammar.c tokdefs.h
$(YACC) -d $<
mv y.tab.c grammar.c
mv y.tab.h tokdefs.h
grammar.o: grammar.c
@rm -f $@
$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
version.o: version.c
version.c: $(srcdir)/VERSION
@rm -f $@
sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
install: force
$(INSTALL) -m 444 -o bin -g bin libpcap.a $(DESTDIR)$(LIBDEST)/libpcap.a
$(RANLIB) $(DESTDIR)$(LIBDEST)/libpcap.a
install-incl: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.h \
$(DESTDIR)$(INCLDEST)/pcap.h
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap-namedb.h \
$(DESTDIR)$(INCLDEST)/pcap-namedb.h
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/net/bpf.h \
$(DESTDIR)$(INCLDEST)/net/bpf.h
install-man: force
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.3 \
$(DESTDIR)$(MANDEST)/man3/pcap.3
clean:
rm -f $(CLEANFILES)
distclean:
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
gnuc.h os-proto.h bpf_filter.c net
tags: $(TAGFILES)
ctags -wtd $(TAGFILES)
tar: force
@cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
list="" ; tar="tar chFFf" ; \
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
echo \
"rm -f ../$$name; ln -s $$dir ../$$name" ; \
rm -f ../$$name; ln -s $$dir ../$$name ; \
echo \
"(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
(cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
echo \
"rm -f ../$$name" ; \
rm -f ../$$name
force: /tmp
depend: $(GENSRC) force
./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)

View File

@ -0,0 +1,49 @@
@(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/README,v 1.1 1999/08/26 10:05:19 johana Exp $ (LBL)
LIBPCAP 0.4
Lawrence Berkeley National Laboratory
Network Research Group
libpcap@ee.lbl.gov
ftp://ftp.ee.lbl.gov/libpcap.tar.Z
This directory contains source code for libpcap, a system-independent
interface for user-level packet capture. libpcap provides a portable
framework for low-level network monitoring. Applications include
network statistics collection, security monitoring, network debugging,
etc. Since almost every system vendor provides a different interface
for packet capture, and since we've developed several tools that
require this functionality, we've created this system-independent API
to ease in porting and to alleviate the need for several
system-dependent packet capture modules in each application.
Note well: this interface is new and is likely to change.
The libpcap interface supports a filtering mechanism based on the
architecture in the BSD packet filter. BPF is described in the 1993
Winter Usenix paper ``The BSD Packet Filter: A New Architecture for
User-level Packet Capture''. A compressed postscript version is in:
ftp://ftp.ee.lbl.gov/papers/bpf-usenix93.ps.Z.
Although most packet capture interfaces support in-kernel filtering,
libpcap utilizes in-kernel filtering only for the BPF interface.
On systems that don't have BPF, all packets are read into user-space
and the BPF filters are evaluated in the libpcap library, incurring
added overhead (especially, for selective filters). Ideally, libpcap
would translate BPF filters into a filter program that is compatible
with the underlying kernel subsystem, but this is not yet implemented.
BPF is standard in 4.4BSD, BSD/386, NetBSD, and FreeBSD. DEC OSF/1
uses the packetfilter interface but has been extended to accept BPF
filters (which libpcap utilizes). Also, you can add BPF filter support
to Ultrix using the kernel source and/or object patches available in:
ftp://gatekeeper.dec.com/pub/DEC/net/bpfext42.tar.Z.
Problems, bugs, questions, desirable enhancements, source code
contributions, etc., should be sent to the email address
"libpcap@ee.lbl.gov".
- Steve McCanne
Craig Leres
Van Jacobson

View File

@ -0,0 +1 @@
0.4

View File

@ -0,0 +1,706 @@
dnl @(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/aclocal.m4,v 1.1 1999/08/26 10:05:19 johana Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that: (1) source code distributions
dnl retain the above copyright notice and this paragraph in its entirety, (2)
dnl distributions including binary code include the above copyright notice and
dnl this paragraph in its entirety in the documentation or other materials
dnl provided with the distribution, and (3) all advertising materials mentioning
dnl features or use of this software display the following acknowledgement:
dnl ``This product includes software developed by the University of California,
dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
dnl the University nor the names of its contributors may be used to endorse
dnl or promote products derived from this software without specific prior
dnl written permission.
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
dnl
dnl LBL autoconf macros
dnl
dnl
dnl Determine which compiler we're using (cc or gcc)
dnl If using gcc, determine the version number
dnl If using cc, require that it support ansi prototypes
dnl If using gcc, use -O2 (otherwise use -O)
dnl If using cc, explicitly specify /usr/local/include
dnl
dnl usage:
dnl
dnl AC_LBL_C_INIT(copt, incls)
dnl
dnl results:
dnl
dnl $1 (copt set)
dnl $2 (incls set)
dnl CC
dnl LDFLAGS
dnl ac_cv_lbl_gcc_vers
dnl LBL_CFLAGS
dnl
AC_DEFUN(AC_LBL_C_INIT,
[AC_PREREQ(2.12)
AC_BEFORE([$0], [AC_PROG_CC])
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
AC_BEFORE([$0], [AC_LBL_DEVEL])
AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
$1="-O"
$2=""
if test "${srcdir}" != "." ; then
$2="-I\$\(srcdir\)"
fi
if test "${CFLAGS+set}" = set; then
LBL_CFLAGS="$CFLAGS"
fi
if test -z "$CC" ; then
case "$target_os" in
bsdi*)
AC_CHECK_PROG(SHLICC2, shlicc2, yes, no)
if test $SHLICC2 = yes ; then
CC=shlicc2
export CC
fi
;;
esac
fi
if test -z "$CC" -a "$with_gcc" = no ; then
CC=cc
export CC
fi
AC_PROG_CC
if test "$GCC" = yes ; then
if test "$SHLICC2" = yes ; then
ac_cv_lbl_gcc_vers=2
$1="-O2"
else
AC_MSG_CHECKING(gcc version)
AC_CACHE_VAL(ac_cv_lbl_gcc_vers,
ac_cv_lbl_gcc_vers=`$CC -v 2>&1 | \
sed -e '/^gcc version /!d' \
-e 's/^gcc version //' \
-e 's/ .*//' -e 's/^[[[^0-9]]]*//' \
-e 's/\..*//'`)
AC_MSG_RESULT($ac_cv_lbl_gcc_vers)
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
$1="-O2"
fi
fi
else
AC_MSG_CHECKING(that $CC handles ansi prototypes)
AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_lbl_cc_ansi_prototypes=yes,
ac_cv_lbl_cc_ansi_prototypes=no))
AC_MSG_RESULT($ac_cv_lbl_cc_ansi_prototypes)
if test $ac_cv_lbl_cc_ansi_prototypes = no ; then
case "$target_os" in
hpux*)
AC_MSG_CHECKING(for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE))
savedcflags="$CFLAGS"
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
AC_CACHE_VAL(ac_cv_lbl_cc_hpux_cc_aa,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[int frob(int, char *)],
ac_cv_lbl_cc_hpux_cc_aa=yes,
ac_cv_lbl_cc_hpux_cc_aa=no))
AC_MSG_RESULT($ac_cv_lbl_cc_hpux_cc_aa)
if test $ac_cv_lbl_cc_hpux_cc_aa = no ; then
AC_MSG_ERROR(see the INSTALL doc for more info)
fi
CFLAGS="$savedcflags"
V_CCOPT="-Aa $V_CCOPT"
AC_DEFINE(_HPUX_SOURCE)
;;
*)
AC_MSG_ERROR(see the INSTALL doc for more info)
;;
esac
fi
$2="$$2 -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
case "$target_os" in
irix*)
V_CCOPT="$V_CCOPT -xansi -signed -g3"
;;
osf*)
V_CCOPT="$V_CCOPT -std1 -g3"
;;
ultrix*)
AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
AC_TRY_COMPILE(
[#include <sys/types.h>],
[struct a { int b; };
void c(const struct a *)],
ac_cv_lbl_cc_const_proto=yes,
ac_cv_lbl_cc_const_proto=no))
AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
if test $ac_cv_lbl_cc_const_proto = no ; then
AC_DEFINE(const,)
fi
;;
esac
fi
])
dnl
dnl Use pfopen.c if available and pfopen() not in standard libraries
dnl Require libpcap
dnl Look for libpcap in ..
dnl Use the installed libpcap if there is no local version
dnl
dnl usage:
dnl
dnl AC_LBL_LIBPCAP(pcapdep, incls)
dnl
dnl results:
dnl
dnl $1 (pcapdep set)
dnl $2 (incls appended)
dnl LIBS
dnl LBL_LIBS
dnl
AC_DEFUN(AC_LBL_LIBPCAP,
[AC_REQUIRE([AC_LBL_LIBRARY_NET])
dnl
dnl save a copy before locating libpcap.a
dnl
LBL_LIBS="$LIBS"
pfopen=/usr/examples/packetfilter/pfopen.c
if test -f $pfopen ; then
AC_CHECK_FUNCS(pfopen)
if test $ac_cv_func_pfopen = "no" ; then
AC_MSG_RESULT(Using $pfopen)
LIBS="$LIBS $pfopen"
fi
fi
AC_MSG_CHECKING(for local pcap library)
libpcap=FAIL
lastdir=FAIL
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
egrep '/libpcap-[[0-9]]*\.[[0-9]]*(\.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
for dir in $places ../libpcap libpcap ; do
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
if test $lastdir = $basedir ; then
dnl skip alphas when an actual release is present
continue;
fi
lastdir=$dir
if test -r $dir/pcap.c ; then
libpcap=$dir/libpcap.a
d=$dir
dnl continue and select the last one that exists
fi
done
if test $libpcap = FAIL ; then
AC_MSG_RESULT(not found)
AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
if test $libpcap = FAIL ; then
AC_MSG_ERROR(see the INSTALL doc for more info)
fi
else
$1=$libpcap
$2="-I$d $$2"
AC_MSG_RESULT($libpcap)
fi
LIBS="$libpcap $LIBS"
case "$target_os" in
aix*)
pseexe="/lib/pse.exp"
AC_MSG_CHECKING(for $pseexe)
if test -f $pseexe ; then
AC_MSG_RESULT(yes)
LIBS="$LIBS -I:$pseexe"
fi
;;
esac])
dnl
dnl Define RETSIGTYPE and RETSIGVAL
dnl
dnl usage:
dnl
dnl AC_LBL_TYPE_SIGNAL
dnl
dnl results:
dnl
dnl RETSIGTYPE (defined)
dnl RETSIGVAL (defined)
dnl
AC_DEFUN(AC_LBL_TYPE_SIGNAL,
[AC_BEFORE([$0], [AC_LBL_LIBPCAP])
AC_TYPE_SIGNAL
if test "$ac_cv_type_signal" = void ; then
AC_DEFINE(RETSIGVAL,)
else
AC_DEFINE(RETSIGVAL,(0))
fi
case "$target_os" in
irix*)
AC_DEFINE(_BSD_SIGNALS)
;;
*)
dnl prefer sigset() to sigaction()
AC_CHECK_FUNCS(sigset)
if test $ac_cv_func_sigset = no ; then
AC_CHECK_FUNCS(sigaction)
fi
;;
esac])
dnl
dnl If using gcc, make sure we have ANSI ioctl definitions
dnl
dnl usage:
dnl
dnl AC_LBL_FIXINCLUDES
dnl
AC_DEFUN(AC_LBL_FIXINCLUDES,
[if test "$GCC" = yes ; then
AC_MSG_CHECKING(for ANSI ioctl definitions)
AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes,
AC_TRY_COMPILE(
[/*
* This generates a "duplicate case value" when fixincludes
* has not be run.
*/
# include <sys/types.h>
# include <sys/time.h>
# include <sys/ioctl.h>
# ifdef HAVE_SYS_IOCCOM_H
# include <sys/ioccom.h>
# endif],
[switch (0) {
case _IO('A', 1):;
case _IO('B', 1):;
}],
ac_cv_lbl_gcc_fixincludes=yes,
ac_cv_lbl_gcc_fixincludes=no))
AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes)
if test $ac_cv_lbl_gcc_fixincludes = no ; then
# Don't cache failure
unset ac_cv_lbl_gcc_fixincludes
AC_MSG_ERROR(see the INSTALL for more info)
fi
fi])
dnl
dnl Check for flex, default to lex
dnl Require flex 2.4 or higher
dnl Check for bison, default to yacc
dnl Default to lex/yacc if both flex and bison are not available
dnl Define the yy prefix string if using flex and bison
dnl
dnl usage:
dnl
dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
dnl
dnl results:
dnl
dnl $1 (lex set)
dnl $2 (yacc appended)
dnl $3 (optional flex and bison -P prefix)
dnl
AC_DEFUN(AC_LBL_LEX_AND_YACC,
[AC_ARG_WITH(flex, [ --without-flex don't use flex])
AC_ARG_WITH(bison, [ --without-bison don't use bison])
if test "$with_flex" = no ; then
$1=lex
else
AC_CHECK_PROGS($1, flex, lex)
fi
if test "$$1" = flex ; then
# The -V flag was added in 2.4
AC_MSG_CHECKING(for flex 2.4 or higher)
AC_CACHE_VAL(ac_cv_lbl_flex_v24,
if flex -V >/dev/null 2>&1; then
ac_cv_lbl_flex_v24=yes
else
ac_cv_lbl_flex_v24=no
fi)
AC_MSG_RESULT($ac_cv_lbl_flex_v24)
if test $ac_cv_lbl_flex_v24 = no ; then
s="2.4 or higher required"
AC_MSG_WARN(ignoring obsolete flex executable ($s))
$1=lex
fi
fi
if test "$with_bison" = no ; then
$2=yacc
else
AC_CHECK_PROGS($2, bison, yacc)
fi
if test "$$2" = bison ; then
$2="$$2 -y"
fi
if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
$1=lex
$2=yacc
fi
if test "$$1" = flex -a -n "$3" ; then
$1="$$1 -P$3"
$2="$$2 -p $3"
fi])
dnl
dnl Checks to see if union wait is used with WEXITSTATUS()
dnl
dnl usage:
dnl
dnl AC_LBL_UNION_WAIT
dnl
dnl results:
dnl
dnl DECLWAITSTATUS (defined)
dnl
AC_DEFUN(AC_LBL_UNION_WAIT,
[AC_MSG_CHECKING(if union wait is used)
AC_CACHE_VAL(ac_cv_lbl_union_wait,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/wait.h>],
[int status;
u_int i = WEXITSTATUS(status);
u_int j = waitpid(0, &status, 0);],
ac_cv_lbl_union_wait=no,
ac_cv_lbl_union_wait=yes))
AC_MSG_RESULT($ac_cv_lbl_union_wait)
if test $ac_cv_lbl_union_wait = yes ; then
AC_DEFINE(DECLWAITSTATUS,union wait)
else
AC_DEFINE(DECLWAITSTATUS,int)
fi])
dnl
dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
dnl
dnl usage:
dnl
dnl AC_LBL_SOCKADDR_SA_LEN
dnl
dnl results:
dnl
dnl HAVE_SOCKADDR_SA_LEN (defined)
dnl
AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
[AC_MSG_CHECKING(if sockaddr struct has sa_len member)
AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/socket.h>],
[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
ac_cv_lbl_sockaddr_has_sa_len=yes,
ac_cv_lbl_sockaddr_has_sa_len=no))
AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
fi])
dnl
dnl Checks to see if -R is used
dnl
dnl usage:
dnl
dnl AC_LBL_HAVE_RUN_PATH
dnl
dnl results:
dnl
dnl ac_cv_lbl_have_run_path (yes or no)
dnl
AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
[AC_MSG_CHECKING(for ${CC-cc} -R)
AC_CACHE_VAL(ac_cv_lbl_have_run_path,
[echo 'main(){}' > conftest.c
${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
if test ! -s conftest.out ; then
ac_cv_lbl_have_run_path=yes
else
ac_cv_lbl_have_run_path=no
fi
rm -f conftest*])
AC_MSG_RESULT($ac_cv_lbl_have_run_path)
])
dnl
dnl Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless.
dnl
dnl usage:
dnl
dnl AC_LBL_CHECK_TYPE
dnl
dnl results:
dnl
dnl int32_t (defined)
dnl u_int32_t (defined)
dnl
AC_DEFUN(AC_LBL_CHECK_TYPE,
[AC_MSG_CHECKING(for $1 using $CC)
AC_CACHE_VAL(ac_cv_lbl_have_$1,
AC_TRY_COMPILE([
# include "confdefs.h"
# include <sys/types.h>
# if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
# endif],
[$1 i],
ac_cv_lbl_have_$1=yes,
ac_cv_lbl_have_$1=no))
AC_MSG_RESULT($ac_cv_lbl_have_$1)
if test $ac_cv_lbl_have_$1 = no ; then
AC_DEFINE($1, $2)
fi])
dnl
dnl Checks to see if unaligned memory accesses fail
dnl
dnl usage:
dnl
dnl AC_LBL_UNALIGNED_ACCESS
dnl
dnl results:
dnl
dnl LBL_ALIGN (DEFINED)
dnl
AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
[AC_MSG_CHECKING(if unaligned accesses fail)
AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
[case "$target_cpu" in
alpha|hp*|mips|sparc)
ac_cv_lbl_unaligned_fail=yes
;;
*)
cat >conftest.c <<EOF
# include <sys/types.h>
# include <sys/wait.h>
# include <stdio.h>
unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
main() {
unsigned int i;
pid_t pid;
int status;
/* avoid "core dumped" message */
pid = fork();
if (pid < 0)
exit(2);
if (pid > 0) {
/* parent */
pid = waitpid(pid, &status, 0);
if (pid < 0)
exit(3);
exit(!WIFEXITED(status));
}
/* child */
i = *(unsigned int *)&a[[1]];
printf("%d\n", i);
exit(0);
}
EOF
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
conftest.c $LIBS >/dev/null 2>&1
if test ! -x conftest ; then
dnl failed to compile for some reason
ac_cv_lbl_unaligned_fail=yes
else
./conftest >conftest.out
if test ! -s conftest.out ; then
ac_cv_lbl_unaligned_fail=yes
else
ac_cv_lbl_unaligned_fail=no
fi
fi
rm -f conftest* core core.conftest
;;
esac])
AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
if test $ac_cv_lbl_unaligned_fail = yes ; then
AC_DEFINE(LBL_ALIGN)
fi])
dnl
dnl If using gcc and the file .devel exists:
dnl Compile with -g (if supported) and -Wall
dnl If using gcc 2, do extra prototype checking
dnl If an os prototype include exists, symlink os-proto.h to it
dnl
dnl usage:
dnl
dnl AC_LBL_DEVEL(copt)
dnl
dnl results:
dnl
dnl $1 (copt appended)
dnl HAVE_OS_PROTO_H (defined)
dnl os-proto.h (symlinked)
dnl
AC_DEFUN(AC_LBL_DEVEL,
[rm -f os-proto.h
if test "${LBL_CFLAGS+set}" = set; then
$1="$$1 ${LBL_CFLAGS}"
fi
if test -f .devel ; then
if test "$GCC" = yes ; then
if test "${LBL_CFLAGS+set}" != set; then
if test "$ac_cv_prog_cc_g" = yes ; then
$1="-g $$1"
fi
$1="$$1 -Wall"
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
fi
fi
else
case "$target_os" in
irix6*)
V_CCOPT="$V_CCOPT -n32"
;;
*)
;;
esac
fi
os=`echo $target_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
name="lbl/os-$os.h"
if test -f $name ; then
ln -s $name os-proto.h
AC_DEFINE(HAVE_OS_PROTO_H)
else
AC_MSG_WARN(can't find $name)
fi
fi])
dnl
dnl Improved version of AC_CHECK_LIB
dnl
dnl Thanks to John Hawkinson (jhawk@mit.edu)
dnl
dnl usage:
dnl
dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
dnl
dnl results:
dnl
dnl LIBS
dnl
define(AC_LBL_CHECK_LIB,
[AC_MSG_CHECKING([for $2 in -l$1])
dnl Use a cache variable name containing both the library and function name,
dnl because the test really is for library $1 defining function $2, not
dnl just for library $1. Separate tests with the same $1 and different $2's
dnl may have different results.
ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`
AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,
[ac_save_LIBS="$LIBS"
LIBS="-l$1 $5 $LIBS"
AC_TRY_LINK(dnl
ifelse([$2], [main], , dnl Avoid conflicting decl of main.
[/* Override any gcc2 internal prototype to avoid an error. */
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
extern "C"
#endif
])dnl
[/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $2();
]),
[$2()],
eval "ac_cv_lbl_lib_$ac_lib_var=yes",
eval "ac_cv_lbl_lib_$ac_lib_var=no")
LIBS="$ac_save_LIBS"
])dnl
if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$3], ,
[changequote(, )dnl
ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
changequote([, ])dnl
AC_DEFINE_UNQUOTED($ac_tr_lib)
LIBS="-l$1 $LIBS"
], [$3])
else
AC_MSG_RESULT(no)
ifelse([$4], , , [$4
])dnl
fi
])
dnl
dnl AC_LBL_LIBRARY_NET
dnl
dnl This test is for network applications that need socket() and
dnl gethostbyname() -ish functions. Under Solaris, those applications
dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
dnl with "-lnsl" but should *not* link with "-lsocket" because
dnl libsocket.a breaks a number of things (for instance:
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
dnl versions of IRIX).
dnl
dnl Unfortunately, many application developers are not aware of this,
dnl and mistakenly write tests that cause -lsocket to be used under
dnl IRIX. It is also easy to write tests that cause -lnsl to be used
dnl under operating systems where neither are necessary (or useful),
dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
dnl
dnl This test exists so that every application developer does not test
dnl this in a different, and subtly broken fashion.
dnl It has been argued that this test should be broken up into two
dnl seperate tests, one for the resolver libraries, and one for the
dnl libraries necessary for using Sockets API. Unfortunately, the two
dnl are carefully intertwined and allowing the autoconf user to use
dnl them independantly potentially results in unfortunate ordering
dnl dependancies -- as such, such component macros would have to
dnl carefully use indirection and be aware if the other components were
dnl executed. Since other autoconf macros do not go to this trouble,
dnl and almost no applications use sockets without the resolver, this
dnl complexity has not been implemented.
dnl
dnl The check for libresolv is in case you are attempting to link
dnl statically and happen to have a libresolv.a lying around (and no
dnl libnsl.a).
dnl
AC_DEFUN(AC_LBL_LIBRARY_NET, [
# Most operating systems have gethostbyname() in the default searched
# libraries (i.e. libc):
AC_CHECK_FUNC(gethostbyname, ,
# Some OSes (eg. Solaris) place it in libnsl:
AC_LBL_CHECK_LIB(nsl, gethostbyname, ,
# Some strange OSes (SINIX) have it in libsocket:
AC_LBL_CHECK_LIB(socket, gethostbyname, ,
# Unfortunately libsocket sometimes depends on libnsl.
# AC_CHECK_LIB's API is essentially broken so the
# following ugliness is necessary:
AC_LBL_CHECK_LIB(socket, gethostbyname,
LIBS="-lsocket -lnsl $LIBS",
AC_CHECK_LIB(resolv, gethostbyname),
-lnsl))))
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
AC_LBL_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", ,
-lnsl)))
# DLPI needs putmsg under HPUX so test for -lstr while we're at it
AC_CHECK_LIB(str, putmsg)
])

View File

@ -0,0 +1,264 @@
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
*
* @(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/bpf/net/bpf.h,v 1.1 1999/08/26 10:07:57 johana Exp $ (LBL)
*/
#ifndef BPF_MAJOR_VERSION
/* BSD style release date */
#define BPF_RELEASE 199606
typedef int bpf_int32;
typedef u_int bpf_u_int32;
/*
* Alignment macros. BPF_WORDALIGN rounds up to the next
* even multiple of BPF_ALIGNMENT.
*/
#define BPF_ALIGNMENT sizeof(bpf_int32)
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
#define BPF_MAXINSNS 512
#define BPF_MAXBUFSIZE 0x8000
#define BPF_MINBUFSIZE 32
/*
* Structure for BIOCSETF.
*/
struct bpf_program {
u_int bf_len;
struct bpf_insn *bf_insns;
};
/*
* Struct returned by BIOCGSTATS.
*/
struct bpf_stat {
u_int bs_recv; /* number of packets received */
u_int bs_drop; /* number of packets dropped */
};
/*
* Struct return by BIOCVERSION. This represents the version number of
* the filter language described by the instruction encodings below.
* bpf understands a program iff kernel_major == filter_major &&
* kernel_minor >= filter_minor, that is, if the value returned by the
* running kernel has the same major number and a minor number equal
* equal to or less than the filter being downloaded. Otherwise, the
* results are undefined, meaning an error may be returned or packets
* may be accepted haphazardly.
* It has nothing to do with the source code version.
*/
struct bpf_version {
u_short bv_major;
u_short bv_minor;
};
/* Current version number of filter architecture. */
#define BPF_MAJOR_VERSION 1
#define BPF_MINOR_VERSION 1
/*
* BPF ioctls
*
* The first set is for compatibility with Sun's pcc style
* header files. If your using gcc, we assume that you
* have run fixincludes so the latter set should work.
*/
#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__)
#define BIOCGBLEN _IOR(B,102, u_int)
#define BIOCSBLEN _IOWR(B,102, u_int)
#define BIOCSETF _IOW(B,103, struct bpf_program)
#define BIOCFLUSH _IO(B,104)
#define BIOCPROMISC _IO(B,105)
#define BIOCGDLT _IOR(B,106, u_int)
#define BIOCGETIF _IOR(B,107, struct ifreq)
#define BIOCSETIF _IOW(B,108, struct ifreq)
#define BIOCSRTIMEOUT _IOW(B,109, struct timeval)
#define BIOCGRTIMEOUT _IOR(B,110, struct timeval)
#define BIOCGSTATS _IOR(B,111, struct bpf_stat)
#define BIOCIMMEDIATE _IOW(B,112, u_int)
#define BIOCVERSION _IOR(B,113, struct bpf_version)
#define BIOCSTCPF _IOW(B,114, struct bpf_program)
#define BIOCSUDPF _IOW(B,115, struct bpf_program)
#else
#define BIOCGBLEN _IOR('B',102, u_int)
#define BIOCSBLEN _IOWR('B',102, u_int)
#define BIOCSETF _IOW('B',103, struct bpf_program)
#define BIOCFLUSH _IO('B',104)
#define BIOCPROMISC _IO('B',105)
#define BIOCGDLT _IOR('B',106, u_int)
#define BIOCGETIF _IOR('B',107, struct ifreq)
#define BIOCSETIF _IOW('B',108, struct ifreq)
#define BIOCSRTIMEOUT _IOW('B',109, struct timeval)
#define BIOCGRTIMEOUT _IOR('B',110, struct timeval)
#define BIOCGSTATS _IOR('B',111, struct bpf_stat)
#define BIOCIMMEDIATE _IOW('B',112, u_int)
#define BIOCVERSION _IOR('B',113, struct bpf_version)
#define BIOCSTCPF _IOW('B',114, struct bpf_program)
#define BIOCSUDPF _IOW('B',115, struct bpf_program)
#endif
/*
* Structure prepended to each packet.
*/
struct bpf_hdr {
struct timeval bh_tstamp; /* time stamp */
bpf_u_int32 bh_caplen; /* length of captured portion */
bpf_u_int32 bh_datalen; /* original length of packet */
u_short bh_hdrlen; /* length of bpf header (this struct
plus alignment padding) */
};
/*
* Because the structure above is not a multiple of 4 bytes, some compilers
* will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
* Only the kernel needs to know about it; applications use bh_hdrlen.
*/
#ifdef KERNEL
#define SIZEOF_BPF_HDR 18
#endif
/*
* Data-link level type codes.
*/
#define DLT_NULL 0 /* no link-layer encapsulation */
#define DLT_EN10MB 1 /* Ethernet (10Mb) */
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
#define DLT_AX25 3 /* Amateur Radio AX.25 */
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
#define DLT_CHAOS 5 /* Chaos */
#define DLT_IEEE802 6 /* IEEE 802 Networks */
#define DLT_ARCNET 7 /* ARCNET */
#define DLT_SLIP 8 /* Serial Line IP */
#define DLT_PPP 9 /* Point-to-point Protocol */
#define DLT_FDDI 10 /* FDDI */
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
#define DLT_RAW 12 /* raw IP */
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
/*
* The instruction encondings.
*/
/* instruction classes */
#define BPF_CLASS(code) ((code) & 0x07)
#define BPF_LD 0x00
#define BPF_LDX 0x01
#define BPF_ST 0x02
#define BPF_STX 0x03
#define BPF_ALU 0x04
#define BPF_JMP 0x05
#define BPF_RET 0x06
#define BPF_MISC 0x07
/* ld/ldx fields */
#define BPF_SIZE(code) ((code) & 0x18)
#define BPF_W 0x00
#define BPF_H 0x08
#define BPF_B 0x10
#define BPF_MODE(code) ((code) & 0xe0)
#define BPF_IMM 0x00
#define BPF_ABS 0x20
#define BPF_IND 0x40
#define BPF_MEM 0x60
#define BPF_LEN 0x80
#define BPF_MSH 0xa0
/* alu/jmp fields */
#define BPF_OP(code) ((code) & 0xf0)
#define BPF_ADD 0x00
#define BPF_SUB 0x10
#define BPF_MUL 0x20
#define BPF_DIV 0x30
#define BPF_OR 0x40
#define BPF_AND 0x50
#define BPF_LSH 0x60
#define BPF_RSH 0x70
#define BPF_NEG 0x80
#define BPF_JA 0x00
#define BPF_JEQ 0x10
#define BPF_JGT 0x20
#define BPF_JGE 0x30
#define BPF_JSET 0x40
#define BPF_SRC(code) ((code) & 0x08)
#define BPF_K 0x00
#define BPF_X 0x08
/* ret - BPF_K and BPF_X also apply */
#define BPF_RVAL(code) ((code) & 0x18)
#define BPF_A 0x10
/* misc */
#define BPF_MISCOP(code) ((code) & 0xf8)
#define BPF_TAX 0x00
#define BPF_TXA 0x80
/*
* The instruction data structure.
*/
struct bpf_insn {
u_short code;
u_char jt;
u_char jf;
bpf_int32 k;
};
/*
* Macros for insn array initializers.
*/
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
#ifdef KERNEL
extern u_int bpf_filter();
extern void bpfattach();
extern void bpf_tap();
extern void bpf_mtap();
#else
#if __STDC__
extern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
#endif
#endif
/*
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
*/
#define BPF_MEMWORDS 16
#endif

View File

@ -0,0 +1,532 @@
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)bpf.c 7.5 (Berkeley) 7/15/91
*/
#if !(defined(lint) || defined(KERNEL))
static const char rcsid[] =
"@(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/bpf/net/bpf_filter.c,v 1.1 1999/08/26 10:07:57 johana Exp $ (LBL)";
#endif
#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
#include <net/bpf.h>
#ifndef KERNEL
#include <stdlib.h>
#endif
#define int32 bpf_int32
#define u_int32 bpf_u_int32
#ifndef LBL_ALIGN
#if defined(sparc) || defined(mips) || defined(ibm032) || \
defined(__alpha) || defined(__hpux)
#define LBL_ALIGN
#endif
#endif
#ifndef LBL_ALIGN
#include <netinet/in.h>
#define EXTRACT_SHORT(p) ((u_short)ntohs(*(u_short *)p))
#define EXTRACT_LONG(p) (ntohl(*(u_int32 *)p))
#else
#define EXTRACT_SHORT(p)\
((u_short)\
((u_short)*((u_char *)p+0)<<8|\
(u_short)*((u_char *)p+1)<<0))
#define EXTRACT_LONG(p)\
((u_int32)*((u_char *)p+0)<<24|\
(u_int32)*((u_char *)p+1)<<16|\
(u_int32)*((u_char *)p+2)<<8|\
(u_int32)*((u_char *)p+3)<<0)
#endif
#ifdef KERNEL
#include <sys/mbuf.h>
#define MINDEX(len, m, k) \
{ \
len = m->m_len; \
while (k >= len) { \
k -= len; \
m = m->m_next; \
if (m == 0) \
return 0; \
len = m->m_len; \
} \
}
static int
m_xword(m, k, err)
register struct mbuf *m;
register int k, *err;
{
register int len;
register u_char *cp, *np;
register struct mbuf *m0;
MINDEX(len, m, k);
cp = mtod(m, u_char *) + k;
if (len - k >= 4) {
*err = 0;
return EXTRACT_LONG(cp);
}
m0 = m->m_next;
if (m0 == 0 || m0->m_len + len - k < 4)
goto bad;
*err = 0;
np = mtod(m0, u_char *);
switch (len - k) {
case 1:
return (cp[0] << 24) | (np[0] << 16) | (np[1] << 8) | np[2];
case 2:
return (cp[0] << 24) | (cp[1] << 16) | (np[0] << 8) | np[1];
default:
return (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | np[0];
}
bad:
*err = 1;
return 0;
}
static int
m_xhalf(m, k, err)
register struct mbuf *m;
register int k, *err;
{
register int len;
register u_char *cp;
register struct mbuf *m0;
MINDEX(len, m, k);
cp = mtod(m, u_char *) + k;
if (len - k >= 2) {
*err = 0;
return EXTRACT_SHORT(cp);
}
m0 = m->m_next;
if (m0 == 0)
goto bad;
*err = 0;
return (cp[0] << 8) | mtod(m0, u_char *)[0];
bad:
*err = 1;
return 0;
}
#endif
/*
* Execute the filter program starting at pc on the packet p
* wirelen is the length of the original packet
* buflen is the amount of data present
*/
u_int
bpf_filter(pc, p, wirelen, buflen)
register struct bpf_insn *pc;
register u_char *p;
u_int wirelen;
register u_int buflen;
{
register u_int32 A, X;
register int k;
int32 mem[BPF_MEMWORDS];
if (pc == 0)
/*
* No filter means accept all.
*/
return (u_int)-1;
A = 0;
X = 0;
--pc;
while (1) {
++pc;
switch (pc->code) {
default:
#ifdef KERNEL
return 0;
#else
abort();
#endif
case BPF_RET|BPF_K:
return (u_int)pc->k;
case BPF_RET|BPF_A:
return (u_int)A;
case BPF_LD|BPF_W|BPF_ABS:
k = pc->k;
if (k + sizeof(int32) > buflen) {
#ifdef KERNEL
int merr;
if (buflen != 0)
return 0;
A = m_xword((struct mbuf *)p, k, &merr);
if (merr != 0)
return 0;
continue;
#else
return 0;
#endif
}
A = EXTRACT_LONG(&p[k]);
continue;
case BPF_LD|BPF_H|BPF_ABS:
k = pc->k;
if (k + sizeof(short) > buflen) {
#ifdef KERNEL
int merr;
if (buflen != 0)
return 0;
A = m_xhalf((struct mbuf *)p, k, &merr);
continue;
#else
return 0;
#endif
}
A = EXTRACT_SHORT(&p[k]);
continue;
case BPF_LD|BPF_B|BPF_ABS:
k = pc->k;
if (k >= buflen) {
#ifdef KERNEL
register struct mbuf *m;
register int len;
if (buflen != 0)
return 0;
m = (struct mbuf *)p;
MINDEX(len, m, k);
A = mtod(m, u_char *)[k];
continue;
#else
return 0;
#endif
}
A = p[k];
continue;
case BPF_LD|BPF_W|BPF_LEN:
A = wirelen;
continue;
case BPF_LDX|BPF_W|BPF_LEN:
X = wirelen;
continue;
case BPF_LD|BPF_W|BPF_IND:
k = X + pc->k;
if (k + sizeof(int32) > buflen) {
#ifdef KERNEL
int merr;
if (buflen != 0)
return 0;
A = m_xword((struct mbuf *)p, k, &merr);
if (merr != 0)
return 0;
continue;
#else
return 0;
#endif
}
A = EXTRACT_LONG(&p[k]);
continue;
case BPF_LD|BPF_H|BPF_IND:
k = X + pc->k;
if (k + sizeof(short) > buflen) {
#ifdef KERNEL
int merr;
if (buflen != 0)
return 0;
A = m_xhalf((struct mbuf *)p, k, &merr);
if (merr != 0)
return 0;
continue;
#else
return 0;
#endif
}
A = EXTRACT_SHORT(&p[k]);
continue;
case BPF_LD|BPF_B|BPF_IND:
k = X + pc->k;
if (k >= buflen) {
#ifdef KERNEL
register struct mbuf *m;
register int len;
if (buflen != 0)
return 0;
m = (struct mbuf *)p;
MINDEX(len, m, k);
A = mtod(m, u_char *)[k];
continue;
#else
return 0;
#endif
}
A = p[k];
continue;
case BPF_LDX|BPF_MSH|BPF_B:
k = pc->k;
if (k >= buflen) {
#ifdef KERNEL
register struct mbuf *m;
register int len;
if (buflen != 0)
return 0;
m = (struct mbuf *)p;
MINDEX(len, m, k);
X = (mtod(m, char *)[k] & 0xf) << 2;
continue;
#else
return 0;
#endif
}
X = (p[pc->k] & 0xf) << 2;
continue;
case BPF_LD|BPF_IMM:
A = pc->k;
continue;
case BPF_LDX|BPF_IMM:
X = pc->k;
continue;
case BPF_LD|BPF_MEM:
A = mem[pc->k];
continue;
case BPF_LDX|BPF_MEM:
X = mem[pc->k];
continue;
case BPF_ST:
mem[pc->k] = A;
continue;
case BPF_STX:
mem[pc->k] = X;
continue;
case BPF_JMP|BPF_JA:
pc += pc->k;
continue;
case BPF_JMP|BPF_JGT|BPF_K:
pc += (A > pc->k) ? pc->jt : pc->jf;
continue;
case BPF_JMP|BPF_JGE|BPF_K:
pc += (A >= pc->k) ? pc->jt : pc->jf;
continue;
case BPF_JMP|BPF_JEQ|BPF_K:
pc += (A == pc->k) ? pc->jt : pc->jf;
continue;
case BPF_JMP|BPF_JSET|BPF_K:
pc += (A & pc->k) ? pc->jt : pc->jf;
continue;
case BPF_JMP|BPF_JGT|BPF_X:
pc += (A > X) ? pc->jt : pc->jf;
continue;
case BPF_JMP|BPF_JGE|BPF_X:
pc += (A >= X) ? pc->jt : pc->jf;
continue;
case BPF_JMP|BPF_JEQ|BPF_X:
pc += (A == X) ? pc->jt : pc->jf;
continue;
case BPF_JMP|BPF_JSET|BPF_X:
pc += (A & X) ? pc->jt : pc->jf;
continue;
case BPF_ALU|BPF_ADD|BPF_X:
A += X;
continue;
case BPF_ALU|BPF_SUB|BPF_X:
A -= X;
continue;
case BPF_ALU|BPF_MUL|BPF_X:
A *= X;
continue;
case BPF_ALU|BPF_DIV|BPF_X:
if (X == 0)
return 0;
A /= X;
continue;
case BPF_ALU|BPF_AND|BPF_X:
A &= X;
continue;
case BPF_ALU|BPF_OR|BPF_X:
A |= X;
continue;
case BPF_ALU|BPF_LSH|BPF_X:
A <<= X;
continue;
case BPF_ALU|BPF_RSH|BPF_X:
A >>= X;
continue;
case BPF_ALU|BPF_ADD|BPF_K:
A += pc->k;
continue;
case BPF_ALU|BPF_SUB|BPF_K:
A -= pc->k;
continue;
case BPF_ALU|BPF_MUL|BPF_K:
A *= pc->k;
continue;
case BPF_ALU|BPF_DIV|BPF_K:
A /= pc->k;
continue;
case BPF_ALU|BPF_AND|BPF_K:
A &= pc->k;
continue;
case BPF_ALU|BPF_OR|BPF_K:
A |= pc->k;
continue;
case BPF_ALU|BPF_LSH|BPF_K:
A <<= pc->k;
continue;
case BPF_ALU|BPF_RSH|BPF_K:
A >>= pc->k;
continue;
case BPF_ALU|BPF_NEG:
A = -A;
continue;
case BPF_MISC|BPF_TAX:
X = A;
continue;
case BPF_MISC|BPF_TXA:
A = X;
continue;
}
}
}
#ifdef KERNEL
/*
* Return true if the 'fcode' is a valid filter program.
* The constraints are that each jump be forward and to a valid
* code. The code must terminate with either an accept or reject.
* 'valid' is an array for use by the routine (it must be at least
* 'len' bytes long).
*
* The kernel needs to be able to verify an application's filter code.
* Otherwise, a bogus program could easily crash the system.
*/
int
bpf_validate(f, len)
struct bpf_insn *f;
int len;
{
register int i;
register struct bpf_insn *p;
for (i = 0; i < len; ++i) {
/*
* Check that that jumps are forward, and within
* the code block.
*/
p = &f[i];
if (BPF_CLASS(p->code) == BPF_JMP) {
register int from = i + 1;
if (BPF_OP(p->code) == BPF_JA) {
if (from + p->k >= (unsigned)len)
return 0;
}
else if (from + p->jt >= len || from + p->jf >= len)
return 0;
}
/*
* Check that memory operations use valid addresses.
*/
if ((BPF_CLASS(p->code) == BPF_ST ||
(BPF_CLASS(p->code) == BPF_LD &&
(p->code & 0xe0) == BPF_MEM)) &&
(p->k >= BPF_MEMWORDS || p->k < 0))
return 0;
/*
* Check for constant division by 0.
*/
if (p->code == (BPF_ALU|BPF_DIV|BPF_K) && p->k == 0)
return 0;
}
return BPF_CLASS(f[len - 1].code) == BPF_RET;
}
#endif

View File

@ -0,0 +1 @@
bpf/net/bpf_filter.c

View File

@ -0,0 +1,288 @@
/*
* Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/bpf_image.c,v 1.1 1999/08/26 10:05:20 johana Exp $ (LBL)";
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include "pcap-int.h"
#include "gnuc.h"
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"
#endif
char *
bpf_image(p, n)
struct bpf_insn *p;
int n;
{
int v;
char *fmt, *op;
static char image[256];
char operand[64];
v = p->k;
switch (p->code) {
default:
op = "unimp";
fmt = "0x%x";
v = p->code;
break;
case BPF_RET|BPF_K:
op = "ret";
fmt = "#%d";
break;
case BPF_RET|BPF_A:
op = "ret";
fmt = "";
break;
case BPF_LD|BPF_W|BPF_ABS:
op = "ld";
fmt = "[%d]";
break;
case BPF_LD|BPF_H|BPF_ABS:
op = "ldh";
fmt = "[%d]";
break;
case BPF_LD|BPF_B|BPF_ABS:
op = "ldb";
fmt = "[%d]";
break;
case BPF_LD|BPF_W|BPF_LEN:
op = "ld";
fmt = "#pktlen";
break;
case BPF_LD|BPF_W|BPF_IND:
op = "ld";
fmt = "[x + %d]";
break;
case BPF_LD|BPF_H|BPF_IND:
op = "ldh";
fmt = "[x + %d]";
break;
case BPF_LD|BPF_B|BPF_IND:
op = "ldb";
fmt = "[x + %d]";
break;
case BPF_LD|BPF_IMM:
op = "ld";
fmt = "#0x%x";
break;
case BPF_LDX|BPF_IMM:
op = "ldx";
fmt = "#0x%x";
break;
case BPF_LDX|BPF_MSH|BPF_B:
op = "ldxb";
fmt = "4*([%d]&0xf)";
break;
case BPF_LD|BPF_MEM:
op = "ld";
fmt = "M[%d]";
break;
case BPF_LDX|BPF_MEM:
op = "ldx";
fmt = "M[%d]";
break;
case BPF_ST:
op = "st";
fmt = "M[%d]";
break;
case BPF_STX:
op = "stx";
fmt = "M[%d]";
break;
case BPF_JMP|BPF_JA:
op = "ja";
fmt = "%d";
v = n + 1 + p->k;
break;
case BPF_JMP|BPF_JGT|BPF_K:
op = "jgt";
fmt = "#0x%x";
break;
case BPF_JMP|BPF_JGE|BPF_K:
op = "jge";
fmt = "#0x%x";
break;
case BPF_JMP|BPF_JEQ|BPF_K:
op = "jeq";
fmt = "#0x%x";
break;
case BPF_JMP|BPF_JSET|BPF_K:
op = "jset";
fmt = "#0x%x";
break;
case BPF_JMP|BPF_JGT|BPF_X:
op = "jgt";
fmt = "x";
break;
case BPF_JMP|BPF_JGE|BPF_X:
op = "jge";
fmt = "x";
break;
case BPF_JMP|BPF_JEQ|BPF_X:
op = "jeq";
fmt = "x";
break;
case BPF_JMP|BPF_JSET|BPF_X:
op = "jset";
fmt = "x";
break;
case BPF_ALU|BPF_ADD|BPF_X:
op = "add";
fmt = "x";
break;
case BPF_ALU|BPF_SUB|BPF_X:
op = "sub";
fmt = "x";
break;
case BPF_ALU|BPF_MUL|BPF_X:
op = "mul";
fmt = "x";
break;
case BPF_ALU|BPF_DIV|BPF_X:
op = "div";
fmt = "x";
break;
case BPF_ALU|BPF_AND|BPF_X:
op = "and";
fmt = "x";
break;
case BPF_ALU|BPF_OR|BPF_X:
op = "or";
fmt = "x";
break;
case BPF_ALU|BPF_LSH|BPF_X:
op = "lsh";
fmt = "x";
break;
case BPF_ALU|BPF_RSH|BPF_X:
op = "rsh";
fmt = "x";
break;
case BPF_ALU|BPF_ADD|BPF_K:
op = "add";
fmt = "#%d";
break;
case BPF_ALU|BPF_SUB|BPF_K:
op = "sub";
fmt = "#%d";
break;
case BPF_ALU|BPF_MUL|BPF_K:
op = "mul";
fmt = "#%d";
break;
case BPF_ALU|BPF_DIV|BPF_K:
op = "div";
fmt = "#%d";
break;
case BPF_ALU|BPF_AND|BPF_K:
op = "and";
fmt = "#0x%x";
break;
case BPF_ALU|BPF_OR|BPF_K:
op = "or";
fmt = "#0x%x";
break;
case BPF_ALU|BPF_LSH|BPF_K:
op = "lsh";
fmt = "#%d";
break;
case BPF_ALU|BPF_RSH|BPF_K:
op = "rsh";
fmt = "#%d";
break;
case BPF_ALU|BPF_NEG:
op = "neg";
fmt = "";
break;
case BPF_MISC|BPF_TAX:
op = "tax";
fmt = "";
break;
case BPF_MISC|BPF_TXA:
op = "txa";
fmt = "";
break;
}
(void)sprintf(operand, fmt, v);
(void)sprintf(image,
(BPF_CLASS(p->code) == BPF_JMP &&
BPF_OP(p->code) != BPF_JA) ?
"(%03d) %-8s %-16s jt %d\tjf %d"
: "(%03d) %-8s %s",
n, op, operand, n + 1 + p->jt, n + 1 + p->jf);
return image;
}

View File

@ -0,0 +1,35 @@
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
ac_cv_func_ether_hostton=${ac_cv_func_ether_hostton=yes}
ac_cv_func_strerror=${ac_cv_func_strerror=yes}
ac_cv_header_malloc_h=${ac_cv_header_malloc_h=yes}
ac_cv_header_net_if_arp_h=${ac_cv_header_net_if_arp_h=yes}
ac_cv_header_sys_ioccom_h=${ac_cv_header_sys_ioccom_h=no}
ac_cv_header_sys_sockio_h=${ac_cv_header_sys_sockio_h=no}
ac_cv_lbl_flex_v24=${ac_cv_lbl_flex_v24=yes}
ac_cv_lbl_gcc_fixincludes=${ac_cv_lbl_gcc_fixincludes=yes}
ac_cv_lbl_gcc_vers=${ac_cv_lbl_gcc_vers=4}
ac_cv_lbl_sockaddr_has_sa_len=${ac_cv_lbl_sockaddr_has_sa_len=no}
ac_cv_lbl_unaligned_fail=${ac_cv_lbl_unaligned_fail=no}
ac_cv_linux_vers=${ac_cv_linux_vers=2}
ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
ac_cv_prog_V_LEX=${ac_cv_prog_V_LEX=flex}
ac_cv_prog_V_RANLIB=${ac_cv_prog_V_RANLIB=ranlib}
ac_cv_prog_V_YACC=${ac_cv_prog_V_YACC=bison}
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}

View File

@ -0,0 +1,693 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
#
# This file 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.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:*:*)
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-cbm-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-atari-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-sun-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-apple-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
${CC-cc} dummy.c -o dummy \
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[3478]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp3[0-9][05]:OpenBSD:*:*)
echo m68k-hp-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo i386-pc-cygwin32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
echo "powerpc-unknown-linux-gnu" ; exit 0
elif test "${UNAME_MACHINE}" = "alpha" ; then
echo alpha-unknown-linux-gnu ; exit 0
elif test "${UNAME_MACHINE}" = "sparc" ; then
echo sparc-unknown-linux-gnu ; exit 0
else
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
test ! -d /usr/lib/ldscripts/. \
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __ELF__
printf ("%s-pc-linux-gnu\n", argv[1]);
#else
printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i?86:LynxOS:2.*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1

View File

@ -0,0 +1,61 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
configure:578: checking host system type
configure:599: checking target system type
configure:617: checking build system type
configure:711: checking for gcc
configure:788: checking whether the C compiler (gcc ) works
configure:802: gcc -o conftest conftest.c 1>&5
configure:822: checking whether the C compiler (gcc ) is a cross-compiler
configure:827: checking whether we are using GNU C
configure:836: gcc -E conftest.c
configure:851: checking whether gcc accepts -g
configure:884: checking gcc version
configure:1028: checking how to run the C preprocessor
configure:1049: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1092: checking for malloc.h
configure:1102: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1092: checking for sys/ioccom.h
configure:1102: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1098:24: error: sys/ioccom.h: No such file or directory
configure: failed program was:
#line 1097 "configure"
#include "confdefs.h"
#include <sys/ioccom.h>
configure:1092: checking for sys/sockio.h
configure:1102: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1098:24: error: sys/sockio.h: No such file or directory
configure: failed program was:
#line 1097 "configure"
#include "confdefs.h"
#include <sys/sockio.h>
configure:1131: checking for ANSI ioctl definitions
configure:1155: gcc -c -g -O2 conftest.c 1>&5
configure:1178: checking for ether_hostton
configure:1206: gcc -o conftest -g -O2 conftest.c 1>&5
configure:1178: checking for strerror
configure:1206: gcc -o conftest -g -O2 conftest.c 1>&5
configure:1238: checking packet capture type
configure:1341: checking for net/if_arp.h
configure:1351: gcc -E conftest.c >/dev/null 2>conftest.out
configure:1378: checking Linux kernel version
configure:1419: checking for flex
configure:1452: checking for flex 2.4 or higher
configure:1478: checking for bison
configure:1602: checking for ranlib
configure:1672: checking if sockaddr struct has sa_len member
configure:1686: gcc -c -g -O2 conftest.c 1>&5
configure: In function 'main':
configure:1682: error: 'struct sockaddr' has no member named 'sa_len'
configure: failed program was:
#line 1677 "configure"
#include "confdefs.h"
# include <sys/types.h>
# include <sys/socket.h>
int main() {
u_int i = sizeof(((struct sockaddr *)0)->sa_len)
; return 0; }
configure:1707: checking if unaligned accesses fail
configure:1803: checking for a BSD compatible install

View File

@ -0,0 +1,179 @@
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host bertha:
#
# ./configure
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]"
for ac_option
do
case "$ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion"
exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "./config.status generated by autoconf version 2.12"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "$ac_cs_usage"; exit 0 ;;
*) echo "$ac_cs_usage"; exit 1 ;;
esac
done
ac_given_srcdir=.
ac_given_INSTALL=" install_elinux -p"
trap 'rm -fr Makefile conftest*; exit 1' 1 2 15
# Protect against being on the right side of a sed subst in config.status.
sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g;
s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
/^[ ]*VPATH[ ]*=[^:]*$/d
s%@CFLAGS@%-g -O2%g
s%@CPPFLAGS@%%g
s%@CXXFLAGS@%%g
s%@DEFS@% -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 %g
s%@LDFLAGS@%%g
s%@LIBS@%%g
s%@exec_prefix@%${prefix}%g
s%@prefix@%/usr/local%g
s%@program_transform_name@%s,x,x,%g
s%@bindir@%${exec_prefix}/bin%g
s%@sbindir@%${exec_prefix}/sbin%g
s%@libexecdir@%${exec_prefix}/libexec%g
s%@datadir@%${prefix}/share%g
s%@sysconfdir@%${prefix}/etc%g
s%@sharedstatedir@%${prefix}/com%g
s%@localstatedir@%${prefix}/var%g
s%@libdir@%${exec_prefix}/lib%g
s%@includedir@%${prefix}/include%g
s%@oldincludedir@%/usr/include%g
s%@infodir@%${prefix}/info%g
s%@mandir@%${prefix}/man%g
s%@host@%i686-pc-linux-gnu%g
s%@host_alias@%i686-pc-linux-gnu%g
s%@host_cpu@%i686%g
s%@host_vendor@%pc%g
s%@host_os@%linux-gnu%g
s%@target@%i686-pc-linux-gnu%g
s%@target_alias@%i686-pc-linux-gnu%g
s%@target_cpu@%i686%g
s%@target_vendor@%pc%g
s%@target_os@%linux-gnu%g
s%@build@%i686-pc-linux-gnu%g
s%@build_alias@%i686-pc-linux-gnu%g
s%@build_cpu@%i686%g
s%@build_vendor@%pc%g
s%@build_os@%linux-gnu%g
s%@SHLICC2@%%g
s%@CC@%gcc%g
s%@CPP@%gcc -E%g
s%@V_LEX@%flex -Ppcap_%g
s%@V_YACC@%bison -y -p pcap_%g
s%@V_RANLIB@%ranlib%g
s%@V_CCOPT@%-O2%g
s%@V_INCLS@% -Ilinux-include%g
s%@V_PCAP@%linux%g
s%@INSTALL_PROGRAM@%${INSTALL}%g
s%@INSTALL_DATA@%${INSTALL} -m 644%g
CEOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
else
sed "${ac_end}q" conftest.subs > conftest.s$ac_file
fi
if test ! -s conftest.s$ac_file; then
ac_more_lines=false
rm -f conftest.s$ac_file
else
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f conftest.s$ac_file"
else
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
fi
ac_file=`expr $ac_file + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_cmds`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
CONFIG_FILES=${CONFIG_FILES-"Makefile"}
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dir_suffix= ac_dots=
fi
case "$ac_given_srcdir" in
.) srcdir=.
if test -z "$ac_dots"; then top_srcdir=.
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
*) # Relative path.
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
case "$ac_given_INSTALL" in
[/$]*) INSTALL="$ac_given_INSTALL" ;;
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
esac
echo creating "$ac_file"
rm -f "$ac_file"
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
case "$ac_file" in
*Makefile*) ac_comsub="1i\\
# $configure_input" ;;
*) ac_comsub= ;;
esac
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
exit 0

View File

@ -0,0 +1,927 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
if [ x$1 = x ]
then
echo Configuration name missing. 1>&2
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
echo "or $0 ALIAS" 1>&2
echo where ALIAS is a recognized configuration type. 1>&2
exit 1
fi
# First pass through any local machine types.
case $1 in
*local*)
echo $1
exit 0
;;
*)
;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
linux-gnu*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple)
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
os=sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid \
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
| alpha | we32k | ns16k | clipper | i370 | sh \
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel \
| sparc | sparclet | sparclite | sparc64)
basic_machine=$basic_machine-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[3456]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-cbm
;;
amigados)
basic_machine=m68k-cbm
os=-amigados
;;
amigaunix | amix)
basic_machine=m68k-cbm
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[ctj]90-cray)
basic_machine=c90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[3456]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[3456]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[3456]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[3456]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
miniframe)
basic_machine=m68000-convergent
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
np1)
basic_machine=np1-gould
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5)
basic_machine=i586-intel
;;
pentiumpro | p6)
basic_machine=i686-intel
;;
pentium-* | p5-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
;;
nexen)
# We don't have specific support for Nexgen yet, so just call it a Pentium
basic_machine=i586-nexgen
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=rs6000-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
mips)
basic_machine=mips-mips
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sparc)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-unixware* | svr4*)
os=-sysv4
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -linux-gnu* | -uxpv*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
os=-nextstep2
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-xenix)
os=-xenix
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
arm*-semi)
os=-aout
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-ibm)
os=-aix
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigados
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f301-fujitsu)
os=-uxpv
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-aix*)
vendor=ibm
;;
-hpux*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,189 @@
dnl @(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/configure.in,v 1.1 1999/08/26 10:05:21 johana Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(pcap.c)
AC_CANONICAL_SYSTEM
umask 002
if test -z "$PWD" ; then
PWD=`pwd`
fi
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_CHECK_HEADERS(malloc.h sys/ioccom.h sys/sockio.h)
AC_LBL_FIXINCLUDES
AC_CHECK_FUNCS(ether_hostton strerror)
dnl
dnl Not all versions of test support -c (character special) but it's a
dnl better way of testing since the device might be protected. So we
dnl check in our normal order using -r and then check the for the /dev
dnl guys again using -c.
dnl
AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
AC_MSG_CHECKING(packet capture type)
if test ! -z "$with_pcap" ; then
V_PCAP="$withval"
elif test -r /dev/bpf0 ; then
V_PCAP=bpf
elif test -r /usr/include/net/pfilt.h ; then
V_PCAP=pf
elif test -r /dev/enet ; then
V_PCAP=enet
elif test -r /dev/nit ; then
V_PCAP=snit
elif test -r /usr/include/sys/net/nit.h ; then
V_PCAP=nit
elif test -r /usr/include/net/raw.h ; then
V_PCAP=snoop
elif test -r /usr/include/sys/dlpi.h ; then
V_PCAP=dlpi
elif test -r /usr/include/linux/socket.h ; then
V_PCAP=linux
elif test -c /dev/bpf0 ; then # check again in case not readable
V_PCAP=bpf
elif test -c /dev/enet ; then # check again in case not readable
V_PCAP=enet
elif test -c /dev/nit ; then # check again in case not readable
V_PCAP=snit
else
V_PCAP=null
fi
AC_MSG_RESULT($V_PCAP)
case "$V_PCAP" in
dlpi)
AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
AC_MSG_CHECKING(for /dev/dlpi device)
if test -c /dev/dlpi ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEV_DLPI)
else
AC_MSG_RESULT(no)
dir="/dev/dlpi"
AC_MSG_CHECKING(for $dir directory)
if test -d $dir ; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir")
else
AC_MSG_RESULT(no)
fi
fi
;;
linux)
AC_CHECK_HEADERS(net/if_arp.h)
AC_MSG_CHECKING(Linux kernel version)
AC_CACHE_VAL(ac_cv_linux_vers,
ac_cv_linux_vers=`uname -r 2>&1 | \
sed -n -e '$s/.* //' -e '$s/\..*//p'`)
AC_MSG_RESULT($ac_cv_linux_vers)
if test $ac_cv_linux_vers -lt 2 ; then
AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
fi
;;
null)
AC_MSG_WARN(cannot determine packet capture interface)
AC_MSG_WARN((see the INSTALL doc for more info))
;;
esac
AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
case "$target_os" in
aix*)
dnl Workaround to enable certain features
AC_DEFINE(_SUN)
;;
hpux9*)
AC_DEFINE(HAVE_HPUX9)
;;
hpux10.0*)
;;
hpux10.1*)
;;
hpux*)
dnl HPUX 10.20 and above is similar to HPUX 9...
AC_DEFINE(HAVE_HPUX10_20)
;;
sinix*)
AC_MSG_CHECKING(if SINIX compiler defines sinix)
AC_CACHE_VAL(ac_cv_cc_sinix_defined,
AC_TRY_COMPILE(
[],
[int i = sinix;],
ac_cv_cc_sinix_defined=yes,
ac_cv_cc_sinix_defined=no))
AC_MSG_RESULT($ac_cv_cc_sinix_defined)
if test $ac_cv_cc_sinix_defined = no ; then
AC_DEFINE(sinix)
fi
;;
solaris*)
AC_DEFINE(HAVE_SOLARIS)
;;
linux*)
V_INCLS="$V_INCLS -Ilinux-include"
;;
esac
AC_CHECK_PROGS(V_RANLIB, ranlib, @true)
AC_LBL_DEVEL(V_CCOPT)
AC_LBL_SOCKADDR_SA_LEN
AC_LBL_UNALIGNED_ACCESS
if test "${srcdir}" = "." ; then
srcdirprefix=""
else
srcdirprefix="./"
fi
if test -r ${srcdirprefix}lbl/gnuc.h ; then
rm -f gnuc.h
ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h
fi
rm -f bpf_filter.c
ln -s ${srcdirprefix}bpf/net/bpf_filter.c bpf_filter.c
rm -f net
ln -s ${srcdirprefix}bpf/net net
AC_SUBST(V_CCOPT)
AC_SUBST(V_INCLS)
AC_SUBST(V_LEX)
AC_SUBST(V_PCAP)
AC_SUBST(V_RANLIB)
AC_SUBST(V_YACC)
AC_PROG_INSTALL
AC_OUTPUT(Makefile)
if test -f .devel ; then
make depend
fi
exit 0

Some files were not shown because too many files have changed in this diff Show More