From owner-svn-src-head@freebsd.org Wed Sep 13 17:00:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01BEAE05C41; Wed, 13 Sep 2017 17:00:04 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D16906E37B; Wed, 13 Sep 2017 17:00:03 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8DH03a0019492; Wed, 13 Sep 2017 17:00:03 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8DH02ga019489; Wed, 13 Sep 2017 17:00:02 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201709131700.v8DH02ga019489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Wed, 13 Sep 2017 17:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323554 - head/sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: head/sys/boot/efi/boot1 X-SVN-Commit-Revision: 323554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Wed, 13 Sep 2017 17:00:04 -0000 Author: allanjude Date: Wed Sep 13 17:00:02 2017 New Revision: 323554 URL: https://svnweb.freebsd.org/changeset/base/323554 Log: Increase EFI boot file size frok 128k to 384k generate_fat.sh does the following: - create an 800kb zero-filled file - create an md device backed by this file - format the device fat12 - mount the filesystem - create the EFI ESP directory structure - create the EFI boot file (BOOTx64 for amd64, BOOTaa64 for aarch64, etc) - Adds a marker to the beginning of the file, and pad it to 384kb - 384kb was chosen as it is less than half of 800kb, thus allowing users to keep a backup of their older boot file in the small partition - Unmount the filesystem - Scan the image and find the offset where the marker was inserted - The process requires root, to make image generation easier, images for each architecture are pregenerated, compressed with xz, and checked into svn. The Makefile that generates boot1.efifat does the following: - Ensure the compiled boot1.efi file is no larger than the generated image - Decompress the template created by generate-fat.sh - dd the contents of boot1.efi into boot1.efifat starting at the offset where the marker is found. This allows any file less than the maximum size to be written into the fat filesystem without having to mount it, so no root privileges are required. Later work by imp and myself makes bsdinstall create a 200mb fat16 instead of using this process, but it is retained to make image generation easier. Submitted by: Eric McCorkle (original version) Reviewed by: emaste, tsoome, Eric McCorkle MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9680 Added: head/sys/boot/efi/boot1/fat-amd64.tmpl.xz (contents, props changed) head/sys/boot/efi/boot1/fat-arm.tmpl.xz (contents, props changed) head/sys/boot/efi/boot1/fat-arm64.tmpl.xz (contents, props changed) head/sys/boot/efi/boot1/fat-i386.tmpl.xz (contents, props changed) Deleted: head/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu head/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu head/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu head/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu Modified: head/sys/boot/efi/boot1/Makefile head/sys/boot/efi/boot1/Makefile.fat head/sys/boot/efi/boot1/generate-fat.sh Modified: head/sys/boot/efi/boot1/Makefile ============================================================================== --- head/sys/boot/efi/boot1/Makefile Wed Sep 13 16:54:27 2017 (r323553) +++ head/sys/boot/efi/boot1/Makefile Wed Sep 13 17:00:02 2017 (r323554) @@ -135,9 +135,7 @@ boot1.efifat: boot1.efi exit 1; \ fi echo ${.OBJDIR} - uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu - mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2 - bzip2 -f -d ${.TARGET}.bz2 + xz -d -c ${.CURDIR}/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc CLEANFILES= boot1.efi boot1.efifat Modified: head/sys/boot/efi/boot1/Makefile.fat ============================================================================== --- head/sys/boot/efi/boot1/Makefile.fat Wed Sep 13 16:54:27 2017 (r323553) +++ head/sys/boot/efi/boot1/Makefile.fat Wed Sep 13 17:00:02 2017 (r323554) @@ -1,4 +1,4 @@ # This file autogenerated by generate-fat.sh - DO NOT EDIT # $FreeBSD$ BOOT1_OFFSET=0x2d -BOOT1_MAXSIZE=131072 +BOOT1_MAXSIZE=393216 Added: head/sys/boot/efi/boot1/fat-amd64.tmpl.xz ============================================================================== Binary file. No diff available. Added: head/sys/boot/efi/boot1/fat-arm.tmpl.xz ============================================================================== Binary file. No diff available. Added: head/sys/boot/efi/boot1/fat-arm64.tmpl.xz ============================================================================== Binary file. No diff available. Added: head/sys/boot/efi/boot1/fat-i386.tmpl.xz ============================================================================== Binary file. No diff available. Modified: head/sys/boot/efi/boot1/generate-fat.sh ============================================================================== --- head/sys/boot/efi/boot1/generate-fat.sh Wed Sep 13 16:54:27 2017 (r323553) +++ head/sys/boot/efi/boot1/generate-fat.sh Wed Sep 13 17:00:02 2017 (r323554) @@ -14,7 +14,7 @@ FAT_SIZE=1600 #Size in 512-byte blocks of the produced image BOOT1_OFFSET=2d -BOOT1_SIZE=128k +BOOT1_SIZE=384k if [ $(id -u) != 0 ]; then echo "${0##*/}: must run as root" >&2 @@ -70,13 +70,7 @@ while read ARCH FILENAME; do exit 1 fi - bzip2 $OUTPUT_FILE - echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu - echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu - echo "\$FreeBSD\$" >> $OUTPUT_FILE.bz2.uu - - uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu - rm $OUTPUT_FILE.bz2 + xz -f $OUTPUT_FILE done <