From owner-svn-src-head@FreeBSD.ORG Thu May 5 00:52:19 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7A8E106566C; Thu, 5 May 2011 00:52:19 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C48578FC08; Thu, 5 May 2011 00:52:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p450qJKe074410; Thu, 5 May 2011 00:52:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p450qJhO074408; Thu, 5 May 2011 00:52:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105050052.p450qJhO074408@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 5 May 2011 00:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221470 - head/usr.sbin/makefs/cd9660 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2011 00:52:19 -0000 Author: nwhitehorn Date: Thu May 5 00:52:19 2011 New Revision: 221470 URL: http://svn.freebsd.org/changeset/base/221470 Log: Fix boot on old machines (e.g. blue and white G3s) by synthesizing a 512-byte sector map instead unused space in the first 2048-byte sector. Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Thu May 5 00:43:55 2011 (r221469) +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Thu May 5 00:52:19 2011 (r221470) @@ -528,6 +528,25 @@ cd9660_write_apm_partition_entry(FILE *f fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR); fwrite(part_type, strlen(part_type) + 1, 1, fd); + if (sector_size > 512) { + /* + * Some old broken software looks at 512-byte boundaries for + * partition table entries instead of sector boundaries. We + * can fit 3 entries into the first 2048-byte block, so use + * that to humor old code. + */ + + int n_512_parts = (sector_size / 512) - 1; + if (n_512_parts > total_partitions) + n_512_parts = total_partitions; + + if (index < n_512_parts) + cd9660_write_apm_partition_entry(fd, index, n_512_parts, + sector_start * (sector_size / 512), + nsectors * (sector_size / 512), 512, part_name, + part_type); + } + return 0; }