Bug 39743 - needRedHatCD variable in loader.c wrongly used for ks.cfg on cdrom
Summary: needRedHatCD variable in loader.c wrongly used for ks.cfg on cdrom
Keywords:
Status: CLOSED DUPLICATE of bug 22285
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: anaconda
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Brent Fox
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-05-08 23:41 UTC by Fred Feirtag
Modified: 2007-04-18 16:33 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-05-10 20:24:32 UTC
Embargoed:


Attachments (Terms of Use)

Description Fred Feirtag 2001-05-08 23:41:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.3-diskless i686)

Description of problem:
When setupCdrom is called with needRedHatCD set to zero,
the cd should not be unmounted before returning.
This is needed where the distribution is on NFS, but
the ks.cfg file is local (like on floppy). Here is patch:
--- loader.c    Tue May  1 16:17:57 2001
+++ loader.c.fixed      Tue May  1 16:32:08 2001
@@ -1004,8 +1004,8 @@
            devMakeInode(kd->known[i].name, "/tmp/cdrom");
            if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", 1, 0,
NULL,
                          NULL)) {
-               if (!needRedHatCD ||
-                   !access("/mnt/source/RedHat/base/stage2.img", R_OK)) {
+               if (!needRedHatCD) return (char*)1;
+               if (!access("/mnt/source/RedHat/base/stage2.img", R_OK)) {
                    if
(!mountLoopback("/mnt/source/RedHat/base/stage2.img",
                                       "/mnt/runtime", "loop0")) {
                        buf = malloc(200);


How reproducible:
Always

Steps to Reproduce:
1.create bootable cdrom from kickstart floppy
2.use "append ks=cdrom:/ks.cfg initrd=initrd.img network devfs=nomount" in
syslinux.cfg
3.include ks.cfg in cdrom top level directory
4.kickstart install won't find ks.cfg, because the cdrom was prematurely
unmounted
	

Actual Results:  no ks.cfg file found

Expected Results:  that the local ks.cfg file be used

Additional info:

vmlinuz kernel on cdrom also needed IDE-CDROM compiled in

Comment 1 Brent Fox 2001-05-10 20:24:28 UTC

*** This bug has been marked as a duplicate of 22285 ***

Comment 2 Forrest 2001-06-08 18:35:50 UTC
How do I implement this patch on my system?

Comment 3 Brent Fox 2001-06-11 20:12:38 UTC
Well, the easiest way to get kickstart files on the cdrom to work is to put the
kickstart file inside the initrd.img before you burn the cd.  
Applying the patch would be a pretty lengthy procedure.  You'd have to apply the
patch to the loader in anaconda, and recompile it.  Then you'd have to strip the
debug info out of the loader binary.  Then you need to replace the loader in the
initrd.img with the new loader that you compiled.  Then, you would need to burn
a cd with the ISO that contains the modified initrd.

Comment 4 Forrest 2001-06-12 19:18:35 UTC
So how do I put the kickstart file inside the initrd.img?

I have already applied the patch and recomiled anaconda.  How do I get the 
debug info out of the loader binary and replace the loader in initrd.img with 
the new one?


Comment 5 Fred Feirtag 2001-06-12 19:37:37 UTC
> ...How do I get the
> debug info out of the loader binary

After patching loader.c (found within the anaconda source rpm, as I recall),
"make loader" (some libraries may need to be compiled, too), then
"strip loader."  Then copy it into the image.  The script I wrote (below)
is very helpful for manipulating boot images.

I gather the alternative is to copy your ks.cfg into the initrd image
(also use script for that) and having the syslinux.cfg file contain:
append ks=file:/ks.cfg initrd=initrd.img network devfs=nomount
where file:/ is the top level directory of the initrd image--haven't
tried that, though it would seem simpler.

cat rhimgedit
#!/bin/csh -f
# This work is released by Integrity Linux, a division
# of Integrity Networking Systems, Albuquerque, New Mexico
# under the terms of the GNU GPL, version 2.

if ( ! -o / ) then
  echo Error must be root to run
  exit 1
endif

if ($#argv == 0) then
  echo Usage:  $0 RedHat-floppy.img
  exit 1
endif
 
onintr cleanup
 
cp $1 /tmp/$$.img
 
rm -rf /tmp/$$-mount >& /dev/null
mkdir /tmp/$$-mount
 
mount -t msdos -o loop /tmp/$$.img /tmp/$$-mount
 
if ($status) then
  echo Error: Failed to mount image as msdos loopback
  goto cleanup
endif
 
(cd /tmp/$$-mount ; xterm) &
 
cp /tmp/$$-mount/initrd.img /tmp/$$-initrd.img.gz
gunzip /tmp/$$-initrd.img.gz
 
rm -rf /tmp/$$-imount >& /dev/null
mkdir /tmp/$$-imount
 
mount -t ext2 -o loop /tmp/$$-initrd.img /tmp/$$-imount
 
if ($status) then
  echo Error: Failed to mount initrd image as ext2 loopback
  goto cleanup
endif
 
(cd /tmp/$$-imount ; xterm) &
 
mkdir /tmp/$$-modules
set sourcemods = /tmp/$$-imount/modules/modules.cgz
(cd /tmp/$$-modules ; gunzip -c $sourcemods | cpio -i --make-directories ;
xterm)
 
wait
wait
 
(cd /tmp/$$-modules ; /bin/ls -1 */*.o | cpio --quiet -Hcrc -o | gzip -9 >
$sourcemods)
 
umount /tmp/$$-imount
 
gzip -best /tmp/$$-initrd.img
cp /tmp/$$-initrd.img.gz /tmp/$$-mount/initrd.img
umount /tmp/$$-mount
 
echo
/bin/echo -n 'save changes? y/[n]  '
set save = $<
if ("$save" == 'y' || "$save" == 'Y') then
  cp /tmp/$$.img $1
endif
 
################
cleanup:
 
rm /tmp/$$.img
rm -rf /tmp/$$-mount     >& /dev/null
rm -rf /tmp/$$-imount    >& /dev/null
rm -rf /tmp/$$-modules   >& /dev/null
rm /tmp/$$-initrd.img.gz >& /dev/null
rm /tmp/$$-mount.img     >& /dev/null



Note You need to log in before you can comment on or make changes to this bug.