From owner-svn-src-all@FreeBSD.ORG Tue May 3 15:27:56 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 2EF221065670; Tue, 3 May 2011 15:27:56 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3324D8FC0C; Tue, 3 May 2011 15:27:54 +0000 (UTC) Received: by fxm11 with SMTP id 11so234761fxm.13 for ; Tue, 03 May 2011 08:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=K0vwWbqTzyaKuquUXhWtPrTbJLo5fgh3pILOke5J6m4=; b=NSqAfQYJ/xVzmvbJMl40+j8/EL2Ccej/JpgDZR+6+m/X5kt4T3H60WnSUljm/fpcN6 oiU2/hPEyRF3HKvowaJpPopG7iswryGYVzqParqzvjbrjBKm/n0hWJbiUiUDM+FwsPXb bUlSAiXGbHcJdgKHkCe/ryw492PAV0K8mSgQI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=K4eDce90QU8RSatUu16ZzM9uwWxu8VesLg2sNQhYvnIRH3oS/iv92sjJJcUUxmycHr NlioZUibeny+vMI+lCnojnPQxPIN+buRxI9tCR1mXptU9pGPzEPuYtJk5bSq6Pp8X4P8 3WfZPdYrhcOttlenCTLR1NduN1i7WqV+K9BNc= Received: by 10.223.87.218 with SMTP id x26mr1596429fal.133.1304436472967; Tue, 03 May 2011 08:27:52 -0700 (PDT) MIME-Version: 1.0 Sender: baptiste.daroussin@gmail.com Received: by 10.223.123.137 with HTTP; Tue, 3 May 2011 08:27:32 -0700 (PDT) In-Reply-To: <201105031512.p43FC1Jr099140@svn.freebsd.org> References: <201105031512.p43FC1Jr099140@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 3 May 2011 17:27:32 +0200 X-Google-Sender-Auth: BS1l8_j-3_D5OXOowdOFC6Yzv4U Message-ID: To: Nathan Whitehorn Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: Tue, 03 May 2011 15:27:56 -0000 2011/5/3 Nathan Whitehorn : > Author: nwhitehorn > Date: Tue May =A03 15:12:01 2011 > New Revision: 221387 > URL: http://svn.freebsd.org/changeset/base/221387 > > Log: > =A0Add support for synthesizing an APM partition map to map Mac PowerPC > =A0bootstrap partitions from the ISO9660 boot catalog. This preserves OS = X's > =A0ability to mount the CD, while allowing us a way to provide HFS-ified > =A0bootstrap code for Open Firmware. > > Modified: > =A0head/usr.sbin/makefs/cd9660/cd9660_eltorito.c > > Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/makefs/cd9660/cd9660_eltorito.c =A0 =A0 =A0 Tue May =A0= 3 14:43:16 2011 =A0 =A0 =A0 =A0(r221386) > +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c =A0 =A0 =A0 Tue May =A0= 3 15:12:01 2011 =A0 =A0 =A0 =A0(r221387) > @@ -31,6 +31,9 @@ > =A0* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY > =A0* OF SUCH DAMAGE. > =A0*/ > + > +#include > + > =A0#include "cd9660.h" > =A0#include "cd9660_eltorito.h" > > @@ -497,11 +500,43 @@ cd9660_setup_boot_volume_descriptor(volu > =A0 =A0 =A0 =A0return 1; > =A0} > > +static int > +cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitio= ns, > + =A0 =A0off_t sector_start, off_t nsectors, off_t sector_size, > + =A0 =A0const char *part_name, const char *part_type) { > + =A0 =A0 =A0 uint32_t apm32; > + =A0 =A0 =A0 uint16_t apm16; > + > + =A0 =A0 =A0 fseeko(fd, (off_t)(index + 1) * sector_size, SEEK_SET); > + > + =A0 =A0 =A0 /* Signature */ > + =A0 =A0 =A0 apm16 =3D htons(0x504d); > + =A0 =A0 =A0 fwrite(&apm16, sizeof(apm16), 1, fd); > + =A0 =A0 =A0 apm16 =3D 0; > + =A0 =A0 =A0 fwrite(&apm16, sizeof(apm16), 1, fd); > + > + =A0 =A0 =A0 /* Total number of partitions */ > + =A0 =A0 =A0 apm32 =3D htonl(total_partitions); > + =A0 =A0 =A0 fwrite(&apm32, sizeof(apm32), 1, fd); > + =A0 =A0 =A0 /* Bounds */ > + =A0 =A0 =A0 apm32 =3D htonl(sector_start); > + =A0 =A0 =A0 fwrite(&apm32, sizeof(apm32), 1, fd); > + =A0 =A0 =A0 apm32 =3D htonl(nsectors); > + =A0 =A0 =A0 fwrite(&apm32, sizeof(apm32), 1, fd); > + > + =A0 =A0 =A0 fwrite(part_name, strlen(part_name) + 1, 1, fd); > + =A0 =A0 =A0 fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR); > + =A0 =A0 =A0 fwrite(part_type, strlen(part_type) + 1, 1, fd); > + > + =A0 =A0 =A0 return 0; > +} > + > =A0int > =A0cd9660_write_boot(FILE *fd) > =A0{ > =A0 =A0 =A0 =A0struct boot_catalog_entry *e; > =A0 =A0 =A0 =A0struct cd9660_boot_image *t; > + =A0 =A0 =A0 int apm_partitions =3D 0; > > =A0 =A0 =A0 =A0/* write boot catalog */ > =A0 =A0 =A0 =A0if (fseeko(fd, (off_t)diskStructure.boot_catalog_sector * > @@ -533,7 +568,51 @@ cd9660_write_boot(FILE *fd) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0t->filename, t->se= ctor); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cd9660_copy_file(fd, t->sector, t->filenam= e); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (t->system =3D=3D ET_SYS_MAC) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 apm_partitions++; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 if (apm_partitions > 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Write DDR and global APM info */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 uint32_t apm32; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 uint16_t apm16; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int total_parts; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fseek(fd, 0, SEEK_SET); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 apm16 =3D htons(0x4552); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fwrite(&apm16, sizeof(apm16), 1, fd); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 apm16 =3D htons(diskStructure.sectorSize); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fwrite(&apm16, sizeof(apm16), 1, fd); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 apm32 =3D htonl(diskStructure.totalSectors)= ; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fwrite(&apm32, sizeof(apm32), 1, fd); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Count total needed entries */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 total_parts =3D 2 + apm_partitions; /* Self= + ISO9660 */ > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Write self-descriptor */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cd9660_write_apm_partition_entry(fd, 0, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 total_parts, 1, total_parts, diskSt= ructure.sectorSize, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Apple", "Apple_partition_map"); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Write ISO9660 descriptor, enclosing the = whole disk */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cd9660_write_apm_partition_entry(fd, 1, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 total_parts, 0, diskStructure.total= Sectors, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 diskStructure.sectorSize, "", "CD_R= OM_Mode_1"); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Write all partition entries */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 apm_partitions =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 TAILQ_FOREACH(t, &diskStructure.boot_images= , image_list) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (t->system !=3D ET_SYS_M= AC) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cd9660_write_apm_partition_= entry(fd, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 2 + apm_partitions+= +, total_parts, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 t->sector, t->num_s= ectors, diskStructure.sectorSize, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "CD Boot", "Apple_B= ootstrap"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0return 0; > =A0} > + > _______________________________________________ > 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