LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   lilo cross install (https://www.linuxquestions.org/questions/linux-hardware-18/lilo-cross-install-614995/)

santana 01-20-2008 01:48 PM

lilo cross install
 
I am attempting to cross install linux on a router board(soekris net4521) from my workstation. The media is a compact flash card. I am having difficulty getting lilo installed.

I have made a bootstrap linux install on the cf drive which is mounted from /dev/sdd on /home/me/target.

The primary issue seems to be that in target /dev there are no hd* devices. This my first cross install so I don't know if this is expected or not, and all of the guides I have seen suggest to use grub, which has some issues with my disk geometry. As a result, It was advised that I use lilo instead. I tried to install lilo two ways:

first try, "chroot"
Code:

lxion:~$sudo chroot target /bin/bash
root:/# mount -a
root:/# lilo -C /etc/lilo.conf
Fatal: stat /dev/sdd: No such file or directory

hmmm. no luck there. Even though the cf drive is mounted on /dev/sdd iny workstation file system it doesn't show up in the chroot'ed file system /dev...

second try, "external"
Code:

lxion:~$sudo lilo -C target/etc/lilo.conf
Warning: LBA32 addressing assumed
Warning: The boot sector and map file are on different disks.
Warning: no PROMPT with SERIAL; setting DELAY to 20 (2 seconds)
Fatal: Illegal 'root=' specification: /dev/hda1

I see that I did something bad with the map file, it should be going on what ever is to be /dev/hda1. I know for sure that when the router boots it's bios reports the cf disk as /dev/hda so I am hesitant to change this...

Now, I have exhausted the options that I know of, and google didn't turn up any thing too useful

this is my lilo.conf
Code:

# NOTE: boot and disk below must be set to wherever your distro
# is currently mounted (while you're installing LILO). Don't mess
# with anything else unless you really know what you're doing.
boot = /dev/sdd
disk = /dev/sdd
bios = 0x80

delay = 1
serial=0,9600n8

image = /boot/vmlinuz-2.6.22-14-generic
root = /dev/hda1
append="console=ttyS0,9600n8"
label = soekris-2.6.22-14
read-only

can you advise?

thanks
Burlen

blackhole54 01-20-2008 03:37 PM

Quote:

Originally Posted by santana (Post 3029320)
The primary issue seems to be that in target /dev there are no hd* devices. This my first cross install so I don't know if this is expected or not, ...

If your target system is using a recent 2.6 kernel then it is to be expected. This is because recent 2.6 kernel dynamically create such things at boot time with udev.

The first thing you might try is using the -r option with LILO:

Code:

lilo -r  target
I don't know if this will work. The documentation says this causes lilo to chroot into the target evironment. If it means that literally, then of course it will fail for the same reason it failed when you manually chrooted. However, if lilo does the dirty work itself, then it might work.

Quote:

Even though the cf drive is mounted on /dev/sdd iny workstation file system it doesn't show up in the chroot'ed file system /dev...
chroot does that. In the chrooted environment, it doesn't know anything about your "main" /dev directory. If my above suggestion fails, you could manually create a /dev/sdd on your target system:

Code:

mknod -m 660 target/dev/sdd [major minor]
Replace [major minor] with the major and minor device numbers you need. I suggest you just get these from

Code:

ls -l /dev/sdd
(That way neither you nor I have to figure out what those things actually mean! ;) )

After you have installed LILO, you might want to delete /dev/sdd on your target system. (Although my guess is it doesn't matter.)

David1357 01-20-2008 03:50 PM

Quote:

Originally Posted by santana (Post 3029320)
can you advise?

Are you tied to LILO? Or can you switch to GRUB? I use GRUB to boot from compact flash on several embedded systems we use here. One advantage to GRUB is that you can specify a "--root-directory" option if you use the "grub-install" script. Also, "grub-install" supports a "--recheck" option to detect the BIOS drive order.

santana 01-20-2008 03:58 PM

Quote:

Originally Posted by David1357 (Post 3029442)
Are you tied to LILO? Or can you switch to GRUB?

I started with grub, but it didn't play nice with my disk geometry (well to be true this was probably the fault of the soekris's bios not reading the drive params, c/h/s, correctly) and I was advised to try lilo...

David1357 01-20-2008 05:21 PM

Quote:

Originally Posted by santana (Post 3029320)
I am attempting to cross install linux on a router board(soekris net4521) from my workstation. The media is a compact flash card. I am having difficulty getting lilo installed.

Another trick I use is to use "dd" and "cat" to combine a bootloader and partition table. If you have a machine setup to boot from "/dev/hda1" with LILO, you can use "dd" to get just the LILO section of the MBR using
Code:

# dd if=/dev/hda of=lilo.mbr bs=1 count=446
That will read just the first 446 bytes of the MBR on "/dev/hda" and save it to "lilo.mbr". Then you get the partition table from your "/dev/sdd" device using
Code:

# dd if=/dev/sdd of=table.mbr skip=446 bs=1 count=66
That skips over the bootloader on the compact flash (probably garbage) and saves just the partition table to "table.mbr". You can glue them together using
Code:

# cat lilo.mbr table.mbr > boot.mbr
Then you install the shiny new MBR using
Code:

# dd if=boot.mbr of=/dev/sdd bs=512 count=1
I use this method to replace GRUB with NTLDR, or vice versa.

J.W. 01-21-2008 01:55 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.


All times are GMT -5. The time now is 10:58 AM.