raw image builds; grub+kernel
This commit is contained in:
parent
0188ebbeaf
commit
695e767a14
|
|
@ -24,6 +24,7 @@
|
||||||
devuan_sdk_version=0.1
|
devuan_sdk_version=0.1
|
||||||
|
|
||||||
setopt pushdsilent
|
setopt pushdsilent
|
||||||
|
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
|
||||||
|
|
||||||
SDK_PREFIX=`pwd`
|
SDK_PREFIX=`pwd`
|
||||||
SDK_HOME=`pwd`
|
SDK_HOME=`pwd`
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,33 @@
|
||||||
vars+=(imgname imgpath)
|
vars+=(imgname imgpath)
|
||||||
|
|
||||||
img_mkimage() {
|
img_mkimage() {
|
||||||
fn img_mkimage
|
fn img_mkimage $@
|
||||||
imgpath=${strapdir}.img
|
imgpath=${strapdir}.img
|
||||||
req=(imgpath imgsize)
|
local mbrtype="$1"
|
||||||
|
req=(imgpath imgsize mbrtype)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
imgname=`basename ${imgpath}`
|
imgname=`basename ${imgpath}`
|
||||||
|
|
||||||
notice "Creating raw image..."
|
notice "Creating raw image..."
|
||||||
|
silly
|
||||||
dd if=/dev/zero \
|
dd if=/dev/zero \
|
||||||
of="${imgpath}" \
|
of="${imgpath}" \
|
||||||
bs=1M count=${imgsize}
|
bs=1M count=${imgsize}
|
||||||
|
|
||||||
|
if [[ $mbrtype == "dos" ]]; then
|
||||||
|
img_partition_dos
|
||||||
|
elif [[ $mbrtype == "gpt" ]]; then
|
||||||
|
img_partition_gpt
|
||||||
|
else
|
||||||
|
error "No valid MBR type specified..."
|
||||||
|
zerr; zshexit
|
||||||
|
fi
|
||||||
|
|
||||||
|
img_mount
|
||||||
|
img_rsync_strapdir
|
||||||
|
img_install_bootloader
|
||||||
|
img_umount
|
||||||
}
|
}
|
||||||
|
|
||||||
img_partition_dos() {
|
img_partition_dos() {
|
||||||
|
|
@ -93,12 +109,21 @@ img_partition_gpt() {
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
img_bootloader_prepare() {
|
img_rsync_strapdir() {
|
||||||
fn img_bootloader_prepare
|
fn img_rsync_strapdir
|
||||||
|
req=(workdir strapdir)
|
||||||
|
ckreq || return 1
|
||||||
|
|
||||||
|
notice "Rsyncing strapdir to raw image..."
|
||||||
|
silly
|
||||||
|
sudo rsync -HPavz -q ${strapdir}/* ${workdir}/rootp
|
||||||
}
|
}
|
||||||
|
|
||||||
img_bootloader_install() {
|
img_install_bootloader() {
|
||||||
fn img_bootloader_install
|
fn img_install_bootloader
|
||||||
|
|
||||||
|
conf_install_kernel ${workdir}/rootp
|
||||||
|
conf_install_grub ${workdir}/rootp
|
||||||
}
|
}
|
||||||
|
|
||||||
img_mount() {
|
img_mount() {
|
||||||
|
|
@ -109,6 +134,7 @@ img_mount() {
|
||||||
mkdir -p ${workdir}/rootp
|
mkdir -p ${workdir}/rootp
|
||||||
|
|
||||||
sudo mount ${rootpart} ${workdir}/rootp && act "mounted root partition"
|
sudo mount ${rootpart} ${workdir}/rootp && act "mounted root partition"
|
||||||
|
sudo mkdir -p ${workdir}/rootp/{boot,dev,proc,sys}
|
||||||
sudo mount ${bootpart} ${workdir}/rootp/boot && act "mounted boot partition"
|
sudo mount ${bootpart} ${workdir}/rootp/boot && act "mounted boot partition"
|
||||||
|
|
||||||
mountdevproc ${workdir}/rootp
|
mountdevproc ${workdir}/rootp
|
||||||
|
|
@ -119,6 +145,8 @@ img_umount() {
|
||||||
req=(bootpart rootpart workdir)
|
req=(bootpart rootpart workdir)
|
||||||
ckreq || return 1
|
ckreq || return 1
|
||||||
|
|
||||||
escalate root "umount ${workdir}/rootp/boot" && act "umounted boot partition"
|
umountdevproc ${workdir}/rootp
|
||||||
escalate root "umount ${workdir}/rootp" && act "umounted root partition"
|
|
||||||
|
sudo umount ${workdir}/rootp/boot && act "umounted boot partition"
|
||||||
|
sudo umount ${workdir}/rootp && act "umounted root partition"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue