Added explicit var to control boot fs type.
Since use of GPT does not necessarily imply lack of wanting the boot partition formatted and mounted.
This commit is contained in:
parent
1fdbd917d8
commit
68c90d1ae9
@ -84,6 +84,12 @@ the [zuper](https://github.com/dyne/zuper) zsh library.
|
||||
available space. again, see the `image_partition_raw_gpt()` function for a
|
||||
better understanding.
|
||||
|
||||
* `$bootfs`
|
||||
This variable controls the file system type of the boot partition. Recognised
|
||||
values are `none`, `vfat` (or the synonyms `fat` and `dos`), and `ext4`.
|
||||
When `none` is specified, the boot partition is left raw and not mounted,
|
||||
so /boot becomes part of the root partition.
|
||||
|
||||
* `$qemu_bin`
|
||||
declare this if you are bootstrapping for an architecture different than
|
||||
yours. it should hold the path to `qemu-user-static` or a similarly named
|
||||
|
@ -10,7 +10,7 @@ libdevuansdk to properly work as well.
|
||||
## build_image_dist()
|
||||
this function is kind of a wrapper function, mostly used in `arm-sdk` to build a
|
||||
complete "dd-able" image from start to end. to run, it requires `$arch`,
|
||||
`$size`, `$parted_type`, `$workdir`, and `$strapdir` to be declared. as well as
|
||||
`$size`, `$parted_type`, `$bootfs`, `$workdir`, and `$strapdir` to be declared. as well as
|
||||
`$parted_root`, `$parted_boot` if `$parted_type=dos`, or `$gpt_root`,
|
||||
`$gpt_boot` if `$parted_type=gpt`. see `creating_wrappers(7)` for insight on
|
||||
these variables.
|
||||
|
@ -35,6 +35,34 @@ image_prepare_raw() {
|
||||
count=$size
|
||||
}
|
||||
|
||||
image_format_partitions() {
|
||||
fn image_format_partitions
|
||||
req=(bootfs bootpart rootpart)
|
||||
ckreq || return 1
|
||||
|
||||
notice "formatting partitions..."
|
||||
case "$bootfs" in
|
||||
none)
|
||||
act "skipping boot partition"
|
||||
;;
|
||||
vfat|fat|dos)
|
||||
act "formatting boot as vfat"
|
||||
sudo mkfs.vfat ${bootpart}
|
||||
;;
|
||||
ext4)
|
||||
act "formatting boot as ext4"
|
||||
sudo mkfs.ext4 ${bootpart}
|
||||
;;
|
||||
*)
|
||||
error "unknown parted_bootfs type '$bootfs'"
|
||||
zerr
|
||||
;;
|
||||
esac
|
||||
|
||||
act "formatting root as ext4"
|
||||
sudo mkfs.ext4 ${rootpart}
|
||||
}
|
||||
|
||||
image_partition_raw_dos() {
|
||||
fn image_partition_raw_dos
|
||||
req=(workdir image_name parted_boot parted_root)
|
||||
@ -54,14 +82,12 @@ image_partition_raw_dos() {
|
||||
bootpart=${loopdevice}p1
|
||||
rootpart=${loopdevice}p2
|
||||
|
||||
notice "formatting partitions..."
|
||||
sudo mkfs.vfat ${bootpart}
|
||||
sudo mkfs.ext4 ${rootpart}
|
||||
image_format_partitions
|
||||
}
|
||||
|
||||
image_partition_raw_gpt() {
|
||||
fn image_partition_raw_gpt
|
||||
req=(workdir image_name)
|
||||
req=(workdir image_name gpt_boot gpt_root)
|
||||
ckreq || return 1
|
||||
|
||||
notice "partitioning raw gpt image..."
|
||||
@ -84,8 +110,7 @@ image_partition_raw_gpt() {
|
||||
bootpart="${loopdevice}p1"
|
||||
rootpart="${loopdevice}p2"
|
||||
|
||||
notice "formatting partitions..."
|
||||
sudo mkfs.ext4 -L rootfs ${rootpart}
|
||||
image_format_partitions
|
||||
}
|
||||
|
||||
image_pack_dist() {
|
||||
@ -139,14 +164,14 @@ image_pack_dist() {
|
||||
|
||||
image_raw_mount() {
|
||||
fn image_raw_mount
|
||||
req=(workdir bootpart rootpart)
|
||||
req=(workdir bootpart rootpart bootfs)
|
||||
ckreq || return 1
|
||||
|
||||
mkdir -p $workdir/mnt
|
||||
sudo mount $rootpart $workdir/mnt && \
|
||||
act "mounted root partition" || zerr
|
||||
|
||||
[[ "$parted_type" == gpt ]] || {
|
||||
[[ "$bootfs" == none ]] || {
|
||||
sudo mkdir $workdir/mnt/boot
|
||||
sudo mount $bootpart $workdir/mnt/boot && \
|
||||
act "mounted boot partition" || zerr
|
||||
@ -158,7 +183,7 @@ image_raw_umount() {
|
||||
req=(workdir bootpart rootpart)
|
||||
ckreq || return 1
|
||||
|
||||
[[ "$parted_type" == gpt ]] || {
|
||||
[[ "$bootfs" == none ]] || {
|
||||
sudo umount $workdir/mnt/boot && act "unmounted boot partition" || zerr
|
||||
sleep 1
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user