Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# $FreeBSD$
|
|
|
|
|
2018-07-13 16:32:31 +00:00
|
|
|
passphrase=passphrase
|
|
|
|
iterations=50000
|
2018-07-02 22:58:04 +00:00
|
|
|
|
2018-12-20 19:39:37 +00:00
|
|
|
# The smallest FAT32 filesystem is 33292 KB
|
|
|
|
espsize=33292
|
2018-06-18 23:16:47 +00:00
|
|
|
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
#
|
|
|
|
# Builds all the bat-shit crazy combinations we support booting from,
|
|
|
|
# at least for amd64. It assume you have a ~sane kernel in /boot/kernel
|
|
|
|
# and copies that into the ~150MB root images we create (we create the du
|
|
|
|
# size of the kernel + 20MB
|
|
|
|
#
|
|
|
|
# Sad panda sez: this runs as root, but could be userland if someone
|
|
|
|
# creates userland geli and zfs tools.
|
|
|
|
#
|
2018-12-20 19:39:37 +00:00
|
|
|
# This assumes an external program install-boot.sh which will install
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
# the appropriate boot files in the appropriate locations.
|
|
|
|
#
|
|
|
|
# These images assume ada0 will be the root image. We should likely
|
|
|
|
# use labels, but we don't.
|
|
|
|
#
|
2018-12-20 19:39:37 +00:00
|
|
|
# Assumes you've already rebuilt... maybe bad? Also maybe bad: the env
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
# vars should likely be conditionally set to allow better automation.
|
|
|
|
#
|
|
|
|
|
2019-04-24 22:35:29 +00:00
|
|
|
. $(dirname $0)/install-boot.sh
|
|
|
|
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
cpsys() {
|
|
|
|
src=$1
|
|
|
|
dst=$2
|
|
|
|
|
|
|
|
# Copy kernel + boot loader
|
|
|
|
(cd $src ; tar cf - .) | (cd $dst; tar xf -)
|
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_gpt_ufs_legacy() {
|
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
|
2017-12-19 00:18:17 +00:00
|
|
|
cat > ${src}/etc/fstab <<EOF
|
|
|
|
/dev/ada0p2 / ufs rw 1 1
|
|
|
|
EOF
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
makefs -t ffs -B little -s 200m ${img}.p2 ${src}
|
|
|
|
mkimg -s gpt -b ${src}/boot/pmbr \
|
|
|
|
-p freebsd-boot:=${src}/boot/gptboot \
|
|
|
|
-p freebsd-ufs:=${img}.p2 -o ${img}
|
2017-12-19 00:18:17 +00:00
|
|
|
rm -f ${src}/etc/fstab
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_gpt_ufs_uefi() {
|
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
|
2017-12-19 00:18:17 +00:00
|
|
|
cat > ${src}/etc/fstab <<EOF
|
|
|
|
/dev/ada0p2 / ufs rw 1 1
|
|
|
|
EOF
|
2019-04-24 22:35:29 +00:00
|
|
|
make_esp_file ${img}.p1 ${espsize} ${src}/boot/loader.efi
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
makefs -t ffs -B little -s 200m ${img}.p2 ${src}
|
2018-06-17 05:55:31 +00:00
|
|
|
mkimg -s gpt \
|
2017-12-19 00:18:17 +00:00
|
|
|
-p efi:=${img}.p1 \
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
-p freebsd-ufs:=${img}.p2 -o ${img}
|
2017-12-19 00:18:17 +00:00
|
|
|
rm -f ${src}/etc/fstab
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_gpt_ufs_both() {
|
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
|
2017-12-19 00:18:17 +00:00
|
|
|
cat > ${src}/etc/fstab <<EOF
|
|
|
|
/dev/ada0p3 / ufs rw 1 1
|
|
|
|
EOF
|
2019-04-24 22:35:29 +00:00
|
|
|
make_esp_file ${img}.p1 ${espsize} ${src}/boot/loader.efi
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
makefs -t ffs -B little -s 200m ${img}.p3 ${src}
|
|
|
|
# p1 is boot for uefi, p2 is boot for gpt, p3 is /
|
|
|
|
mkimg -b ${src}/boot/pmbr -s gpt \
|
2018-06-18 23:16:47 +00:00
|
|
|
-p efi:=${img}.p1 \
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
-p freebsd-boot:=${src}/boot/gptboot \
|
|
|
|
-p freebsd-ufs:=${img}.p3 \
|
|
|
|
-o ${img}
|
2017-12-19 00:18:17 +00:00
|
|
|
rm -f ${src}/etc/fstab
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_gpt_zfs_legacy() {
|
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=nogeli-gpt-zfs-legacy
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$((200 * 1024 * 1024 / 512))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
|
|
|
gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k
|
|
|
|
gpart add -t freebsd-zfs -l root $md
|
|
|
|
# install-boot will make this bootable
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p2
|
|
|
|
zpool set bootfs=${pool} ${pool}
|
2018-06-09 17:47:56 +00:00
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
zfs_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
# end tweaks
|
2018-06-09 17:47:56 +00:00
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_gpt_zfs_uefi() {
|
2018-06-09 17:49:43 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=nogeli-gpt-zfs-uefi
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$((200 * 1024 * 1024 / 512))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k -a 4k ${md}
|
2018-06-09 17:49:43 +00:00
|
|
|
gpart add -t freebsd-zfs -l root $md
|
|
|
|
# install-boot will make this bootable
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p2
|
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-09 17:49:43 +00:00
|
|
|
zfs_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-09 17:49:43 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_gpt_zfs_both() {
|
2018-06-09 17:49:43 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=nogeli-gpt-zfs-both
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$((200 * 1024 * 1024 / 512))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k -a 4k ${md}
|
2018-06-09 17:49:43 +00:00
|
|
|
gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k
|
|
|
|
gpart add -t freebsd-zfs -l root $md
|
|
|
|
# install-boot will make this bootable
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p3
|
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-09 17:49:43 +00:00
|
|
|
zfs_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-09 17:49:43 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_mbr_ufs_legacy() {
|
2017-12-19 00:18:17 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
|
|
|
|
cat > ${src}/etc/fstab <<EOF
|
|
|
|
/dev/ada0s1a / ufs rw 1 1
|
|
|
|
EOF
|
|
|
|
makefs -t ffs -B little -s 200m ${img}.s1a ${src}
|
|
|
|
mkimg -s bsd -b ${src}/boot/boot -p freebsd-ufs:=${img}.s1a -o ${img}.s1
|
2018-06-17 05:55:31 +00:00
|
|
|
mkimg -a 1 -s mbr -b ${src}/boot/boot0sio -p freebsd:=${img}.s1 -o ${img}
|
2017-12-19 00:18:17 +00:00
|
|
|
rm -f ${src}/etc/fstab
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_mbr_ufs_uefi() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
|
|
|
|
cat > ${src}/etc/fstab <<EOF
|
2018-07-03 16:07:04 +00:00
|
|
|
/dev/ada0s2a / ufs rw 1 1
|
2018-06-17 05:55:31 +00:00
|
|
|
EOF
|
2019-04-24 22:35:29 +00:00
|
|
|
make_esp_file ${img}.s1 ${espsize} ${src}/boot/loader.efi
|
2018-06-17 05:55:31 +00:00
|
|
|
makefs -t ffs -B little -s 200m ${img}.s2a ${src}
|
|
|
|
mkimg -s bsd -p freebsd-ufs:=${img}.s2a -o ${img}.s2
|
|
|
|
mkimg -a 1 -s mbr -p efi:=${img}.s1 -p freebsd:=${img}.s2 -o ${img}
|
|
|
|
rm -f ${src}/etc/fstab
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_mbr_ufs_both() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
|
|
|
|
cat > ${src}/etc/fstab <<EOF
|
2018-07-03 16:07:04 +00:00
|
|
|
/dev/ada0s2a / ufs rw 1 1
|
2018-06-17 05:55:31 +00:00
|
|
|
EOF
|
2019-04-24 22:35:29 +00:00
|
|
|
make_esp_file ${img}.s1 ${espsize} ${src}/boot/loader.efi
|
2018-06-17 05:55:31 +00:00
|
|
|
makefs -t ffs -B little -s 200m ${img}.s2a ${src}
|
|
|
|
mkimg -s bsd -b ${src}/boot/boot -p freebsd-ufs:=${img}.s2a -o ${img}.s2
|
|
|
|
mkimg -a 2 -s mbr -b ${src}/boot/mbr -p efi:=${img}.s1 -p freebsd:=${img}.s2 -o ${img}
|
|
|
|
rm -f ${src}/etc/fstab
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_mbr_zfs_legacy() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=nogeli-mbr-zfs-legacy
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$((200 * 1024 * 1024 / 512))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s mbr ${md}
|
|
|
|
gpart add -t freebsd ${md}
|
|
|
|
gpart set -a active -i 1 ${md}
|
|
|
|
gpart create -s bsd ${md}s1
|
|
|
|
gpart add -t freebsd-zfs ${md}s1
|
|
|
|
# install-boot will make this bootable
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}s1a
|
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-17 05:55:31 +00:00
|
|
|
zfs_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-17 05:55:31 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_mbr_zfs_uefi() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=nogeli-mbr-zfs-uefi
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$((200 * 1024 * 1024 / 512))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s mbr ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k ${md}
|
2018-06-17 05:55:31 +00:00
|
|
|
gpart add -t freebsd ${md}
|
|
|
|
gpart set -a active -i 2 ${md}
|
|
|
|
gpart create -s bsd ${md}s2
|
|
|
|
gpart add -t freebsd-zfs ${md}s2
|
|
|
|
# install-boot will make this bootable
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}s2a
|
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-17 05:55:31 +00:00
|
|
|
zfs_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-17 05:55:31 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_nogeli_mbr_zfs_both() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=nogeli-mbr-zfs-both
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$((200 * 1024 * 1024 / 512))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s mbr ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k ${md}
|
2018-06-17 05:55:31 +00:00
|
|
|
gpart add -t freebsd ${md}
|
|
|
|
gpart set -a active -i 2 ${md}
|
|
|
|
gpart create -s bsd ${md}s2
|
|
|
|
gpart add -t freebsd-zfs ${md}s2
|
|
|
|
# install-boot will make this bootable
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}s2a
|
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-17 05:55:31 +00:00
|
|
|
zfs_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-17 05:55:31 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_gpt_ufs_legacy() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$(( 200 * 1024 * 1024 / 512 ))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
|
|
|
gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k
|
|
|
|
gpart add -t freebsd-ufs -l root $md
|
|
|
|
# install-boot will make this bootable
|
2018-07-02 22:58:04 +00:00
|
|
|
echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2
|
|
|
|
echo ${passphrase} | geli attach -j - ${md}p2
|
2018-06-17 05:55:31 +00:00
|
|
|
newfs /dev/${md}p2.eli
|
|
|
|
mount /dev/${md}p2.eli ${mntpt}
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
|
|
|
cat > ${mntpt}/boot/loader.conf <<EOF
|
|
|
|
geom_eli_load=YES
|
|
|
|
EOF
|
|
|
|
cat > ${mntpt}/etc/fstab <<EOF
|
|
|
|
/dev/ada0p2.eli / ufs rw 1 1
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko
|
|
|
|
# end tweaks
|
|
|
|
umount -f ${mntpt}
|
|
|
|
geli detach ${md}p2
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_gpt_ufs_uefi() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$(( 200 * 1024 * 1024 / 512 ))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k -a 4k ${md}
|
2018-06-17 05:55:31 +00:00
|
|
|
gpart add -t freebsd-ufs -l root $md
|
|
|
|
# install-boot will make this bootable
|
2018-07-02 22:58:04 +00:00
|
|
|
echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2
|
|
|
|
echo ${passphrase} | geli attach -j - ${md}p2
|
2018-06-17 05:55:31 +00:00
|
|
|
newfs /dev/${md}p2.eli
|
|
|
|
mount /dev/${md}p2.eli ${mntpt}
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
|
|
|
cat > ${mntpt}/boot/loader.conf <<EOF
|
|
|
|
geom_eli_load=YES
|
|
|
|
EOF
|
|
|
|
cat > ${mntpt}/etc/fstab <<EOF
|
|
|
|
/dev/ada0p2.eli / ufs rw 1 1
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko
|
|
|
|
# end tweaks
|
|
|
|
umount -f ${mntpt}
|
|
|
|
geli detach ${md}p2
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_gpt_ufs_both() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$(( 200 * 1024 * 1024 / 512 ))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k -a 4k ${md}
|
2018-06-17 05:55:31 +00:00
|
|
|
gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k
|
|
|
|
gpart add -t freebsd-ufs -l root $md
|
|
|
|
# install-boot will make this bootable
|
2018-07-02 22:58:04 +00:00
|
|
|
echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3
|
|
|
|
echo ${passphrase} | geli attach -j - ${md}p3
|
2018-06-17 05:55:31 +00:00
|
|
|
newfs /dev/${md}p3.eli
|
|
|
|
mount /dev/${md}p3.eli ${mntpt}
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
|
|
|
cat > ${mntpt}/boot/loader.conf <<EOF
|
|
|
|
geom_eli_load=YES
|
|
|
|
EOF
|
|
|
|
cat > ${mntpt}/etc/fstab <<EOF
|
|
|
|
/dev/ada0p3.eli / ufs rw 1 1
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko
|
|
|
|
# end tweaks
|
|
|
|
umount -f ${mntpt}
|
|
|
|
geli detach ${md}p3
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_gpt_zfs_legacy() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=geli-gpt-zfs-legacy
|
|
|
|
|
2019-04-25 00:08:15 +00:00
|
|
|
# Note that in this flavor we create an empty p2 ufs partition, and put
|
|
|
|
# the bootable zfs stuff on p3, just to test the ability of the zfs probe
|
|
|
|
# probe routines to find a pool on a partition other than the first one.
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$(( 300 * 1024 * 1024 / 512 ))
|
2018-06-17 05:55:31 +00:00
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
|
|
|
gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k
|
2019-04-25 00:08:15 +00:00
|
|
|
gpart add -t freebsd-ufs -s 100m ${md}
|
2018-06-17 05:55:31 +00:00
|
|
|
gpart add -t freebsd-zfs -l root $md
|
|
|
|
# install-boot will make this bootable
|
2019-04-25 00:08:15 +00:00
|
|
|
echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3
|
|
|
|
echo ${passphrase} | geli attach -j - ${md}p3
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p3.eli
|
2018-06-17 05:55:31 +00:00
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-17 05:55:31 +00:00
|
|
|
zfs_load=YES
|
|
|
|
geom_eli_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-17 05:55:31 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
2019-04-25 00:08:15 +00:00
|
|
|
geli detach ${md}p3
|
2018-06-17 05:55:31 +00:00
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_gpt_zfs_uefi() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=geli-gpt-zfs-uefi
|
|
|
|
|
2019-04-25 00:08:15 +00:00
|
|
|
# Note that in this flavor we create an empty p2 ufs partition, and put
|
|
|
|
# the bootable zfs stuff on p3, just to test the ability of the zfs probe
|
|
|
|
# probe routines to find a pool on a partition other than the first one.
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$(( 300 * 1024 * 1024 / 512 ))
|
2018-06-17 05:55:31 +00:00
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k -a 4k ${md}
|
2019-04-25 00:08:15 +00:00
|
|
|
gpart add -t freebsd-ufs -s 100m ${md}
|
2018-06-17 05:55:31 +00:00
|
|
|
gpart add -t freebsd-zfs -l root $md
|
|
|
|
# install-boot will make this bootable
|
2019-04-25 00:08:15 +00:00
|
|
|
echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3
|
|
|
|
echo ${passphrase} | geli attach -j - ${md}p3
|
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p3.eli
|
2018-06-17 05:55:31 +00:00
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
2018-06-18 23:16:47 +00:00
|
|
|
cat >> ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-17 05:55:31 +00:00
|
|
|
zfs_load=YES
|
|
|
|
geom_eli_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-17 05:55:31 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
2019-04-25 00:08:15 +00:00
|
|
|
geli detach ${md}p3
|
2018-06-17 05:55:31 +00:00
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_gpt_zfs_both() {
|
2018-06-17 05:55:31 +00:00
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
pool=geli-gpt-zfs-both
|
|
|
|
|
|
|
|
dd if=/dev/zero of=${img} count=1 seek=$(( 200 * 1024 * 1024 / 512 ))
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
gpart create -s gpt ${md}
|
2018-12-20 19:39:37 +00:00
|
|
|
gpart add -t efi -s ${espsize}k -a 4k ${md}
|
2018-06-17 05:55:31 +00:00
|
|
|
gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k
|
|
|
|
gpart add -t freebsd-zfs -l root $md
|
|
|
|
# install-boot will make this bootable
|
2018-07-02 22:58:04 +00:00
|
|
|
echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3
|
|
|
|
echo ${passphrase} | geli attach -j - ${md}p3
|
2018-06-17 05:55:31 +00:00
|
|
|
zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p3.eli
|
|
|
|
zpool set bootfs=${pool} ${pool}
|
|
|
|
zfs create -po mountpoint=/ ${pool}/ROOT/default
|
|
|
|
# NB: The online guides go nuts customizing /var and other mountpoints here, no need
|
|
|
|
cpsys ${src} ${mntpt}
|
|
|
|
# need to make a couple of tweaks
|
|
|
|
cat > ${mntpt}/boot/loader.conf <<EOF
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cryptodev_load=YES
|
2018-06-17 05:55:31 +00:00
|
|
|
zfs_load=YES
|
|
|
|
geom_eli_load=YES
|
|
|
|
EOF
|
2019-04-24 23:52:38 +00:00
|
|
|
cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
cp /boot/kernel/cryptodev.ko ${mntpt}/boot/kernel/cryptodev.ko
|
2018-06-17 05:55:31 +00:00
|
|
|
cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko
|
|
|
|
cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko
|
|
|
|
# end tweaks
|
|
|
|
zfs umount -f ${pool}/ROOT/default
|
|
|
|
zfs set mountpoint=none ${pool}/ROOT/default
|
|
|
|
zpool set bootfs=${pool}/ROOT/default ${pool}
|
|
|
|
zpool set autoexpand=on ${pool}
|
|
|
|
zpool export ${pool}
|
|
|
|
geli detach ${md}p3
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
}
|
|
|
|
|
2018-06-17 05:55:31 +00:00
|
|
|
# GELI+MBR is not a valid configuration
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
mk_geli_mbr_ufs_legacy() {
|
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_mbr_ufs_uefi() {
|
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_mbr_ufs_both() {
|
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_mbr_zfs_legacy() {
|
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_mbr_zfs_uefi() {
|
|
|
|
}
|
|
|
|
|
|
|
|
mk_geli_mbr_zfs_both() {
|
|
|
|
}
|
|
|
|
|
|
|
|
# iso
|
|
|
|
# pxeldr
|
|
|
|
# u-boot
|
2017-12-19 00:18:17 +00:00
|
|
|
# powerpc
|
|
|
|
|
2018-02-05 00:18:21 +00:00
|
|
|
mk_sparc64_nogeli_vtoc8_ufs_ofw() {
|
|
|
|
src=$1
|
|
|
|
img=$2
|
|
|
|
mntpt=$3
|
|
|
|
geli=$4
|
|
|
|
scheme=$5
|
|
|
|
fs=$6
|
|
|
|
bios=$7
|
|
|
|
|
|
|
|
cat > ${src}/etc/fstab <<EOF
|
|
|
|
/dev/ada0a / ufs rw 1 1
|
|
|
|
EOF
|
|
|
|
makefs -t ffs -B big -s 200m ${img} ${src}
|
|
|
|
md=$(mdconfig -f ${img})
|
|
|
|
# For non-native builds, ensure that geom_part(4) supports VTOC8.
|
|
|
|
kldload geom_part_vtoc8.ko
|
|
|
|
gpart create -s VTOC8 ${md}
|
|
|
|
gpart add -t freebsd-ufs ${md}
|
|
|
|
${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md}
|
|
|
|
mdconfig -d -u ${md}
|
|
|
|
rm -f ${src}/etc/fstab
|
|
|
|
}
|
|
|
|
|
2018-07-13 16:32:31 +00:00
|
|
|
qser="-serial telnet::4444,server -nographic"
|
2017-12-19 00:18:17 +00:00
|
|
|
|
|
|
|
# https://wiki.freebsd.org/QemuRecipes
|
|
|
|
# aarch64
|
|
|
|
qemu_aarch64_uefi()
|
|
|
|
{
|
|
|
|
img=$1
|
|
|
|
sh=$2
|
|
|
|
|
|
|
|
echo "qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt \
|
|
|
|
-bios QEMU_EFI.fd ${qser} \
|
|
|
|
-drive if=none,file=${img},id=hd0 \
|
|
|
|
-device virtio-blk-device,drive=hd0" > $sh
|
2018-07-13 16:37:42 +00:00
|
|
|
chmod 755 $sh
|
2017-12-19 00:18:17 +00:00
|
|
|
# https://wiki.freebsd.org/arm64/QEMU also has
|
|
|
|
# -device virtio-net-device,netdev=net0
|
|
|
|
# -netdev user,id=net0
|
|
|
|
}
|
|
|
|
|
|
|
|
# Amd64 qemu
|
|
|
|
qemu_amd64_legacy()
|
|
|
|
{
|
|
|
|
img=$1
|
|
|
|
sh=$2
|
|
|
|
|
2018-06-17 02:49:42 +00:00
|
|
|
echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh
|
2018-07-13 16:37:42 +00:00
|
|
|
chmod 755 $sh
|
2017-12-19 00:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
qemu_amd64_uefi()
|
|
|
|
{
|
|
|
|
img=$1
|
|
|
|
sh=$2
|
|
|
|
|
2018-06-17 02:49:42 +00:00
|
|
|
echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" > $sh
|
2018-07-13 16:37:42 +00:00
|
|
|
chmod 755 $sh
|
2017-12-19 00:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
qemu_amd64_both()
|
|
|
|
{
|
|
|
|
img=$1
|
|
|
|
sh=$2
|
|
|
|
|
2018-06-17 02:49:42 +00:00
|
|
|
echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh
|
|
|
|
echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" >> $sh
|
2018-07-13 16:37:42 +00:00
|
|
|
chmod 755 $sh
|
2017-12-19 00:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# arm
|
|
|
|
# nothing listed?
|
|
|
|
|
|
|
|
# i386
|
|
|
|
qemu_i386_legacy()
|
|
|
|
{
|
|
|
|
img=$1
|
|
|
|
sh=$2
|
|
|
|
|
|
|
|
echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh
|
2018-07-13 16:37:42 +00:00
|
|
|
chmod 755 $sh
|
2017-12-19 00:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Not yet supported
|
|
|
|
qemu_i386_uefi()
|
|
|
|
{
|
|
|
|
img=$1
|
|
|
|
sh=$2
|
|
|
|
|
|
|
|
echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" > $sh
|
2018-07-13 16:37:42 +00:00
|
|
|
chmod 755 $sh
|
2017-12-19 00:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Needs UEFI to be supported
|
|
|
|
qemu_i386_both()
|
|
|
|
{
|
|
|
|
img=$1
|
|
|
|
sh=$2
|
|
|
|
|
|
|
|
echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh
|
2018-06-09 17:49:43 +00:00
|
|
|
echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" >> $sh
|
2018-07-13 16:37:42 +00:00
|
|
|
chmod 755 $sh
|
2017-12-19 00:18:17 +00:00
|
|
|
}
|
|
|
|
|
2018-07-02 22:51:48 +00:00
|
|
|
make_one_image()
|
|
|
|
{
|
|
|
|
local arch=${1?}
|
|
|
|
local geli=${2?}
|
|
|
|
local scheme=${3?}
|
|
|
|
local fs=${4?}
|
|
|
|
local bios=${5?}
|
|
|
|
|
|
|
|
# Create sparse file and mount newly created filesystem(s) on it
|
|
|
|
img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img
|
|
|
|
sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh
|
|
|
|
echo "vvvvvvvvvvvvvv Creating $img vvvvvvvvvvvvvvv"
|
|
|
|
rm -f ${img}*
|
|
|
|
eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios}
|
|
|
|
eval qemu_${arch}_${bios} ${img} ${sh}
|
|
|
|
[ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}*
|
|
|
|
echo "^^^^^^^^^^^^^^ Created $img ^^^^^^^^^^^^^^^"
|
|
|
|
}
|
|
|
|
|
2017-12-19 00:18:17 +00:00
|
|
|
# mips
|
|
|
|
# qemu-system-mips -kernel /path/to/rootfs/boot/kernel/kernel -nographic -hda /path/to/disk.img -m 2048
|
|
|
|
|
|
|
|
# Powerpc -- doesn't work but maybe it would enough for testing -- needs details
|
|
|
|
# powerpc64
|
|
|
|
# qemu-system-ppc64 -drive file=/path/to/disk.img,format=raw
|
|
|
|
|
|
|
|
# sparc64
|
|
|
|
# qemu-system-sparc64 -drive file=/path/to/disk.img,format=raw
|
|
|
|
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
# Misc variables
|
|
|
|
SRCTOP=$(make -v SRCTOP)
|
|
|
|
cd ${SRCTOP}/stand
|
|
|
|
OBJDIR=$(make -v .OBJDIR)
|
|
|
|
IMGDIR=${OBJDIR}/boot-images
|
|
|
|
mkdir -p ${IMGDIR}
|
|
|
|
MNTPT=$(mktemp -d /tmp/stand-test.XXXXXX)
|
|
|
|
|
|
|
|
# Setup the installed tree...
|
|
|
|
DESTDIR=${OBJDIR}/boot-tree
|
|
|
|
rm -rf ${DESTDIR}
|
|
|
|
mkdir -p ${DESTDIR}/boot/defaults
|
|
|
|
mkdir -p ${DESTDIR}/boot/kernel
|
|
|
|
cp /boot/kernel/kernel ${DESTDIR}/boot/kernel
|
2017-12-15 23:16:42 +00:00
|
|
|
echo -h -D -S115200 > ${DESTDIR}/boot.config
|
2018-06-18 23:16:47 +00:00
|
|
|
cat > ${DESTDIR}/boot/loader.conf <<EOF
|
|
|
|
console=comconsole
|
|
|
|
comconsole_speed=115200
|
2018-07-27 21:50:10 +00:00
|
|
|
boot_serial=yes
|
|
|
|
boot_multicons=yes
|
2018-06-18 23:16:47 +00:00
|
|
|
EOF
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
# XXX
|
|
|
|
cp /boot/device.hints ${DESTDIR}/boot/device.hints
|
|
|
|
# Assume we're already built
|
2019-04-24 23:51:12 +00:00
|
|
|
make install DESTDIR=${DESTDIR} MK_MAN=no MK_INSTALL_AS_USER=yes WITHOUT_DEBUG_FILES=yes
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "make install failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-12-19 00:18:17 +00:00
|
|
|
# Copy init, /bin/sh, minimal libraries and testing /etc/rc
|
|
|
|
mkdir -p ${DESTDIR}/sbin ${DESTDIR}/bin \
|
|
|
|
${DESTDIR}/lib ${DESTDIR}/libexec \
|
|
|
|
${DESTDIR}/etc ${DESTDIR}/dev
|
2018-06-18 23:16:47 +00:00
|
|
|
for f in /sbin/halt /sbin/init /bin/sh /sbin/sysctl $(ldd /bin/sh | awk 'NF == 4 { print $3; }') /libexec/ld-elf.so.1; do
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
cp $f ${DESTDIR}/$f
|
|
|
|
done
|
2017-12-19 00:18:17 +00:00
|
|
|
cat > ${DESTDIR}/etc/rc <<EOF
|
|
|
|
#!/bin/sh
|
|
|
|
|
2018-06-18 23:16:47 +00:00
|
|
|
sysctl machdep.bootmethod
|
2017-12-19 00:18:17 +00:00
|
|
|
echo "RC COMMAND RUNNING -- SUCCESS!!!!!"
|
|
|
|
halt -p
|
|
|
|
EOF
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
|
2018-07-02 22:51:48 +00:00
|
|
|
# If we were given exactly 5 args, go make that one image.
|
|
|
|
|
|
|
|
if [ $# -eq 5 ]; then
|
|
|
|
make_one_image $*
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
# OK. Let the games begin
|
|
|
|
|
2017-12-19 00:18:17 +00:00
|
|
|
for arch in amd64; do
|
|
|
|
for geli in nogeli geli; do
|
|
|
|
for scheme in gpt mbr; do
|
|
|
|
for fs in ufs zfs; do
|
|
|
|
for bios in legacy uefi both; do
|
2018-07-02 22:51:48 +00:00
|
|
|
make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
|
2017-12-19 00:18:17 +00:00
|
|
|
done
|
Script to generate minimal boot images for each of the 24 supported
boot images for x86. This will be enhanced to generate all the other
images (u-boot, powerpc CHRP, etc).
At the moment, it's only generating three of them. zfs+gpt+legacy
works with qemu:
qemu-system-x86_64 --drive file=${file},format=raw -serial telnet::4444,server
but the ufs ones still have issues I'm tracking down.
These images are the boot blocks, /boot/loader, a kernel, maybe a
couple of modules, /sbin/init, /bin/sh, /libexec/ld-elf.so, libc.so,
libedit and libncursesw. This is just enough to get to single user. At
the moment, these come from the host system, but should come from
OBJTOP.
At the moment, this requires root to build since the zfs tools require
it (and GELI will too when we add support for that).
Sponsored by: Netflix
2017-12-15 06:34:27 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
rmdir ${MNTPT}
|
2017-12-19 00:18:17 +00:00
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
# Notes for the future
|
|
|
|
|
|
|
|
for arch in i386; do
|
|
|
|
for geli in nogeli geli; do
|
|
|
|
for scheme in gpt mbr; do
|
|
|
|
for fs in ufs zfs; do
|
|
|
|
for bios in legacy; do
|
2018-07-02 22:51:48 +00:00
|
|
|
make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
|
2017-12-19 00:18:17 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for arch in arm aarch64; do
|
|
|
|
for scheme in gpt mbr; do
|
|
|
|
fs=ufs
|
|
|
|
for bios in uboot efi; do
|
2018-07-02 22:51:48 +00:00
|
|
|
make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
|
2017-12-19 00:18:17 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for arch in powerpc powerpc64; do
|
|
|
|
for scheme in ppc-wtf; do
|
|
|
|
fs=ufs
|
|
|
|
for bios in ofw uboot chrp; do
|
2018-07-02 22:51:48 +00:00
|
|
|
make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
|
2017-12-19 00:18:17 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for arch in sparc64; do
|
2018-02-05 00:18:21 +00:00
|
|
|
for geli in nogeli; do
|
|
|
|
for scheme in vtoc8; do
|
|
|
|
for fs in ufs; do
|
|
|
|
for bios in ofw; do
|
2018-07-02 22:51:48 +00:00
|
|
|
make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios}
|
2018-02-05 00:18:21 +00:00
|
|
|
done
|
|
|
|
done
|
2017-12-19 00:18:17 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|