LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-25-2004, 01:30 PM   #1
ridesideways
LQ Newbie
 
Registered: Mar 2004
Location: NH
Distribution: Debian 3.0
Posts: 13

Rep: Reputation: 0
Question advanced LILO question


Hello everyone,

i am trying to set up a linux workstation whose sole purpose in life is to create bootable flash cards (compact-flash).

currently, when i want to create a new bootable flash card, i have to power down the system, put the blank flash card in /dev/hda position, boot off a floppy, and the floppy boots to a linux partition that is located at /dev/hdb2. then, i can partition the blank flash card, create filesystems, copy all the files over, and then run lilo, and lilo writes to /dev/hda. then i have to power off the machine and remove my newly created bootable flash card and i can go use it.

what i want to do is eliminate all the powering up and down that is required to attach the flash card to the IDE bus. obviously, the answer is to use a usb flash read/writer to write my compact flash cards.

well, linux treats usb storage as a SCSI disk. this is no problem when doing the following: put the blank flash card in the usb writer, partition /dev/sda, create filesystem on /dev/sda1, copy all my files over. this works great.

then i have to run lilo to make it bootable. this is where the problem occurs. the SCSI subsystem gets a different geometry than the geometry that the machine gets when the flash card is used as the bootable IDE drive. basically, i am creating the bootable flash card as a SCSI drive (because i'm going through a USB writer), but then i'm using it as a bootable IDE drive. the geomtries never match and it never boots properly.

here are the things i've tried:
1. using the '-f' option to lilo to specify a geometry
2. using the '-g' option to lilo, and configuring the IDE geometry to be that which is reported when the flash card is a SCSI drive
3. using lba32 and linear modes of lilo

nothing seems to work to create it as a SCSI drive, but then allow it to boot as an IDE drive.

has anyone done this before and made it work?

thanks for your time!

-eric
 
Old 03-25-2004, 05:50 PM   #2
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
This is really not my bag but I thought I'd share an idea.

If all the flash cards you're preparing are to have a similar configuration and used in similar environments/systems, wouldn't it be possible to create one such card and just copy the boot block using dd and then use that boot block as a master for all the cards you're creating later? I know this works when creating bootable CD-ROMs, but like I said, I know very little about these things.


Håkan
 
Old 03-26-2004, 07:12 AM   #3
ridesideways
LQ Newbie
 
Registered: Mar 2004
Location: NH
Distribution: Debian 3.0
Posts: 13

Original Poster
Rep: Reputation: 0
dd

thanks for the reply!

actually, before we had the current set of scripts that created our custom linux disks using sfdisk, mke2fs, lilo, etc., we actually did use 'dd' as you suggested to just dup the disk. this works fine for flash cards up to around 512MB because the size of the drive is small. but these same scripts are also used to create bootable hard disks (instead of flash) sometimes, and when you 'dd' a 20GB drive, it takes a *long* time. also, 'dd' requires that the size of the original and target disk be identical (or if the target is bigger, you just lose the space).

-eric
 
Old 03-26-2004, 08:11 AM   #4
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Yes, but what I meant was actually just using dd to copy the boot block. As long as the device geometry is the same, the boot block would remain the same, right? So my thought was to use something like dd if=/dev/hdb count=1 size=512 of=~/bootblock.bin (where 512 is the size of the boot block, /dev/hdb is the card you want to rip from and bootblock.bin the output file) to rip out the boot block. You could then use dd to reverse this action and put the boot block on a newly created flash card to make it bootable.

See what I mean now?


Håkan
 
Old 03-26-2004, 08:24 AM   #5
ridesideways
LQ Newbie
 
Registered: Mar 2004
Location: NH
Distribution: Debian 3.0
Posts: 13

Original Poster
Rep: Reputation: 0
yes, i see what you mean. but from what i know of the way lilo works, it is not enough to just dup the superblock (boot block) to copy all the necessary bootstrapping information that lilo needs. i believe lilo actually stores a list of absolute hardware sector addresses on which the kernel image is located, so that the kernel can be loaded using only the bios. i don't think that this list of sectors is stored on the boot block itself-- i think lilo stores it elsewhere on the disk. perhaps someone who knows for sure can verify this?

also, duping the boot block only makes sense when the original (master disk) and target disk are the exact same size. we have to support 64MB, 128MB, 256MB, 512MB flash cards, along with supporting various size hard drives. the boot block contains partition information which obviously changes depending on the size of the target disk. i don't think there is a way to make a one-boot-block-fits-all.

-eric
 
Old 03-26-2004, 09:46 AM   #6
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Rep: Reputation: 30
heres mine, it took a while but it works really well.

I have a compact flash card reader which is device /dev/sda. i have my dist on /dev/sda1. the command line i use to load lilo is:

lilo -v -C lilo.conf -b /dev/sda

my mounted flash card (/dev/sda1) is mounted at /mnt/flash

disk = /dev/sda
bios = 0x80
boot = /dev/sda
LBA32
backup = /dev/null
map = /mnt/flash/map
# install = /mnt/flash/boot.b
append = "quiet"
password=justinlinux
restricted
image = /mnt/flash/bzImage
label = linux
root = /mnt/flash/dev/hdc1
vga = 0x317
read-only

The flash card boots up on my other machine on secondary master hence /dev/hdc1.
 
Old 03-26-2004, 09:56 AM   #7
ridesideways
LQ Newbie
 
Registered: Mar 2004
Location: NH
Distribution: Debian 3.0
Posts: 13

Original Poster
Rep: Reputation: 0
i will give your options a try-- you have a couple of options there that i haven't been using in my lilo.conf. but it doesn't seem all that different from what i've been doing.

out of curiosity, since that is working for you, what do you get when the flash is in the USB writer and you type
sfdisk -g /dev/sda

and then, what do you get when the flash is in the IDE secondary bus and you type:
sfdisk -g /dev/hdc

do they match for you? for me, they don't match.

also, how is your IDE geometry bios configured when the flash is in the IDE secondary bus?

thanks alot!

-eric
 
Old 03-26-2004, 10:20 AM   #8
ridesideways
LQ Newbie
 
Registered: Mar 2004
Location: NH
Distribution: Debian 3.0
Posts: 13

Original Poster
Rep: Reputation: 0
fixed!

wow a big thanks to user Frustin...

i almost sh!t a brick when it booted. the lilo.conf option "bios=0x80" is what did it. after screwing with all the different geometry parameters to lilo for like 8 hours straight, i never thought about the fact that it might be saving the wrong bios driver number as a part of the lilo data.

hey this board rocks!
 
Old 03-26-2004, 07:20 PM   #9
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Like I said - I am not very aware of the inner workings of booting with Lilo. Sorry I wasn't much of help but I'm glad you got it fixed!


Håkan
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ADVANCED QUESTION !! Try This extremebfn Linux - Networking 1 01-22-2005 06:57 AM
advanced fluxbox question CatBreath Linux - Software 2 09-22-2004 02:03 AM
LILO question (I hope this is a little advanced) netstv Programming 1 05-25-2004 06:39 AM
Advanced Lilo dual boot help Ruzhyo Linux - General 4 05-15-2004 12:37 AM
LILO (Advanced).. concoran Linux - General 2 08-14-2002 01:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration