ipcop support

community support forum
It is currently Wed Apr 23, 2014 7:42 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 18 posts ] 
Author Message
Unread postPosted: Sun Jun 13, 2010 9:41 am 
New User

Joined: Sun Jun 13, 2010 1:36 am
Posts: 5
:cry:
OK, after spending days and days and ..king days trying to get ipcop running. I Need help
Hardward: Alix 3d3
HW Config:
BOOT OS : CF sandisk 4GB 30Mb/s
GREEN: One Etho: for green zone only
RED: USB 3G modem: yet to configure, will be e160 to optus/exetel AU
BLUE: miniPCI TP Link wirelessN apapter.

Ive got all the hardware , just need to step thru the install and configuration: which will be, please correct me where I am wrong:
1. Create a USB stick Installation BOOT drive....DONE.
2. Install ipcop to CF HDD ...DONE (easy)
3. Create a new CF drive image using MKFLASH so that all the correct permissions and setup for longevity when running on a CF Hdd.....DONE as per instructions
4. Delete all partitions from the CF...DONE
5. Write the "512flash.img" to the CF, creating the wonderful ipcop CF boot disk. This involves:
- Remove the CF from the ALIX 3d3 and place it in Ubuntu Linux PC .
- Copy over the "512flash.img" file to a temp folder on the PC.
- using DD command write the "512flash.img" to the CF card
....DONE...
5a. This creates 3 partitions:
sdc1 - Bootable ext3, 8.4 MB - cotains GRUB and vmlinux etc
sdc2 - non-bootable ext3, 31 MB
sdc3 - unallocated , 3.5GB
sdc4 - non-bootable ext3, 469 MB - seems to contain the OS
6. Insert the CF back into the ALIX......Bingo!.........NOTHING!

ALIX cannot find the bootable partition on the CF.
Questions
I assume that if I just simply install and run from CF as in step 2, the CF HDD will be written to just as if it is a normal HDD , without the config changes that the MKFLASH script, thus the CF longevity issue remains.
Q1. Why doesnt the CF made from "512flash.img" boot?
Q2. Is there some way or some script that can be run to perform the mkflash changes needed to an existing CF install?


The next step will be setting up
RED
Q3. What parameters do I need to set up for a E160 or E1762 USB 3G Modem card?
and
BLUE
Q4. Can I actually use a miniPCI 802.11N card for BLUE as I intend?
as per above,

but I need the CF disk made w MKDISK to work first!

Can anyone help ? please


Top
 Profile  
 
Unread postPosted: Sun Jun 13, 2010 10:04 am 
New User

Joined: Sun Jun 13, 2010 1:36 am
Posts: 5
Is it because my "Staging" machine IS my machine?
I created the 512flash.img on the same CF as the ALIX boots from.
Is that a problem?
I don't have another box with a CF reader I can stage from, I would not have thought this would be a problem?


Top
 Profile  
 
Unread postPosted: Sun Jun 13, 2010 12:02 pm 
Expert

Joined: Sat Sep 23, 2006 11:23 am
Posts: 2413
Location: LDK | Hessen | Germany
remoteONE wrote:
Is that a problem?

You probably do not have enough free space to create the 512 MiB Image.

_________________
Image

-=[ If you want answers: provide lots of information, including tiny details! ]=-


Top
 Profile  
 
Unread postPosted: Sun Jun 13, 2010 3:06 pm 
New User

Joined: Sun Jun 13, 2010 1:36 am
Posts: 5
weizen_42 wrote:
You probably do not have enough free space to create the 512 MiB Image.

Well, as stated, its a 4GB CF card, I reckon it will fit...and then some. It fits fine,
I copied 512flash.img to the ubuntu machine then burn the image to CF using dd , as per instructions, but it wont boot the ALIX 3d3.

***Is there any way make changes to the System Preferences directly to the CF installed iPcop OS?
It seems to be an oddly convoluted approach to installing on CF card, just to disable file access writes etc....!

Additionally, Are there any switches I should be using with "dd" to ensure the CF image is written correctly? :!:


Top
 Profile  
 
Unread postPosted: Wed Jun 16, 2010 3:14 am 
New User

Joined: Sun Jun 13, 2010 1:36 am
Posts: 5
My MacBook Disk utility won't recognize any ipcop or pfsense .img files. So can't write to CF using the mac either. Says file is corrupt.
If the mac Disk Utility Should be able to read these images, then the 512flash.img file must be corrupt. Ubuntu dd command wont write the img file. It just hangs there,for days and won't finish. WT?


Top
 Profile  
 
Unread postPosted: Thu Jun 17, 2010 2:46 pm 
New User

Joined: Sun Jun 13, 2010 1:36 am
Posts: 5
seems Im the only one interested given the lack of response...
I've managed to write the 512flash.img file to the CF with a external USB all-in-one reader on ubuntu. It looks like the internal card reader is not driven properly by ubuntu.
But the system still wont boot.

What is changed between the initial CF install to the mkdisk imag to stop it from booting?
Surely the GrUB defs are still the same!
The CF card is Sandisk Ultra2 4GByte 30MB/s.. Has anyone had issues with this CF card?

