OpenWrt Forum Archive

Topic: Which Image to Use ?

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi ,

I used buildroot-ng to build new images for x86 based system. It created these 4 images

1. openwrt-x86-2.6-ext2.fs
2. openwrt-x86-2.6-ext2.image
3. openwrt-x86-2.6-vmlinuz
4. openwrt-x86-2.6-ext2.image.kernel
and a folder called packages.

There is a 128 MB flash disk on which these images have to be flashed. Please advise how to partition the system and place which image where ?
I am not sure about the process to follow.

Thanks in advance,
vivekian

The end result is a single image file: openwrt-x86-2.6-ext2.image, which contains a partition table, a kernel/grub partition (hda1), and a rootfs partition (hda2). You should just be able to dd this image directly to a flash disk.

The defaults are that hda1 is 4MB and hda2 is 16MB. You can change these sizes with 'make menuconfig' so they better fit your 128MB disk. Note that there will probably be some cylinder rounding up. (The actual size image I get is 41903 sectors, but that's not a multiple of 63, so I don't really understand what's going on there)

Alternatively, if you look inside target/linux/x86-2.6/image/ you will find gen_image.sh which creates this image, and Makefile which invokes gen_image.sh with the correct parameters. You can use this as a guide to installing the bits yourself.

Thanks .

Flashing the CF with the openwrt-x86-2.6-ext.image created the right partitions. The grub needed a bit of tweaking though. There was no device.map file and it had to be created. The next step i want to do is add a package  --  aodv--uu. After the reading the documenation i created the Makefile but i am not sure as to what has to be done after that step to create from the existing toolchain. The following command does not help either :

make package/aodv-uu-clean V=99   

make package/aodv-uu-install V=99

These run without the error but there is no ipk package to be found , nor does it download the sources from the website in the dl directory.

I am pasting the makefile below :

include $(TOPDIR)/rules.mk

PKG_NAME:=aodv-uu
PKG_VERSION:=0.9.3
PKG_RELEASE:=1

PKG_MD5SUM:=05460543054449cb4b170252a7168c65
PKG_SOURCE_URL:=http://core.it.uu.se/core/files/

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_CAT:=zcat
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install

include $(INCLUDE_DIR)/package.mk

define Package/aodv-uu
  SECTION:=net
  CATEGORY:=Base system
  TITLE:=Adhoc Routing Protocol
  DESCRIPTION:=\
    Manage Routing protocol
  URL:=http://core.it.uu.se/core/index.php/Main_Page
endef

define Build/Configure
    $(call Build/Configure/Default, \
        --with-linux-headers="$(LINUX_DIR)" \
    )
endef

define Package/bridge/install
    $(INSTALL_DIR) $(1)/usr/sbin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin/
endef



$(eval $(call BuildPackage,aodv-uu))

If I copy this image to a USB stick and boot, the kernel panics at the point where it tries to mount the root filesystem.

(Note: all these messages seen via the serial port. The screen displays nothing after "Uncompressing Linux... Ok, booting the kernel.")

Booting 'OpenWrt'

root    (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
kernel  /boot/vmlinuz root=/dev/hda2 rootfstype=ext2 "" noinitrd console=ttyS0,
38400n8 reboot=bios
   [Linux-bzImage, setup=0x1200, size=0xe05d7]
boot
Linux version 2.6.19 (candlerb@candlerb-desktop) (gcc version 4.2.0 20060709 (experimental)) #1 Fri Dec 15 13:51:14 GMT 2006
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 000000001f740000 (usable)
 BIOS-e820: 000000001f740000 - 000000001f750000 (ACPI data)
 BIOS-e820: 000000001f750000 - 000000001f800000 (ACPI NVS)
 BIOS-e820: 00000000ffb80000 - 0000000100000000 (reserved)
503MB LOWMEM available.
Zone PFN ranges:
  DMA             0 ->     4096
  Normal       4096 ->   128832
early_node_map[1] active PFN ranges
    0:        0 ->   128832
DMI 2.3 present.
Allocating PCI resources starting at 20000000 (gap: 1f800000:e0380000)
Detected 2800.583 MHz processor.
Built 1 zonelists.  Total pages: 127826
Kernel command line: root=/dev/hda2 rootfstype=ext2 "" noinitrd console=ttyS0,38400n8 reboot=bios
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
PID hash table entries: 2048 (order: 11, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 508552k/515328k available (1334k kernel code, 6344k reserved, 316k data, 128k init, 0k highmem)
virtual kernel memory layout:
    fixmap  : 0xffffc000 - 0xfffff000   (  12 kB)
    vmalloc : 0xe0000000 - 0xffffa000   ( 511 MB)
    lowmem  : 0xc0000000 - 0xdf740000   ( 503 MB)
      .init : 0xc02a0000 - 0xc02c0000   ( 128 kB)
      .data : 0xc024db34 - 0xc029cc8c   ( 316 kB)
      .text : 0xc0100000 - 0xc024db34   (1334 kB)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 5604.13 BogoMIPS (lpj=28020690)Mount-cache hash table entries: 512
monitor/mwait feature present.
using mwait in idle threads.
CPU: Trace cache: 12K uops, L1 D cache: 16K
CPU: L2 cache: 1024K
Compat vDSO mapped to ffffe000.
CPU: Intel(R) Pentium(R) 4 CPU 2.80GHz stepping 03
Checking 'hlt' instruction... OK.
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.10 entry at 0xf0031, last bus=1
PCI: Using configuration type 1
Setting up standard PCI resources
Linux Plug and Play Support v0.97 (c) Adam Belay
PCI: Probing PCI hardware
PCI quirk: region 0800-087f claimed by ICH4 ACPI/GPIO/TCO
PCI quirk: region 0480-04bf claimed by ICH4 GPIO
PCI: Ignoring BAR0-3 of IDE controller 0000:00:1f.1
PCI: Firmware left 0000:01:08.0 e100 interrupts enabled, disabling
PCI: Transparent bridge - 0000:00:1e.0
PCI: Using IRQ router PIIX/ICH [8086/24d0] at 0000:00:1f.0
PCI: Found IRQ 5 for device 0000:00:1f.1
PCI: Sharing IRQ 5 with 0000:00:1d.2
PCI: Ignore bogus resource 6 [0:0] of 0000:00:02.0
PCI: Bridge: 0000:00:1e.0
  IO window: a000-bfff
  MEM window: fe500000-fe5fffff
  PREFETCH window: de400000-ee3fffff
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 16384 bind 8192)
TCP reno registered
scx200: NatSemi SCx200 Driver
squashfs: version 3.0 (2006/03/15) Phillip Lougher
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
0000:00:1d.7 EHCI: BIOS handoff failed (BIOS bug ?) 01010001
isapnp: Scanning for PnP cards...
isapnp: No Plug & Play device found
Real Time Clock Driver v1.12ac
Non-volatile memory driver v1.2
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
hda: ST340015A, ATA DISK drive
hdc: ATAPI MS-8148C1, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: max request size: 128KiB
hda: 78165360 sectors (40020 MB) w/2048KiB Cache, CHS=65535/16/63
hda: cache flushes supported
 /dev/ide/host0/bus0/target0/lun0: p1 p2 < p5 >
block2mtd: version $Revision: 1.30 $
ip_conntrack version 2.4 (4026 buckets, 32208 max) - 240 bytes per conntrack
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP vegas registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Bridge firewalling registered
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
Using IPI Shortcut mode
attempt to access beyond end of device
Time: tsc clocksource has been installed.
hda2: rw=0, want=4, limit=2
EXT2-fs: unable to read superblock
No filesystem could mount root, tried:  ext2
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(3,2)

However, if I plug the USB stick into a desktop PC running Ubuntu, it mounts both partitions successfully.

I suspect the problem is simply that the root partition on USB is sda2, not hda2, and also that I'm missing USB drivers. If this were a compact flash card I expect it would work out of the box.

So I changed in 'make menuconfig':
Target Images -> Root partitions -> /dev/sda2
Kernel modules -> USB support -> core, ohci, uhci, usb2, storage all compiled into kernel
Kernel modules -> Filesystems -> ext2, ext3 compiled into kernel

but it appears to make no difference - no USB devices are mentioned during the startup messages, and it ends with

VFS: Cannot open root device "sda2" or unknown-block(0,0)
Time: tsc clocksource has been installed.
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Now, if I look at the timestamp on build_i386/linux/vmlinux it shows that the kernel has been rebuilt - but "strings vmlinux | grep -i usb" gives no response, which implies that the USB devices have not been compiled into the kernel.

Ah, but those menuconfig flags only determine whether kmod-usb-* make it into the root filesystem, not that they are built into the kernel.

So I tried modifying target/linux/x86-2.6/config to turn on the relevant options:
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_STORAGE=y

That just gave me a load of build errors about undefined symbols in the MODPOST part of the build.

vivekian wrote:

The next step i want to do is add a package  --  aodv--uu. After the reading the documenation i created the Makefile but i am not sure as to what has to be done after that step to create from the existing toolchain.

When I did this before, I think that just a 'make' at the top level was sufficient.

You may need to force the buildroot to rebuild the list of available packages now you've added a new one. Try "rm tmp/.pkginfo" then "make menuconfig"

The discussion might have continued from here.