Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2002 15:21:23 -0700 (PDT)
From:      Tim Kientzle <kientzle@acm.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/43543: cdboot does not handle 'relaxed' ISO9660 discs
Message-ID:  <200209302221.g8UMLNio088706@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         43543
>Category:       misc
>Synopsis:       cdboot does not handle 'relaxed' ISO9660 discs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 30 15:30:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tim Kientzle
>Release:        FreeBSD 4.6 (same problem found in 5.0-current)
>Organization:
>Environment:
N/A
>Description:
The 'cdboot' program, which supports non-emulation
booting of CD-ROM media, loads the /boot/loader
program from the CD-ROM.  It looks for the
file as /BOOT/LOADER, since 'normal' Rockridge
discs have all filenames forced to uppercase
in the catalog file.  mkisofs now supports
'relaxed' ISO filenaming, which allows the
catalog to contain mixed-case filenames.
Since cdboot does _not_ look for '/boot/loader',
it does not work on such discs.
>How-To-Repeat:
Create a directory 'image' with the following files:

image/boot/cdboot
image/boot/loader

use the following command to build an ISO9660 image:

mkisofs -U -R -b boot/cdboot -no-emul-boot -c boot.catalog -o image.iso image

Try to boot the resulting CD.  Note that
it fails because 'cdboot' tries to load
/BOOT/LOADER and does not try /boot/loader.

>Fix:
Alter 'cdboot' to try both filenames.
The following patch accomplishes this.
It alters the 'lookup' subroutine to
return an error code (rather than
abort immediately) if the file is not
found.  The top-level code is altered
to invoke the subroutine twice, once
with '/BOOT/LOADER' and once with
'/boot/loader'.  The patch also
adds a final 'boot failed' message
if the boot is unsuccessful.


ugly# diff -c cdboot.s-original cdboot.s
*** cdboot.s-original   Tue Nov  6 17:20:33 2001
--- cdboot.s    Fri Sep 27 11:39:54 2002
***************
*** 143,148 ****
--- 143,158 ----
  #
                mov $loader_path,%si            # File to lookup
                call lookup                     # Try to find it
+               cmp  $0,%bx
+               jne  lookup_found               # Found it, continue
+               mov $loader_alt,%si             # No, try another name
+               call lookup
+               cmp $0,%bx
+               jne  lookup_found               # Found it, continue
+               mov $msg_failed,%si
+               jmp  error                      # Nothing worked; halt.
+ lookup_found:
+
  #
  # Load the binary into the buffer.  Due to real mode addressing limitations
  # we have to read it in in 64k chunks.
***************
*** 266,272 ****
  # Lookup the file in the path at [SI] from the root directory.
  #
  # Trashes: All but BX
! # Returns: BX = pointer to record
  #
  lookup:               mov $VD_ROOTDIR+MEM_VOLDESC,%bx # Root directory record
                push %si
--- 276,282 ----
  # Lookup the file in the path at [SI] from the root directory.
  #
  # Trashes: All but BX
! # Returns: BX = pointer to record, or 0 if not found
  #
  lookup:               mov $VD_ROOTDIR+MEM_VOLDESC,%bx # Root directory record
                push %si
***************
*** 287,293 ****
                call find_file                  # Lookup first path item
                jnc lookup_dir                  # Try next component
                mov $msg_lookupfail,%si         # Not found.
!               jmp error
  lookup_done:  mov $msg_lookupok,%si           # Success message
                call putstr
                ret
--- 297,305 ----
                call find_file                  # Lookup first path item
                jnc lookup_dir                  # Try next component
                mov $msg_lookupfail,%si         # Not found.
!               call putstr
!               mov $0,%bx                      # Not found.
!               ret
  lookup_done:  mov $msg_lookupok,%si           # Success message
                call putstr
                ret
***************
*** 548,553 ****
--- 560,567 ----
  msg_lookupok: .asciz  "Found\r\n"
  msg_lookupfail:       .asciz  "File not found\r\n"
  msg_load2big: .asciz  "File too big\r\n"
+ msg_failed:   .asciz  "Boot failed\r\n"
  loader_path:  .asciz  "/BOOT/LOADER"
+ loader_alt:   .asciz  "/boot/loader"
  twiddle_chars:        .ascii  "|/-\\" 
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209302221.g8UMLNio088706>