I'm about to give up on this. . . . .help please!


Top
 Profile  
 
Unread postPosted: Tue Aug 17, 2010 2:17 pm 
New User

Joined: Wed May 19, 2010 6:11 am
Posts: 10
where did you get the image of IPCop to put on the flash drive? i would like to try this project at well.


Top
 Profile  
 
Unread postPosted: Fri Oct 01, 2010 4:38 am 
New User

Joined: Wed May 19, 2010 6:11 am
Posts: 10
so strike my last message. i made my own image but i can't get my Alix to output to the serial port. were you able to do this RemoteOne?


Top
 Profile  
 
Unread postPosted: Fri Oct 01, 2010 7:49 am 
New User

Joined: Fri Mar 06, 2009 11:14 am
Posts: 7
seems that the 1st of october all is working on this :)
at the moment i am working and i have a working cf with ipcop running smoothly, but
this is the image downloaded ready to run; i did it my self and it does not work.

i note in the ready-to-run ipcop:

root@ipcop:/boot/grub # cat grub.conf
timeout 5
default saved
foreground = 16064e
background = ffffff
serial --unit=0 --speed=38400
title IPCop
root (hd0,0)
kernel /vmlinuz root=/dev/hda4 panic=10 acpi=off ro ide=nodma ramdisk_size=65536 console=ttyS0,38400n8 nokeyb
savedefault
title IPCop (ACPI enabled)
root (hd0,0)
kernel /vmlinuz root=/dev/hda4 panic=10 ro ide=nodma ramdisk_size=65536 console=ttyS0,38400n8 nokeyb
savedefault


and:
root@ipcop:/etc # cat inittab
#
# $Id: inittab,v 1.6.2.1 2006/01/24 15:25:35 franck78 Exp $
#
id:3:initdefault:

l0:0:wait:/etc/rc.d/rc.halt halt
l6:6:wait:/etc/rc.d/rc.halt reboot

si::sysinit:/etc/rc.d/rc.sysinit

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -r now

# Run gettys in standard runlevels
T0:2345:respawn:/sbin/agetty -L 38400 ttyS0

# Going single user mode for maintenance
xx:S1:respawn:/bin/bash



this way ipcop at boot redirect output to serial line, but these changes are not into mkflash bash script

woring in progress...


Top
 Profile  
 
Unread postPosted: Fri Oct 01, 2010 1:56 pm 
New User

Joined: Fri Mar 06, 2009 11:14 am
Posts: 7
does work!
if u do not remove splash image, system stuck there
I dunno where, but somewhere there should be a valid mkflash suited for alix
as soon as i finish to modify mine, i will post it


Top
 Profile  
 
Unread postPosted: Fri Oct 01, 2010 4:18 pm 
New User

Joined: Fri Mar 06, 2009 11:14 am
Posts: 7
to run following script, 2 files are required in the dir where you execute ./mkflash parameters
inittab
grub.conf

and logrotate.conf

===============================================
cat inittab
#
# $Id: inittab,v 1.6.2.1 2006/01/24 15:25:35 franck78 Exp $
#
id:3:initdefault:

l0:0:wait:/etc/rc.d/rc.halt halt
l6:6:wait:/etc/rc.d/rc.halt reboot

si::sysinit:/etc/rc.d/rc.sysinit

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -r now

# Run gettys in standard runlevels
T0:2345:respawn:/sbin/agetty -L 38400 ttyS0

# Going single user mode for maintenance
xx:S1:respawn:/bin/bash

===============================================

cat grub.conf
timeout 5
default saved
foreground = 16064e
background = ffffff
serial --unit=0 --speed=38400
title IPCop
root (hd0,0)
kernel /vmlinuz root=/dev/hda4 panic=10 acpi=off ro ide=nodma ramdisk_size=65536 console=ttyS0,38400n8 nokeyb
savedefault
title IPCop (ACPI enabled)
root (hd0,0)
kernel /vmlinuz root=/dev/hda4 panic=10 ro ide=nodma ramdisk_size=65536 console=ttyS0,38400n8 nokeyb
savedefault

===============================================

settings.8139 is not needed, nic on alix 132d are via-rhine

