From owner-svn-src-all@FreeBSD.ORG Wed May 4 03:03:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93032106566B; Wed, 4 May 2011 03:03:51 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 05B778FC15; Wed, 4 May 2011 03:03:51 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 6D5FF58140; Tue, 3 May 2011 22:03:50 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id 1LmXl476ytZq; Tue, 3 May 2011 22:03:50 -0500 (CDT) Received: from wanderer.tachypleus.net (unknown [76.210.65.155]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 65EC75813A; Tue, 3 May 2011 22:03:49 -0500 (CDT) Message-ID: <4DC0C214.3090004@freebsd.org> Date: Tue, 03 May 2011 22:03:48 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110317 Thunderbird/3.1.9 MIME-Version: 1.0 To: Baptiste Daroussin References: <201105031512.p43FC1Jr099140@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221387 - head/usr.sbin/makefs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2011 03:03:51 -0000 On 05/03/11 10:27, Baptiste Daroussin wrote: > 2011/5/3 Nathan Whitehorn: >> Author: nwhitehorn >> Date: Tue May 3 15:12:01 2011 >> New Revision: 221387 >> URL: http://svn.freebsd.org/changeset/base/221387 >> >> Log: >> Add support for synthesizing an APM partition map to map Mac PowerPC >> bootstrap partitions from the ISO9660 boot catalog. This preserves OS X's >> ability to mount the CD, while allowing us a way to provide HFS-ified >> bootstrap code for Open Firmware. >> >> 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 Tue May 3 14:43:16 2011 (r221386) >> +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Tue May 3 15:12:01 2011 (r221387) >> @@ -31,6 +31,9 @@ >> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY >> * OF SUCH DAMAGE. >> */ >> + >> +#include >> + >> #include "cd9660.h" >> #include "cd9660_eltorito.h" >> >> @@ -497,11 +500,43 @@ cd9660_setup_boot_volume_descriptor(volu >> return 1; >> } >> >> +static int >> +cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitions, >> + off_t sector_start, off_t nsectors, off_t sector_size, >> + const char *part_name, const char *part_type) { >> + uint32_t apm32; >> + uint16_t apm16; >> + >> + fseeko(fd, (off_t)(index + 1) * sector_size, SEEK_SET); >> + >> + /* Signature */ >> + apm16 = htons(0x504d); >> + fwrite(&apm16, sizeof(apm16), 1, fd); >> + apm16 = 0; >> + fwrite(&apm16, sizeof(apm16), 1, fd); >> + >> + /* Total number of partitions */ >> + apm32 = htonl(total_partitions); >> + fwrite(&apm32, sizeof(apm32), 1, fd); >> + /* Bounds */ >> + apm32 = htonl(sector_start); >> + fwrite(&apm32, sizeof(apm32), 1, fd); >> + apm32 = htonl(nsectors); >> + fwrite(&apm32, sizeof(apm32), 1, fd); >> + >> + fwrite(part_name, strlen(part_name) + 1, 1, fd); >> + fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR); >> + fwrite(part_type, strlen(part_type) + 1, 1, fd); >> + >> + return 0; >> +} >> + >> int >> cd9660_write_boot(FILE *fd) >> { >> struct boot_catalog_entry *e; >> struct cd9660_boot_image *t; >> + int apm_partitions = 0; >> >> /* write boot catalog */ >> if (fseeko(fd, (off_t)diskStructure.boot_catalog_sector * >> @@ -533,7 +568,51 @@ cd9660_write_boot(FILE *fd) >> t->filename, t->sector); >> } >> cd9660_copy_file(fd, t->sector, t->filename); >> + >> + if (t->system == ET_SYS_MAC) >> + apm_partitions++; >> + } >> + >> + if (apm_partitions> 0) { >> + /* Write DDR and global APM info */ >> + uint32_t apm32; >> + uint16_t apm16; >> + int total_parts; >> + >> + fseek(fd, 0, SEEK_SET); >> + apm16 = htons(0x4552); >> + fwrite(&apm16, sizeof(apm16), 1, fd); >> + apm16 = htons(diskStructure.sectorSize); >> + fwrite(&apm16, sizeof(apm16), 1, fd); >> + apm32 = htonl(diskStructure.totalSectors); >> + fwrite(&apm32, sizeof(apm32), 1, fd); >> + >> + /* Count total needed entries */ >> + total_parts = 2 + apm_partitions; /* Self + ISO9660 */ >> + >> + /* Write self-descriptor */ >> + cd9660_write_apm_partition_entry(fd, 0, >> + total_parts, 1, total_parts, diskStructure.sectorSize, >> + "Apple", "Apple_partition_map"); >> + >> + /* Write ISO9660 descriptor, enclosing the whole disk */ >> + cd9660_write_apm_partition_entry(fd, 1, >> + total_parts, 0, diskStructure.totalSectors, >> + diskStructure.sectorSize, "", "CD_ROM_Mode_1"); >> + >> + /* Write all partition entries */ >> + apm_partitions = 0; >> + TAILQ_FOREACH(t,&diskStructure.boot_images, image_list) { >> + if (t->system != ET_SYS_MAC) >> + continue; >> + >> + cd9660_write_apm_partition_entry(fd, >> + 2 + apm_partitions++, total_parts, >> + t->sector, t->num_sectors, diskStructure.sectorSize, >> + "CD Boot", "Apple_Bootstrap"); >> + } >> } >> >> return 0; >> } >> + >> _______________________________________________ >> svn-src-all@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/svn-src-all >> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" >> > > Nice, > > Do not forget to send this to the netbsd folks so that both makefs > keep as in sync as possible, christos@NetBSD.org should be interested > by this. > > if you already did this, sorry for the noise. > > regards, > Bapt Will do. I have some more testing to do with this, and possibly some more changes, which I was planning on sending upstream as a batch when finished. -Nathan