From 1041e09089dcd722ef14f51070828c9473b33984 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 5 Jan 2016 14:48:40 +0000 Subject: [PATCH 1/7] Two fixes for excessive iterations after r292326. Advance the logical block number to the lblkno of the found block plus one, instead of incrementing the block number which was used for lookup. This change skips sparcely populated buffer ranges, similar to r292325, instead of doing useless lookups. Do not restart the bnoreuselist() from the start of the range if buffer lock cannot be obtained without sleep. Only retry lookup and lock for the same queue and same logical block number. Reported by: benno Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/vfs_default.c | 10 ++-------- sys/kern/vfs_subr.c | 8 ++++++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index fd83f87ec3c5..3da861836df5 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1080,15 +1080,9 @@ vop_stdadvise(struct vop_advise_args *ap) bsize = vp->v_bufobj.bo_bsize; startn = ap->a_start / bsize; endn = ap->a_end / bsize; - for (;;) { - error = bnoreuselist(&bo->bo_clean, bo, startn, endn); - if (error == EAGAIN) - continue; + error = bnoreuselist(&bo->bo_clean, bo, startn, endn); + if (error == 0) error = bnoreuselist(&bo->bo_dirty, bo, startn, endn); - if (error == EAGAIN) - continue; - break; - } BO_RUNLOCK(bo); VOP_UNLOCK(vp, 0); break; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ace97e86fcc8..554254189329 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1669,7 +1669,8 @@ bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn, daddr_t endn) ASSERT_BO_LOCKED(bo); - for (lblkno = startn;; lblkno++) { + for (lblkno = startn;;) { +again: bp = BUF_PCTRIE_LOOKUP_GE(&bufv->bv_root, lblkno); if (bp == NULL || bp->b_lblkno >= endn) break; @@ -1677,11 +1678,14 @@ bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn, daddr_t endn) LK_INTERLOCK, BO_LOCKPTR(bo), "brlsfl", 0, 0); if (error != 0) { BO_RLOCK(bo); - return (error != ENOLCK ? error : EAGAIN); + if (error == ENOLCK) + goto again; + return (error); } KASSERT(bp->b_bufobj == bo, ("bp %p wrong b_bufobj %p should be %p", bp, bp->b_bufobj, bo)); + lblkno = bp->b_lblkno + 1; if ((bp->b_flags & B_MANAGED) == 0) bremfree(bp); bp->b_flags |= B_RELBUF; From 7a2ff73d68079d4a7f23957712e566865d4491d6 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 5 Jan 2016 15:52:16 +0000 Subject: [PATCH 2/7] rtld: populate DT_DEBUG iff DYNAMIC segment is writable MIPS has/had a read-only DYNAMIC segment, and uses an extra level of indirection (through MIPS_RLD_MAP) to locate the debugger rendezvous data. Some linkers (e.g. LLVM's lld) may produce MIPS binaries with a writable DYNAMIC segment, which would allow us to eventually drop a special case. Therefore, instead of hardcoding knowledge that DYNAMIC is not writable on MIPS just check the permissions on the segment. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4791 --- libexec/rtld-elf/rtld.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 66edc157d393..6daef2d13405 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1144,13 +1144,13 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath, * is mapped read-only. DT_MIPS_RLD_MAP is used instead. */ -#ifndef __mips__ case DT_DEBUG: + if (!obj->writable_dynamic) + break; if (!early) dbg("Filling in DT_DEBUG entry"); ((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) &r_debug; break; -#endif case DT_FLAGS: if (dynp->d_un.d_val & DF_ORIGIN) @@ -1331,6 +1331,8 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path) break; case PT_DYNAMIC: + if (ph->p_flags & PROT_WRITE) + obj->writable_dynamic = true; obj->dynamic = (const Elf_Dyn *)(ph->p_vaddr + obj->relocbase); break; From 16ef2e1a9be003d7177ac978b039725256cd7fee Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 5 Jan 2016 15:55:45 +0000 Subject: [PATCH 3/7] rtld: populate DT_DEBUG iff DYNAMIC segment is writable rtld.h was accidentally missed in r293201 --- libexec/rtld-elf/rtld.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 72a632e912e6..f151db0d1c7b 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -264,6 +264,7 @@ typedef struct Struct_Obj_Entry { bool valid_hash_sysv : 1; /* A valid System V hash hash tag is available */ bool valid_hash_gnu : 1; /* A valid GNU hash tag is available */ bool dlopened : 1; /* dlopen()-ed (vs. load statically) */ + bool writable_dynamic : 1; /* PT_DYNAMIC is writable */ struct link_map linkmap; /* For GDB and dlinfo() */ Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ From 43d53dba8ff97ef82be216178626c3b545cce30f Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 5 Jan 2016 16:21:20 +0000 Subject: [PATCH 4/7] Add sbin and /usr/local directories to _PATH_DEFPATH. Set _PATH_DEFPATH to /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin. This is the path in the default class in the default /etc/login.conf, excluding ~/bin which would not be expanded properly in a string constant. For normal logins, _PATH_DEFPATH is overridden by /etc/login.conf, ~/.login_conf or shell startup files. _PATH_DEFPATH is still used as a default by execlp(), execvp(), posix_spawnp() and sh if PATH is not set, and by cron. Especially the latter is a common trap (most recently in PR 204813). PR: 204813 Reviewed by: secteam (delphij), alfred --- include/paths.h | 4 ++-- lib/libc/gen/exec.3 | 4 ++-- lib/libc/gen/posix_spawn.3 | 4 ++-- usr.sbin/cron/crontab/crontab.5 | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/paths.h b/include/paths.h index 89c9fc9cf04c..af18c26e2b2c 100644 --- a/include/paths.h +++ b/include/paths.h @@ -36,7 +36,7 @@ #include /* Default search path. */ -#define _PATH_DEFPATH "/usr/bin:/bin" +#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" /* All standard utilities path. */ #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" /* Locate system binaries. */ @@ -108,7 +108,7 @@ __END_DECLS #ifdef RESCUE #undef _PATH_DEFPATH -#define _PATH_DEFPATH "/rescue:/usr/bin:/bin" +#define _PATH_DEFPATH "/rescue:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" #undef _PATH_STDPATH #define _PATH_STDPATH "/rescue:/usr/bin:/bin:/usr/sbin:/sbin" #undef _PATH_SYSPATH diff --git a/lib/libc/gen/exec.3 b/lib/libc/gen/exec.3 index c9d32b41ca3c..0805c62d6463 100644 --- a/lib/libc/gen/exec.3 +++ b/lib/libc/gen/exec.3 @@ -28,7 +28,7 @@ .\" @(#)exec.3 8.3 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd December 12, 2015 +.Dd January 5, 2016 .Dt EXEC 3 .Os .Sh NAME @@ -161,7 +161,7 @@ the default path is set according to the definition in .In paths.h , which is set to -.Dq Ev /usr/bin:/bin . +.Dq Ev /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin . For .Fn execvP , the search path is specified as an argument to the function. diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3 index 2c9131b5b8c4..ebbf05a4f25c 100644 --- a/lib/libc/gen/posix_spawn.3 +++ b/lib/libc/gen/posix_spawn.3 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2011 +.Dd January 5, 2016 .Dt POSIX_SPAWN 3 .Os .Sh NAME @@ -126,7 +126,7 @@ the default path is set according to the definition in .In paths.h , which is set to -.Dq Ev /usr/bin:/bin . +.Dq Ev /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin . .Pp If .Fa file_actions diff --git a/usr.sbin/cron/crontab/crontab.5 b/usr.sbin/cron/crontab/crontab.5 index 5222d2d99334..acd6cb5381a6 100644 --- a/usr.sbin/cron/crontab/crontab.5 +++ b/usr.sbin/cron/crontab/crontab.5 @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 28, 2012 +.Dd January 5, 2016 .Dt CRONTAB 5 .Os .Sh NAME @@ -74,7 +74,7 @@ is set to .Pa /bin/sh , .Ev PATH is set to -.Pa /usr/bin:/bin , +.Pa /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin , and .Ev LOGNAME and From 430384523dfa027297fce96eac577c50e0ff8654 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Tue, 5 Jan 2016 20:09:26 +0000 Subject: [PATCH 5/7] iwm: revert r293178 This optimization is not proper (and causes kernel panic), since driver checks fw_status to optimize away parsing stage if it was already done. Reported by: dchagin --- sys/dev/iwm/if_iwm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 5556ca66dbde..510491e4d61f 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -2041,7 +2041,6 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, sc->sc_uc_current = ucode_type; error = iwm_start_fw(sc, ucode_type); - iwm_fw_info_free(&sc->sc_fw); if (error) { sc->sc_uc_current = old_type; return error; @@ -4937,6 +4936,7 @@ iwm_suspend(device_t dev) static int iwm_detach_local(struct iwm_softc *sc, int do_net80211) { + struct iwm_fw_info *fw = &sc->sc_fw; device_t dev = sc->sc_dev; int i; @@ -4953,6 +4953,10 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211) for (i = 0; i < nitems(sc->txq); i++) iwm_free_tx_ring(sc, &sc->txq[i]); + /* Free firmware */ + if (fw->fw_fp != NULL) + iwm_fw_info_free(fw); + /* Free scheduler */ iwm_free_sched(sc); if (sc->ict_dma.vaddr != NULL) From bd81fe68ee5c1e0b044670ea5f1757d1c1c222c9 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Tue, 5 Jan 2016 20:42:19 +0000 Subject: [PATCH 6/7] ioat(4): Add ioat_get_max_io_size() KPI Consumers need to know the permitted IO size to send maximally sized chunks to the hardware. Sponsored by: EMC / Isilon Storage Division --- share/man/man4/ioat.4 | 4 +++- sys/dev/ioat/ioat.c | 9 +++++++++ sys/dev/ioat/ioat.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ioat.4 b/share/man/man4/ioat.4 index dd467b2c3e5e..59e17e6e0e99 100644 --- a/share/man/man4/ioat.4 +++ b/share/man/man4/ioat.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2015 +.Dd January 5, 2016 .Dt IOAT 4 .Os .Sh NAME @@ -65,6 +65,8 @@ In .Fn ioat_put_dmaengine "bus_dmaengine_t dmaengine" .Ft int .Fn ioat_get_hwversion "bus_dmaengine_t dmaengine" +.Ft size_t +.Fn ioat_get_max_io_size "bus_dmaengine_t dmaengine" .Ft int .Fn ioat_set_interrupt_coalesce "bus_dmaengine_t dmaengine" "uint16_t delay" .Ft uint16_t diff --git a/sys/dev/ioat/ioat.c b/sys/dev/ioat/ioat.c index 4b6d7df8ea7d..c93d1b594185 100644 --- a/sys/dev/ioat/ioat.c +++ b/sys/dev/ioat/ioat.c @@ -744,6 +744,15 @@ ioat_get_hwversion(bus_dmaengine_t dmaengine) return (ioat->version); } +size_t +ioat_get_max_io_size(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (ioat->max_xfer_size); +} + int ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay) { diff --git a/sys/dev/ioat/ioat.h b/sys/dev/ioat/ioat.h index e8f47aeb558e..f5d5fada7045 100644 --- a/sys/dev/ioat/ioat.h +++ b/sys/dev/ioat/ioat.h @@ -70,6 +70,7 @@ void ioat_put_dmaengine(bus_dmaengine_t dmaengine); /* Check the DMA engine's HW version */ int ioat_get_hwversion(bus_dmaengine_t dmaengine); +size_t ioat_get_max_io_size(bus_dmaengine_t dmaengine); /* * Set interrupt coalescing on a DMA channel. From 8834318685bc0063c7e5c8643cbd4d8168eac56c Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Tue, 5 Jan 2016 21:05:17 +0000 Subject: [PATCH 7/7] Merge ^/projects/release-install-debug: - Rework MANIFEST generation and parsing via bsdinstall(8). - Allow selecting debugging distribution sets during install. - Rework bsdinstall(8) to fetch remote debug distribution sets when they are not available on the local install medium. - Allow selecting additional non-GENERIC kernels during install. At present, GENERIC is still required, and installed by default. Tested with: head@r293203 Sponsored by: The FreeBSD Foundation --- Makefile.inc1 | 24 +++++++++-- release/Makefile | 4 +- release/amd64/mkisoimages.sh | 2 +- release/i386/mkisoimages.sh | 2 +- release/pc98/mkisoimages.sh | 2 +- release/powerpc/mkisoimages.sh | 4 +- release/scripts/make-manifest.sh | 70 ++++++++++++++++++++++++++------ release/sparc64/mkisoimages.sh | 2 +- usr.sbin/bsdinstall/scripts/auto | 64 +++++++++++++++++++++++++++-- 9 files changed, 146 insertions(+), 28 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index a26df46ecafd..5102f9d0ec3f 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1284,27 +1284,43 @@ packagekernel: .if defined(NO_ROOT) .if !defined(NO_INSTALLKERNEL) cd ${DESTDIR}/${DISTDIR}/kernel; \ - tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \ + tar cvf - --exclude '*.debug' \ + @${DESTDIR}/${DISTDIR}/kernel.meta | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz .endif + cd ${DESTDIR}/${DISTDIR}/kernel; \ + tar cvf - --include '*/*/*.debug' \ + @${DESTDIR}/${DISTDIR}/kernel.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz .if ${BUILDKERNELS:[#]} > 1 .for _kernel in ${BUILDKERNELS:[2..-1]} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ + tar cvf - --exclude '*.debug' \ + @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz + cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ + tar cvf - --include '*/*/*.debug' \ + @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz .endfor .endif .else .if !defined(NO_INSTALLKERNEL) cd ${DESTDIR}/${DISTDIR}/kernel; \ - tar cvf - . | \ + tar cvf - --exclude '*.debug' . | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz .endif + cd ${DESTDIR}/${DISTDIR}/kernel; \ + tar cvf - --include '*/*/*.debug' $$(eval find .) | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz .if ${BUILDKERNELS:[#]} > 1 .for _kernel in ${BUILDKERNELS:[2..-1]} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - tar cvf - . | \ + tar cvf - --exclude '*.debug' . | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz + cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ + tar cvf - --include '*/*/*.debug' $$(eval find .) | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz .endfor .endif .endif diff --git a/release/Makefile b/release/Makefile index e3a233d355d2..07b8048de483 100644 --- a/release/Makefile +++ b/release/Makefile @@ -176,7 +176,7 @@ disc1: packagesystem MK_DEBUG_FILES=no # Copy distfiles mkdir -p ${.TARGET}/usr/freebsd-dist - for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \ + for dist in MANIFEST $$(ls *.txz | grep -vE -- '(base|lib32)-dbg'); \ do cp $${dist} ${.TARGET}/usr/freebsd-dist; \ done # Copy documentation, if generated @@ -225,7 +225,7 @@ dvd: packagesystem MK_TESTS=no MK_DEBUG_FILES=no # Copy distfiles mkdir -p ${.TARGET}/usr/freebsd-dist - for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \ + for dist in MANIFEST $$(ls *.txz | grep -v -- '(base|lib32)-dbg'); \ do cp $${dist} ${.TARGET}/usr/freebsd-dist; \ done # Copy documentation, if generated diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh index 755fb526f1cf..f72dd9e64d82 100644 --- a/release/amd64/mkisoimages.sh +++ b/release/amd64/mkisoimages.sh @@ -56,5 +56,5 @@ NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" -rm "$1/etc/fstab" +rm -f "$1/etc/fstab" rm -f efiboot.img diff --git a/release/i386/mkisoimages.sh b/release/i386/mkisoimages.sh index a250105df242..c6c25173b37b 100644 --- a/release/i386/mkisoimages.sh +++ b/release/i386/mkisoimages.sh @@ -42,4 +42,4 @@ NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" -rm "$1/etc/fstab" +rm -f "$1/etc/fstab" diff --git a/release/pc98/mkisoimages.sh b/release/pc98/mkisoimages.sh index 074fe09c037b..5e7a046147aa 100644 --- a/release/pc98/mkisoimages.sh +++ b/release/pc98/mkisoimages.sh @@ -42,4 +42,4 @@ NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" -rm "$1/etc/fstab" +rm -f "$1/etc/fstab" diff --git a/release/powerpc/mkisoimages.sh b/release/powerpc/mkisoimages.sh index c92072d11d7f..e69f32dd634d 100644 --- a/release/powerpc/mkisoimages.sh +++ b/release/powerpc/mkisoimages.sh @@ -64,6 +64,6 @@ NAME="$1"; shift publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" -rm "$1/etc/fstab" -rm /tmp/hfs-boot-block +rm -f "$1/etc/fstab" +rm -f /tmp/hfs-boot-block rm -rf "$1/ppc" diff --git a/release/scripts/make-manifest.sh b/release/scripts/make-manifest.sh index b21e8f59d36d..79cea70f8941 100755 --- a/release/scripts/make-manifest.sh +++ b/release/scripts/make-manifest.sh @@ -9,18 +9,64 @@ # # $FreeBSD$ -desc_base="Base system (MANDATORY)" -desc_kernel="Kernel (MANDATORY)" -desc_doc="Additional documentation" -doc_default=off -desc_lib32="32-bit compatibility libraries" -desc_ports="Ports tree" -desc_src="System source code" -desc_tests="Test suite" -src_default=off -tests_default=off +base="Base system" +doc="Additional Documentation" +kernel="Kernel" +ports="Ports tree" +src="System source tree" +lib32="32-bit compatibility libraries" +tests="Test suite" -for i in $*; do - echo "`basename $i` `sha256 -q $i` `tar tvf $i | wc -l | tr -d ' '` `basename $i .txz` \"`eval echo \\\$desc_$(basename $i .txz)`\" `eval echo \\\${$(basename $i .txz)_default:-on}`" +desc_base="${base} (MANDATORY)" +desc_base_dbg="${base} (Debugging)" +desc_doc="${doc}" +desc_kernel="${kernel} (MANDATORY)" +desc_kernel_dbg="${kernel} (Debugging)" +desc_kernel_alt="Alternate ${kernel}" +desc_kernel_alt_dbg="Alternate ${kernel} (Debugging)" +desc_lib32="${lib32}" +desc_lib32_dbg="${lib32} (Debugging)" +desc_ports="${ports}" +desc_src="${src}" +desc_tests="${tests}" + +default_doc=off +default_src=off +default_tests=off +default_base_dbg=off +default_lib32_dbg=off +default_kernel_alt=off +default_kernel_dbg=on +default_kernel_alt_dbg=off + +for i in ${*}; do + dist="${i}" + distname="${i%%.txz}" + distname="$(echo ${distname} | tr '-' '_')" + distname="$(echo ${distname} | tr 'kernel.' 'kernel_')" + hash="$(sha256 -q ${i})" + nfiles="$(tar tvf ${i} | wc -l | tr -d ' ')" + default="$(eval echo \${default_${distname}:-on})" + desc="$(eval echo \"\${desc_${distname}}\")" + + case ${i} in + kernel-dbg.txz) + desc="${desc_kernel_dbg}" + ;; + kernel.*-dbg.txz) + desc="$(eval echo \"${desc_kernel_alt_dbg}\")" + desc="${desc}: $(eval echo ${i%%-dbg.txz} | cut -f 2 -d '.')" + default="$(eval echo \"${default_kernel_alt_dbg}\")" + ;; + kernel.*.txz) + desc="$(eval echo \"${desc_kernel_alt}\")" + desc="${desc}: $(eval echo ${i%%.txz} | cut -f 2 -d '.')" + default="$(eval echo \"${default_kernel_alt}\")" + ;; + *) + ;; + esac + + printf "${dist}\t${hash}\t${nfiles}\t${distname}\t\"${desc}\"\t${default}\n" done diff --git a/release/sparc64/mkisoimages.sh b/release/sparc64/mkisoimages.sh index 337db40a494f..10c11b4b79af 100644 --- a/release/sparc64/mkisoimages.sh +++ b/release/sparc64/mkisoimages.sh @@ -38,7 +38,7 @@ BASEBITSDIR="$1" publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" makefs -t cd9660 -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME.tmp" "$@" -rm "$BASEBITSDIR/etc/fstab" +rm -f "$BASEBITSDIR/etc/fstab" if [ "x$BOPT" != "x-b" ]; then mv "$NAME.tmp" "$NAME" diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 5ac16cd2fb57..c681a12fd2a3 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -115,7 +115,8 @@ bsdinstall hostname || error "Set hostname failed" export DISTRIBUTIONS="base.txz kernel.txz" if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then - DISTMENU=`awk -F'\t' '!/^(kernel|base)/{print $4,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` + DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` + DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" exec 3>&1 EXTRA_DISTS=$( eval dialog \ @@ -129,16 +130,20 @@ if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then done fi +LOCAL_DISTRIBUTIONS="MANIFEST" FETCH_DISTRIBUTIONS="" for dist in $DISTRIBUTIONS; do if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist" + else + LOCAL_DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS $dist" fi done +LOCAL_DISTRIBUTIONS=`echo $LOCAL_DISTRIBUTIONS` # Trim white space FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS` # Trim white space if [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then - dialog --backtitle "FreeBSD Installer" --title "Network Installation" --msgbox "No installation files were found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0 + dialog --backtitle "FreeBSD Installer" --title "Network Installation" --msgbox "Some installation files were not found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0 bsdinstall netconfig || error NETCONFIG_DONE=yes fi @@ -299,6 +304,7 @@ esac if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then ALL_DISTRIBUTIONS="$DISTRIBUTIONS" + WANT_DEBUG= # Download to a directory in the new system as scratch space BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist" @@ -310,15 +316,65 @@ if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then DISTDIR_IS_UNIONFS=1 mount_nullfs -o union "$BSDINSTALL_FETCHDEST" "$BSDINSTALL_DISTDIR" else - export DISTRIBUTIONS="$ALL_DISTRIBUTIONS" + export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS" export BSDINSTALL_DISTDIR="$BSDINSTALL_FETCHDEST" fi export FTP_PASSIVE_MODE=YES - bsdinstall distfetch || error "Failed to fetch distribution" + # Iterate through the distribution list and set a flag if debugging + # distributions have been selected. + for _DISTRIBUTION in $DISTRIBUTIONS; do + case $_DISTRIBUTION in + *-dbg.*) + [ -e $BSDINSTALL_DISTDIR/$_DISTRIBUTION ] \ + && continue + WANT_DEBUG=1 + DEBUG_LIST="\n$DEBUG_LIST\n$_DISTRIBUTION" + ;; + *) + ;; + esac + done + + # Fetch the distributions. + bsdinstall distfetch + rc=$? + + if [ $rc -ne 0 ]; then + # If unable to fetch the remote distributions, recommend + # deselecting the debugging distributions, and retrying the + # installation, since failure to fetch *-dbg.txz should not + # be considered a fatal installation error. + msg="Failed to fetch remote distribution" + if [ ! -z "$WANT_DEBUG" ]; then + # Trim leading and trailing newlines. + DEBUG_LIST="${DEBUG_LIST%%\n}" + DEBUG_LIST="${DEBUG_LIST##\n}" + msg="$msg\n\nPlease deselect the following distributions" + msg="$msg and retry the installation:" + msg="$msg\n$DEBUG_LIST" + fi + error "$msg" + fi export DISTRIBUTIONS="$ALL_DISTRIBUTIONS" fi +if [ ! -z "$LOCAL_DISTRIBUTIONS" ]; then + # Download to a directory in the new system as scratch space + BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist" + mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST" + # Try to use any existing distfiles + if [ -d $BSDINSTALL_DISTDIR ]; then + DISTDIR_IS_UNIONFS=1 + mount_nullfs -o union "$BSDINSTALL_FETCHDEST" "$BSDINSTALL_DISTDIR" + export BSDINSTALL_DISTDIR="$BSDINSTALL_FETCHDEST" + fi + env DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS" \ + BSDINSTALL_DISTSITE="file:///usr/freebsd-dist" \ + bsdinstall distfetch || \ + error "Failed to fetch distribution from local media" +fi + bsdinstall checksum || error "Distribution checksum failed" bsdinstall distextract || error "Distribution extract failed" bsdinstall rootpass || error "Could not set root password"