===============================================
#!/bin/bash
#
# This file is part of the IPCop Firewall.
#
# IPCop 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.
#
# IPCop 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 IPCop; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: mkflash,v 1.6.2.19 2008/11/11 19:48:13 gespinasse Exp $
#
#
# Originally by Guy Ellis and Steve Bauer
# Copyright 2001 Traverse Technologies Australia - http://www.traverse.com.au/
#
# Copyright (C) 2002-04-08 Mark Wormgoor <mark@wormgoor.com>
# - Modified to use loopback filesystem
# - Modified to easily change partition sizes
# Copyright (C) 2003-04-04 Nick Shore <nick.shore@multithread.co.uk>
# - Added disksize calculations
# Copyright (C) 2003-04-09 Simon Turner <simont@angledata.co.uk>
# - Modified to easily change partition sizes and fix
# some bugs.
# Copyright (C) 2004-01-29 Mark Wormgoor <mark@wormgoor.com>
# - Modified for IPCop 1.4 (grub, etc)
# Copyright (C) 2004-08-17 Dale Haag <dhaag@net-defender.net>
# - Fixed grub stage2 problem for CF disks
# - Added command line option to select target CF drive
# - Modified for creating 256mb, 512mb and 1gb CF disks
# - Modified routines for building sym links
# - Added ability to define kernel loading parameters needed for large CF disks
# - Added ability to define grub install parameters needed for large CF disks
# - Flash file is created as /tmp/[size]flash.img to allow storing multiple development images
# Copyright (C) 2004-08-30 Dale Haag <dhaag@net-defender.net>
# - Fixed issue with ramdisk sym link not properly being created for rc.flash.up
# - Added ability to configure ethernet settings for a LEX with 3 RTL8139 during flash build
# Copyright (C) 2005-08-13 Gilles Espinasse <g.esp.ipcop@free.fr>
# - Use a bigger /boot partition to allow easier kernel upgrade and support smp kernel
# - Define zlog_MB at 30MB for 512 and 1gb like with 256 flash
# Copyright (C) 2007-07-23 Mario Zimmermann <zisoft@ipcop-forum.de>
# - Moved directories /home/httpd/html/graphs and /home/httpd/html/sgraph to ramdisk
# - Moved directory /var/lock to ramdisk
# - Moved directory /var/spool to ramdisk
# - Start fcron with parameter -s 86400
# - Support for 2GB and 4GB CF cards
# Features
# - ext3 file system
# - auto grub install to CF
# - compressed logs on flash + log to ramdisk
#
# Some SiS chipset don't like ide=nodma parameter (bug SF 1098510), remove in case of problem

VERSION="0.4.4_mod_10"

if [ ! -f logrotate.conf ]; then
echo "Error! You probably copied this tool without it's companion file: logrotate.conf"
exit 1
fi

SIZE="$1"
CF="$2"
ramdisk_MB=64
boot_MB=8
zlog_MB=30
heads=16
sectors=32
grub_PARMS="--force-lba"
#
# Uncomment the correct kernel parameters!
#
#kernel_PARMS="idebus=100 ide=nodma ide0=0x177-0x177,0x376" #specific to LEX with CF on secondary master
#kernel_PARMS="" # Sis chipset workaround, don't use nodma
kernel_PARMS="ide=nodma" # Generic

# See what we're supposed to do (32 & 64 are too small now for this current script and IPCop 1.4.0)
case "$SIZE" in
128)
echo "`date '+%b %e %T'`: Creating 128MB Compact Flash"
flash_MB=122
zlog_MB=10
heads=8
#grub_PARMS=""
#kernel_PARMS=""
;;
256)
echo "`date '+%b %e %T'`: Creating 256MB Compact Flash"
flash_MB=222
;;
512)
echo "`date '+%b %e %T'`: Creating 512MB Compact Flash"
flash_MB=485
;;
1gb)
echo "`date '+%b %e %T'`: Creating 1 Gigabyte Compact Flash"
flash_MB=972
;;
2gb)
echo "`date '+%b %e %T'`: Creating 2 Gigabyte Compact Flash"
flash_MB=1928
;;
4gb)
echo "`date '+%b %e %T'`: Creating 4 Gigabyte Compact Flash"
flash_MB=3856
;;
*)
echo "Usage: $0 {128|256|512|1gb|2gb|4gb} {hda|hdb|hdc|hdd}"
exit 1
;;
esac


case "$CF" in
hda|hdb|hdc|hdd)
echo "`date '+%b %e %T'`: Creating $CF Compact Flash"
drive_ID=${CF}4
;;
*)
echo "Usage: $0 {128|256|512|1gb} {hda|hdb|hdc|hdd}"
exit 1
;;
esac

# Calculate all the required derived variables...
bs=512 # do not change!

root_MB=$(( $flash_MB - $boot_MB - $zlog_MB ))
flash_blocks=$(( $flash_MB * 1024 * 1024 / $bs ))

boot_blocks=$(( $boot_MB * 1024 * 1024 / $bs - 1 ))
zlog_blocks=$(( $zlog_MB * 1024 * 1024 / $bs ))
root_blocks=$(( $root_MB * 1024 * 1024 / $bs ))

boot_block_offset=1
zlog_block_offset=$(( $boot_block_offset + $boot_blocks ))
root_block_offset=$(( $zlog_block_offset + $zlog_blocks ))

boot_byte_offset=$(( $boot_block_offset * $bs ))
zlog_byte_offset=$(( $zlog_block_offset * $bs ))
root_byte_offset=$(( $root_block_offset * $bs ))

cylinders=$(( $flash_blocks / $heads / $sectors ))

# RAM Disk
ramdisk_KB=$(( $ramdisk_MB * 1024 ))


############################################################################
#
# Check for enough space in /tmp
#
############################################################################
if [ `df -m /tmp | tail -1 | awk '{print $4}'` -lt $flash_MB ];
then
echo "ERROR: Not enough space in /tmp."
echo "You need at least $flash_MB MB of free space in /tmp"
exit 1
fi


