๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.hardware
Article #264

Kernel patch for loading "rescue" disk with LS-120 drive, making bootdisk, setting up LILO

#264
From: Sandeep Kumar
Date: Tue, 03 Aug 1999 00:00
143 lines
5070 bytes
I was trying to make bootdisk for my redhat linux with LS-120 superdisk
drive. After searching web a lot, I got some partial answers (from
aus.computers.linux) that allowed me to make a bootdisk, but it could
not boot "rescue".

Finally after some research in the kernel code, I got it working,
including "rescue" disk loading, I had to patch kernel for this. As
many of you may be facing the same problem, I thought it may be a good
idea to post the solution I found (My first post ever on the web).

Actually there are two problems here, lilo does not work and if we get
lilo working as explained later, kernel does not loads "rescue". Here
is how I solved them:

My linux partition is /dev/hda2, superdisk drive is /dev/hdc and I am
running kernel 2.2.10 (yours may be different, so substitute
accordingly) on RedHat 6.0 and I have no regular floppy drive.

1. Patching the kernel
----------------------
The kernel thinks only place it can load a ramdisk from is a floppy
i.e. /dev/fd0, and if your root is a "hard disk" such as /dev/hdc (your
superdisk drive), it does not try to load ramdisk from it rather mounts
it as root and fails while opening init๏ฟฝ

So, we need to patch the kernel (I am assuming you know how to compile
a tailored kernel).

In kernel configuration, choose N for regular floppy support
(CONFIG_BLK_DEV_FD), and Y for IDE floppy support
(CONFIG_BLK_DEV_IDEFLOPPY).

Apply following patches to kernel code (kernel 2.2.10, for others you
should manually edit the code), please check

File drivers/block/rd.c
-------------------Cut here---------------------
595c595,596
< 	if (MAJOR(ROOT_DEV) != FLOPPY_MAJOR
---
> #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_IDEFLOPPY)
> 	if (MAJOR(ROOT_DEV) != FLOPPY_MAJOR && MAJOR(ROOT_DEV) !=
IDE1_MAJOR
597c598
< 		&& MAJOR(real_root_dev) != FLOPPY_MAJOR
---
> 		&& MAJOR(real_root_dev) != FLOPPY_MAJOR && MAJOR
(real_root_dev) != IDE1_MAJOR
599a601
> #endif
-------------------Cut here---------------------
Save this in drivers/block/rd.c.patch

  cd drivers/block/
  patch -b rd.c <rd.c.patch

Your original rd.c will be saved as rd.c.orig

File fs/super.c
-------------------Cut here---------------------
1161,1162c1161,1162
< #ifdef CONFIG_BLK_DEV_FD
< 	if (MAJOR(ROOT_DEV) == FLOPPY_MAJOR) {
---
> #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_IDEFLOPPY)
> 	if (MAJOR(ROOT_DEV) == FLOPPY_MAJOR || MAJOR(ROOT_DEV) ==
IDE1_MAJOR) {
1165a1166,1167
>
> #ifdef	CONFIG_BLK_DEV_FD
1166a1169,1170
> #endif
>
-------------------Cut here---------------------
Save this in fs/super.c.patch

  cd fs/
  patch -b super.c <super.c.patch

Your original super.c will be saved as super.c.orig

Make the kernel (make bzImage), modules, install, modules_install as
required.

2. Setting up LILO
------------------
Put a blank 1.44M floppy in drive and run mkbootdisk as

  mkbootdisk --verbose --device /dev/hdc 2.2.10

you may see error message like

  /tmp/๏ฟฝ no such file or directory

This comes from lilo as it fails.

Mount /dev/hdc on directory /mnt/floppy/

Create tmp directory as

  mkdir /mnt/floppy/tmp

Edit /mnt/floppy/etc/lilo.conf

Add to global section

  disk=/dev/hdc
    bios=0x00

This tells the lilo to use 0x00 for hdc when talking to BIOS while
booting, as your superdisk drive is a floppy drive at boottime

Change root in "rescue" section

    root=/dev/hdc

Adding these to global section may also be a good idea (not part of the
solution)

  verbose=1
  compact

Run lilo as

  lilo -r /mnt/floppy/

Unmount /dev/hdc

And you should be all set.

In case you don't want to patch and compile the kernel, you may skip
part 1, you will still get a bootdisk that boots "linux" loading kernel
from floppy and mounting your linux partiion as root, but it you try to
boot "rescue", it will not prompt you for rescue disk and fail.

Let me know how it works for you ...

--
Sandeep Kumar


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID: <7o7hgs$1db$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: fcd6c,da031c14193d0c1,start
X-Google-Attributes: gidfcd6c,public
X-Google-Thread: 102b32,da031c14193d0c1,start
X-Google-Attributes: gid102b32,public
X-Google-Thread: 102983,da031c14193d0c1,start
X-Google-Attributes: gid102983,public
From: Sandeep Kumar <sandeepk99@my-deja.com>
Subject: Kernel patch for loading "rescue" disk with LS-120 drive, making bootdisk, setting up LILO
Date: 1999/08/03
Message-ID: <7o7hgs$1db$1@nnrp1.deja.com>
X-Deja-AN: 508470795
X-Http-Proxy: NetCache@netcache32.mot.com: Version 3.4D3, 1.0 x39.deja.com:80 (Squid/1.1.22) for client 172.30.20.125, 136.182.2.222
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Tue Aug 03 19:56:19 1999 GMT
X-MyDeja-Info: XMYDJUIDsandeepk99
Newsgroups: comp.os.linux.hardware,aus.computers.linux,linux.redhat.install
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)