From owner-freebsd-bugs Mon Sep 30 15:30: 6 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 00CF837B401 for ; Mon, 30 Sep 2002 15:30:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 390F443E6E for ; Mon, 30 Sep 2002 15:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8UMU2Co029747 for ; Mon, 30 Sep 2002 15:30:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8UMU2qD029746; Mon, 30 Sep 2002 15:30:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1041237B401 for ; Mon, 30 Sep 2002 15:21:24 -0700 (PDT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id B503E43E65 for ; Mon, 30 Sep 2002 15:21:23 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g8UMLN7R088707 for ; Mon, 30 Sep 2002 15:21:23 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.6/8.12.6/Submit) id g8UMLNio088706; Mon, 30 Sep 2002 15:21:23 -0700 (PDT) Message-Id: <200209302221.g8UMLNio088706@www.freebsd.org> Date: Mon, 30 Sep 2002 15:21:23 -0700 (PDT) From: Tim Kientzle To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/43543: cdboot does not handle 'relaxed' ISO9660 discs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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