############################################################################
#
# Check for enough space in /var/log
#
############################################################################
if [ `df -m /var/log | tail -1 | awk '{print $4}'` -lt $flash_MB ];
then
echo "ERROR: Not enough space in /var/log."
echo "You need at least $flash_MB MB of free space in /var/log"
exit 1
fi


############################################################################
# #
# Loading loopback kernel module #
# #
############################################################################
echo "`date '+%b %e %T'`: Loading loopback kernel module"
modprobe loop


############################################################################
# #
# Creating empty flash image in /tmp/cf-image #
# #
############################################################################
echo "`date '+%b %e %T'`: Creating empty flash image in /tmp"
dd if=/dev/zero of=/tmp/flash.img bs=$bs count=$flash_blocks >/dev/null
dd if=/dev/zero of=/var/log/part1.img bs=$bs count=$boot_blocks >/dev/null
dd if=/dev/zero of=/var/log/part2.img bs=$bs count=$zlog_blocks >/dev/null
dd if=/dev/zero of=/var/log/part3.img bs=$bs count=$root_blocks >/dev/null


############################################################################
# #
# Making filesystems #
# #
############################################################################
echo "`date '+%b %e %T'`: Making filesystems"
mke2fs -F -j -m 0 -b 1024 /var/log/part1.img >/dev/null
mke2fs -F -j -m 0 -b 1024 /var/log/part2.img >/dev/null
mke2fs -F -j -m 0 -b 1024 /var/log/part3.img >/dev/null


############################################################################
# #
# Creating and partitioning Compact Flash image #
# #
############################################################################
echo "`date '+%b %e %T'`: Creating and partitioning Compact Flash image"
sfdisk -H $heads -S $sectors -C $cylinders -uM /tmp/flash.img <<EOF >/dev/null 2>&1
# Start Size Type Bootable
,$boot_MB,,* # /boot
,$zlog_MB,, # /var/log_compressed
,0,, # Unused
,$root_MB,, # /
EOF
dd if=/var/log/part1.img of=/tmp/flash.img seek=$boot_block_offset bs=$bs
dd if=/var/log/part2.img of=/tmp/flash.img seek=$zlog_block_offset bs=$bs
dd if=/var/log/part3.img of=/tmp/flash.img seek=$root_block_offset bs=$bs
rm -f /var/log/part?.img


############################################################################
# #
# Mounting loopback flash image under /mnt #
# #
############################################################################
echo "`date '+%b %e %T'`: Mounting loopback flash image under /mnt"
rm -rf /mnt/flash
mkdir -p /mnt/flash
mount -o loop,offset=$root_byte_offset /tmp/flash.img /mnt/flash
mkdir -p /mnt/flash/boot
mount -o loop,offset=$boot_byte_offset /tmp/flash.img /mnt/flash/boot
mkdir -p /mnt/flash/var/log_compressed
mount -o loop,offset=$zlog_byte_offset /tmp/flash.img /mnt/flash/var/log_compressed


############################################################################
# #
# Creating flash image directory structure #
# #
############################################################################
echo "`date '+%b %e %T'`: Creating flash image directory structure"
mkdir -p /mnt/flash/{ram/,proc/,mnt/}


############################################################################
# #
# Copying files into flash image #
# #
############################################################################
echo "`date '+%b %e %T'`: Copying files into flash image"
# /boot
cp -a /boot /mnt/flash/

# /var
mkdir -p /mnt/flash/var/{log,log_compressed,spool,www/icons}
cp -a /var/ipcop /var/lib /var/state /var/lock /var/log /mnt/flash/var

#######################################################################################
# Configure flash image ethernet settings #
# alix has via-rhine #
#######################################################################################
cat /var/ipcop/ethernet/settings | sed -e 's/8139too/via-rhine/' > /mnt/flash/var/ipcop/ethernet/settings


rm -rf /mnt/flash/var/log/lost+found
cp -a /var/run /var/empty /mnt/flash/var
cp -a /var/spool/cron /mnt/flash/var/spool
ln -s /tmp /mnt/flash/var/patches
ln -sf /ram/squid /var/log/cache
rm -f /mnt/flash/var/lib/logrotate.status
rm -f /mnt/flash/var/state/dhcp/*
touch /mnt/flash/var/state/dhcp/dhcpd.leases
find /mnt/flash/var/run \( -type f -o -type s \) -exec rm -f {} \;
touch /mnt/flash/var/run/utmp
chmod 644 /mnt/flash/var/run/utmp
chown root:utmp /mnt/flash/var/run/utmp
touch /mnt/flash/var/log/wtmp
chmod 664 /mnt/flash/var/log/wtmp
chown root:utmp /mnt/flash/var/log/wtmp

# /var/log
rm -rf /mnt/flash/var/log/snort/*
find /mnt/flash/var/log -type f -exec rm -f {} \;
touch /mnt/flash/var/log/squid/access.log
chmod 644 /mnt/flash/var/log/squid/access.log
chown squid:squid /mnt/flash/var/log/squid/access.log
tar -C /mnt/flash -czf /mnt/flash/var/log_compressed/log.tgz var/log/
rm -rf /mnt/flash/var/log/
ln -sf /ram/log /mnt/flash/var/log

# Other files
cp -a /sbin /mnt/flash/
cp -a /bin /mnt/flash/
cp -a /lib /mnt/flash/
cp -a /dev /mnt/flash/

# create the symlinks
echo "`date '+%b %e %T'`: Creating $CF Sym Link"
ln -sf /dev/"$CF" /mnt/flash/dev/harddisk

echo "`date '+%b %e %T'`: Creating "$CF'1'" Sym Link"
ln -sf /dev/$CF'1' /mnt/flash/dev/harddisk1

echo "`date '+%b %e %T'`: Creating "$CF'2'" Sym Link"
ln -sf /dev/$CF'2' /mnt/flash/dev/harddisk2

echo "`date '+%b %e %T'`: Creating "$CF'3'" Sym Link"
ln -sf /dev/$CF'3' /mnt/flash/dev/harddisk3

echo "`date '+%b %e %T'`: Creating "$CF'4'" Sym Link"
ln -sf /dev/$CF'4' /mnt/flash/dev/harddisk4


cp -a /root /mnt/flash/
rm -f /mnt/flash/root/.bash_history
cp -a /etc /mnt/flash/
rm -rf /mnt/flash/etc/{httpd/conf/ssl*,makedev.d/}
rm -f /mnt/flash/etc/ssh/*key
rm -f /mnt/flash/etc/httpd/server.*
cp -a /home /mnt/flash/
rm -f /home/httpd/html/graphs/*
rm -f /home/httpd/html/sgraph/*
cp -a /usr /mnt/flash
rm -rf /mnt/flash/{tmp/,usr/tmp/,var/tmp/}
ln -sf /ram/tmp/ /mnt/flash/tmp
ln -sf /ram/tmp/ /mnt/flash/usr/tmp
ln -sf /ram/tmp/ /mnt/flash/var/tmp
ln -sf /dev/ram0 /mnt/flash/dev/ramdisk


rm -rf /mnt/flash/home/httpd/html/graphs/*
rmdir /mnt/flash/home/httpd/html/graphs
ln -sf /ram/graphs /mnt/flash/home/httpd/html/graphs
rm -rf /mnt/flash/home/httpd/html/sgraph/*
rmdir /mnt/flash/home/httpd/html/sgraph
ln -sf /ram/sgraph /mnt/flash/home/httpd/html/sgraph
rm -rf /mnt/flash/var/lock/*
rmdir /mnt/flash/var/lock
ln -sf /ram/var/lock /mnt/flash/var/lock

tar -czf /mnt/flash/var/log_compressed/spool.tgz -C /var/spool cron
rm -rf /mnt/flash/var/spool/*
rmdir /mnt/flash/var/spool
ln -sf /ram/var/spool /mnt/flash/var/spool


############################################################################
# #
# Reconfiguring logrotate #
# #
############################################################################
echo "`date '+%b %e %T'`: Reconfiguring logrotate"
cp -pf logrotate.conf /mnt/flash/etc/

############################################################################
# #
# Reconfiguring others for alix #
# #
############################################################################
echo "`date '+%b %e %T'`: Reconfiguring alix stuff"
cp -pf inittab /mnt/flash/etc/
cp -pf grub.conf /mnt/flash/boot/grub/
echo "ttyS0" >> /etc/securetty


############################################################################
# #
# Installing new fstab #
# #
############################################################################
echo "`date '+%b %e %T'`: Installing new fstab"
cat /etc/fstab | sed -e 's/log\t/log_compressed/' > /mnt/flash/etc/fstab
df | grep /mnt/flash


############################################################################
# #
# Touching /etc/FLASH #
# #
############################################################################
echo "`date '+%b %e %T'`: Touching /etc/FLASH"
touch /mnt/flash/etc/FLASH


############################################################################
# #
# Reconfiguring /etc/rc.d/rc.flash.up #
# #
############################################################################
echo "`date '+%b %e %T'`: Reconfiguring /etc/rc.d/rc.flash.up"
sed -i -e 's#rm -rf /tmp/$#rm -rf /tmp#1' /mnt/flash/etc/rc.d/rc.flash.up
sed -i -e 's#rm -rf /var/log/$#rm -rf /var/log#1' /mnt/flash/etc/rc.d/rc.flash.up

cat >> /mnt/flash/etc/rc.d/rc.flash.up <<EOF

mkdir /ram/graphs
if [ ! -L /home/httpd/html/graphs ]; then
rm -rf /home/httpd/html/graphs
ln -fs /ram/graphs /home/httpd/html/graphs
fi

mkdir /ram/sgraph
if [ ! -L /home/httpd/html/sgraph ]; then
rm -rf /home/httpd/html/sgraph
ln -fs /ram/sgraph /home/httpd/html/sgraph
fi

mkdir -p /ram/var/lock
if [ ! -L /var/lock ]; then
rm -rf /var/lock
ln -fs /ram/var/lock /var/lock
fi

mkdir -p /ram/var/spool
if [ ! -L /var/spool ]; then
rm -rf /var/spool
ln -fs /ram/var/spool /var/spool
fi

tar -xzf /var/log_compressed/spool.tgz -C /var/spool

EOF

############################################################################
# #
# Create directory /ram/graphs in rc.flash.up #
# #
############################################################################
echo "`date '+%b %e %T'`: Reconfiguring /etc/rc.d/rc.flash.up"
if [ -z "`/bin/grep \"/ram/graphs\" /mnt/flash/etc/rc.d/rc.flash.up`" ]; then
cat >> /mnt/flash/etc/rc.d/rc.flash.up <<EOF

mkdir /ram/graphs
if [ ! -L /home/httpd/html/graphs ]; then
ln -fs /ram/graphs /home/httpd/html/graphs
fi
EOF
fi


############################################################################
# #
# Reconfiguring /etc/rc.d/rc.flash.down #
# #
############################################################################
echo "`date '+%b %e %T'`: Reconfiguring /etc/rc.d/rc.flash.down"
cat >> /mnt/flash/etc/rc.d/rc.flash.down <<EOF

tar -czf /var/log_compressed/spool.tgz -C /var/spool cron
EOF


############################################################################
# #
# Configure apache to follow symlinks in /home/httpd/html #
# #
############################################################################
echo "`date '+%b %e %T'`: Reconfiguring /etc/httpd/conf/httpd.conf"
if [ -z "`/bin/grep \"Options ExecCGI FollowSymlinks\" /mnt/flash/etc/httpd/conf/httpd.conf`" ]; then
sed -i -e s/"Options ExecCGI"/"Options ExecCGI FollowSymlinks"/1 /mnt/flash/etc/httpd/conf/httpd.conf
fi




############################################################################
# #
# Installing grub #
# #
############################################################################
echo "`date '+%b %e %T'`: Installing Grub"

/usr/sbin/grub --batch <<EOF >/dev/null 2>&1
device (hd0) /tmp/flash.img
geometry (hd0)
root (hd0,0)
makeactive
install $grub_PARMS (hd0,0)/grub/stage1 (hd0) (hd0,0)/grub/stage2 0x8000 p /grub/grub.conf
quit
EOF

############################################################################
# #
# Cleaning up #
# #
############################################################################
echo "`date '+%b %e %T'`: Cleaning up"
rm -f verinfo
umount /mnt/flash/var/log_compressed
umount /mnt/flash/boot
umount /mnt/flash
losetup -d /dev/loop0
losetup -d /dev/loop1
losetup -d /dev/loop2
mv /tmp/flash.img /tmp/$SIZE'flash.img'

echo "`date '+%b %e %T'`: Mkflash For $SIZE Flash Drive On $CF Complete"

echo ""
echo ""
echo "You can mount this image's partitions for testing purposes"
echo "with the following commands:"
echo ""
echo "/boot :"
echo "mount -o loop,offset=$boot_byte_offset /tmp/${SIZE}flash.img /mnt/flash/"
echo ""
echo "/root :"
echo "mount -o loop,offset=$root_byte_offset /tmp/${SIZE}flash.img /mnt/flash"
echo ""
echo "/var/log_compressed :"
echo "mount -o loop,offset=$zlog_byte_offset /tmp/${SIZE}flash.img /mnt/flash/"
echo ""

===============================================


Last edited by maumar on Mon Oct 04, 2010 9:28 am, edited 1 time in total.

Top
 Profile  
 
Unread postPosted: Mon Oct 04, 2010 1:28 am 
New User

Joined: Wed May 19, 2010 6:11 am
Posts: 10
OK so i followed your directions and have gotten farther than I have ever gotten before. It actually outputted to the serial console but now i am getting another error. I am very new to Linux and I'm not quite sure what to do. The device I am making the image from is a PC, would that have anything to do with it not being able to find the right disk? Any suggestions? error below.

(...)
fsck.ext3: No such device or address while trying to open /dev/harddisk4
Possibly non-existent or swap device?
Checking root filesystem: Failed
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D to continue):


Top
 Profile  
 
Unread postPosted: Mon Oct 04, 2010 9:04 am 
New User

Joined: Fri Mar 06, 2009 11:14 am
Posts: 7
i see only 2 reason to your fault:
1
it seems that you had a disk space problem when generating image on staging ipcop

if u have enough space, when you run mkflash, the image you get is perfect

2.
you have some issue when you do
dd if=ipcop.img of=/dev/sda
or whatever else

please report here any output you have during the 2 phases


PS: this is not for linux beginner, imho


Top
 Profile  
 
Unread postPosted: Mon Oct 04, 2010 9:54 am 
New User

Joined: Fri Mar 06, 2009 11:14 am
Posts: 7
check for free space and report here your output:

root@ipcop:~/mkflash/mkflash # df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 7.9G 394M 7.5G 5% /
/dev/root 7.9G 394M 7.5G 5% /
/dev/harddisk1 16M 5.1M 11M 34% /boot
/dev/harddisk2 139G 335M 132G 1% /var/log

execute mkflash and report here your output
an output of mkflash is this:

============ start of output =====================
root@ipcop:~/mkflash/mkflash # ./mkflash 4gb hda
Oct 4 11:38:29: Creating 4 Gigabyte Compact Flash
Oct 4 11:38:29: Creating hda Compact Flash
Oct 4 11:38:29: Loading loopback kernel module
Oct 4 11:38:29: Creating empty flash image in /tmp
7897088+0 records in
7897088+0 records out
4043309056 bytes (4.0 GB) copied, 121.584 seconds, 33.3 MB/s
16383+0 records in
16383+0 records out
8388096 bytes (8.4 MB) copied, 0.102641 seconds, 81.7 MB/s
61440+0 records in
61440+0 records out
31457280 bytes (31 MB) copied, 0.405652 seconds, 77.5 MB/s
7819264+0 records in
7819264+0 records out
4003463168 bytes (4.0 GB) copied, 88.2613 seconds, 45.4 MB/s
Oct 4 11:42:00: Making filesystems
mke2fs 1.40.11 (17-June-2008)
mke2fs 1.40.11 (17-June-2008)
mke2fs 1.40.11 (17-June-2008)
Warning: 256-byte inodes not usable on older systems
Oct 4 11:42:20: Creating and partitioning Compact Flash image
16383+0 records in
16383+0 records out
8388096 bytes (8.4 MB) copied, 0.218122 seconds, 38.5 MB/s
61440+0 records in
61440+0 records out
31457280 bytes (31 MB) copied, 0.654881 seconds, 48.0 MB/s
7819264+0 records in
7819264+0 records out
4003463168 bytes (4.0 GB) copied, 236.851 seconds, 16.9 MB/s
Oct 4 11:46:27: Mounting loopback flash image under /mnt
Oct 4 11:46:30: Creating flash image directory structure
Oct 4 11:46:30: Copying files into flash image
Oct 4 11:49:39: Creating hda Sym Link
Oct 4 11:49:39: Creating hda1 Sym Link
Oct 4 11:49:39: Creating hda2 Sym Link
Oct 4 11:49:39: Creating hda3 Sym Link
Oct 4 11:49:39: Creating hda4 Sym Link
Oct 4 11:50:05: Reconfiguring logrotate
Oct 4 11:50:05: Reconfiguring alix stuff
Oct 4 11:50:05: Installing new fstab
/dev/loop0 3847283 237362 3609921 7% /mnt/flash
/dev/loop1 7927 5106 2821 65% /mnt/flash/boot
/dev/loop2 29745 1436 28309 5% /mnt/flash/var/log_compressed
Oct 4 11:50:05: Touching /etc/FLASH
Oct 4 11:50:05: Reconfiguring /etc/rc.d/rc.flash.up
Oct 4 11:50:05: Reconfiguring /etc/rc.d/rc.flash.up
Oct 4 11:50:05: Reconfiguring /etc/rc.d/rc.flash.down
Oct 4 11:50:05: Reconfiguring /etc/httpd/conf/httpd.conf
Oct 4 11:50:05: Installing Grub
Oct 4 11:50:44: Cleaning up
Oct 4 11:50:44: Mkflash For 4gb Flash Drive On hda Complete


You can mount this image's partitions for testing purposes
with the following commands:

/boot :
mount -o loop,offset=512 /tmp/4gbflash.img /mnt/flash/

/root :
mount -o loop,offset=39845888 /tmp/4gbflash.img /mnt/flash

/var/log_compressed :
mount -o loop,offset=8388608 /tmp/4gbflash.img /mnt/flash/


============ end of output =====================

please, try what suggested, to test:

mount -o loop,offset=512 /tmp/4gbflash.img /mnt/flash/
ls -la /mnt/flash
umount /mnt/flash
mount -o loop,offset=39845888 /tmp/4gbflash.img /mnt/flash
ls -la /mnt/flash
umount /mnt/flash
mount -o loop,offset=8388608 /tmp/4gbflash.img /mnt/flash/
ls -la /mnt/flash
umount /mnt/flash

and report here the output


Top
 Profile  
 
Unread postPosted: Tue Oct 05, 2010 2:22 am 
New User

Joined: Wed May 19, 2010 6:11 am
Posts: 10
I have a 1Gig CF card, the image i am making is 512 so there should be plenty of space on the CF. as you can see from my df -h i have plenty of space on the hard drive i am creating the image on.

I am new to Linux but i have been working on/building PCs since 93. I think I have done pretty good so far with the little experience i have. and what better way to learn than an advanced project. :wink:

Here is the output of everything you asked for:
root@ipcop:~ # df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 7.9G 747M 7.1G 10% /
/dev/root 7.9G 747M 7.1G 10% /
/dev/harddisk1 16M 3.9M 12M 26% /boot
/dev/harddisk2 66G 209M 62G 1% /var/log
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
root@ipcop:~ # ./mkflash 512 hdc
Oct 5 00:23:51: Creating 512MB Compact Flash
Oct 5 00:23:51: Creating hdc Compact Flash
Oct 5 00:23:51: Loading loopback kernel module
Oct 5 00:23:51: Creating empty flash image in /tmp
993280+0 records in
993280+0 records out
508559360 bytes (509 MB) copied, 27.1611 seconds, 18.7 MB/s
16383+0 records in
16383+0 records out
8388096 bytes (8.4 MB) copied, 0.18365 seconds, 45.7 MB/s
61440+0 records in
61440+0 records out
31457280 bytes (31 MB) copied, 0.736873 seconds, 42.7 MB/s
915456+0 records in
915456+0 records out
468713472 bytes (469 MB) copied, 27.6452 seconds, 17.0 MB/s
Oct 5 00:24:47: Making filesystems
mke2fs 1.40.11 (17-June-2008)
mke2fs 1.40.11 (17-June-2008)
mke2fs 1.40.11 (17-June-2008)
Oct 5 00:24:50: Creating and partitioning Compact Flash image
16383+0 records in
16383+0 records out
8388096 bytes (8.4 MB) copied, 0.307854 seconds, 27.2 MB/s
61440+0 records in
61440+0 records out
31457280 bytes (31 MB) copied, 1.22582 seconds, 25.7 MB/s
915456+0 records in
915456+0 records out
468713472 bytes (469 MB) copied, 40.0973 seconds, 11.7 MB/s
Oct 5 00:25:39: Mounting loopback flash image under /mnt
Oct 5 00:25:40: Creating flash image directory structure
Oct 5 00:25:40: Copying files into flash image
Oct 5 00:25:54: Creating hdc Sym Link
Oct 5 00:25:54: Creating hdc1 Sym Link
Oct 5 00:25:54: Creating hdc2 Sym Link
Oct 5 00:25:54: Creating hdc3 Sym Link
Oct 5 00:25:54: Creating hdc4 Sym Link
Oct 5 00:26:08: Reconfiguring logrotate
Oct 5 00:26:08: Reconfiguring alix stuff
cp: cannot stat `inittab': No such file or directory
cp: target `/mnt/boot/grub/' is not a directory: No such file or directory
Oct 5 00:26:08: Installing new fstab
/dev/loop0 443252 83449 359803 19% /mnt/flash
/dev/loop1 7927 3878 4049 49% /mnt/flash/boot
/dev/loop2 29745 1404 28341 5% /mnt/flash/var/log_compressed
Oct 5 00:26:08: Touching /etc/FLASH
Oct 5 00:26:08: Reconfiguring /etc/rc.d/rc.flash.up
Oct 5 00:26:08: Reconfiguring /etc/rc.d/rc.flash.up
Oct 5 00:26:08: Reconfiguring /etc/rc.d/rc.flash.down
Oct 5 00:26:08: Reconfiguring /etc/httpd/conf/httpd.conf
Oct 5 00:26:08: Installing Grub
Oct 5 00:26:20: Cleaning up
Oct 5 00:26:21: Mkflash For 512 Flash Drive On hdc Complete


You can mount this image's partitions for testing purposes
with the following commands:

/boot :
mount -o loop,offset=512 /tmp/512flash.img /mnt/flash/

/root :
mount -o loop,offset=39845888 /tmp/512flash.img /mnt/flash

/var/log_compressed :
mount -o loop,offset=8388608 /tmp/512flash.img /mnt/flash/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
root@ipcop:~ # mount -o loop,offset=512 /tmp/512flash.img /mnt/flash/
root@ipcop:~ # ls -la /mnt/flash
total 2517
drwxr-xr-x 4 root root 1024 2010-09-16 22:13 .
drwxr-xr-x 4 root root 4096 2010-10-05 00:25 ..
drwxr-xr-x 2 root root 1024 2010-09-16 22:14 grub
drwx------ 2 root root 12288 2010-09-16 22:07 lost+found
lrwxrwxrwx 1 root root 17 2010-10-05 00:25 System.map -> System.map-2.4.36
-rw-r--r-- 1 root root 346817 2008-07-22 06:14 System.map-2.4.36
-rw-r--r-- 1 root root 367982 2008-07-22 06:08 System.map-2.4.36-smp
lrwxrwxrwx 1 root root 14 2010-10-05 00:25 vmlinuz -> vmlinuz-2.4.36
-rw-r--r-- 1 root root 880907 2008-07-22 06:14 vmlinuz-2.4.36
-rw-r--r-- 1 root root 944454 2008-07-22 06:08 vmlinuz-2.4.36-smp
lrwxrwxrwx 1 root root 18 2010-10-05 00:25 vmlinuz-smp -> vmlinuz-2.4.36-smp
root@ipcop:~ # umount /mnt/flash


Top
 Profile  
 
Unread postPosted: Tue Oct 05, 2010 2:27 am 
New User

Joined: Fri Mar 06, 2009 11:14 am
Posts: 7
who told you to use hdc?

./mkflash 512 hdc

this is wrong

you must use hda


Top
 Profile  
 
Unread postPosted: Tue Oct 05, 2010 2:40 am 
New User

Joined: Wed May 19, 2010 6:11 am
Posts: 10
i followed the directions on the IPCop web site. it said to use hdc...

http://www.ipcop.org/1.4.0/en/install/h ... un-mkflash


Top
 Profile  
 
Unread postPosted: Tue Oct 05, 2010 3:05 am 
New User

Joined: Wed May 19, 2010 6:11 am
Posts: 10
so i tried the hda and it wouldn't even boot into grub. i am trying again right now.

::EDIT::

I got it working!!! Thanks for all your help!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group