Initial import
This commit is contained in:
commit
94aad4b8e1
77 changed files with 4414 additions and 0 deletions
85
utils/arch/i686/generate-hdd.sh
Executable file
85
utils/arch/i686/generate-hdd.sh
Executable file
|
@ -0,0 +1,85 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
printf "Please don't invoke this script manually. Run \`make release_hdd\` instead.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sysroot_size=$(du -hsm kernel | cut -f 1)
|
||||
|
||||
disk_name=$1
|
||||
disk_size=$(($sysroot_size + $efi_partition_size + 2))
|
||||
|
||||
unamestr=$(uname)
|
||||
|
||||
# Check if we're running on a supported host
|
||||
if ! [[ "$unamestr" =~ ^('Linux'|'Darwin') ]]; then
|
||||
printf " failed. (unsupported host)\n"
|
||||
exit 128
|
||||
fi
|
||||
|
||||
# create a disk image
|
||||
dd if=/dev/zero of="$disk_name" bs=1M count="$disk_size" >/dev/null 2>&1
|
||||
|
||||
# create a partition table
|
||||
fdisk "$disk_name" >/dev/null 2>&1 << EOF
|
||||
g
|
||||
n p
|
||||
1
|
||||
|
||||
+$efi_partition_size\M
|
||||
t 1
|
||||
1
|
||||
n p
|
||||
2
|
||||
|
||||
|
||||
t 2
|
||||
11
|
||||
w
|
||||
EOF
|
||||
|
||||
tempmountdir=$(mktemp -d 2>/dev/null)
|
||||
|
||||
# mount disk
|
||||
if [ "$unamestr" = 'Linux' ]; then
|
||||
echo "Linux HDD Generation not implemented yet"
|
||||
rm -r $tempmountdir
|
||||
exit 200
|
||||
elif [ "$unamestr" = 'Darwin' ]; then
|
||||
loopback=$(hdiutil attach -nomount $disk_name)
|
||||
loopback=$(echo $loopback | cut -f1 -d" ")
|
||||
|
||||
loopback_efi="$loopback"s1
|
||||
fi
|
||||
|
||||
# format EFI partition
|
||||
mkfs.vfat -F32 -n "EFI" "$loopback_efi" >/dev/null 2>&1
|
||||
|
||||
# mount EFI partition
|
||||
if [ "$unamestr" = 'Darwin' ]; then
|
||||
diskutil mount -mountPoint "$tempmountdir" "$loopback_efi" >/dev/null 2>&1
|
||||
else
|
||||
mount "$loopback_efi" "$tempmountdir"
|
||||
fi
|
||||
|
||||
# Copy system root to the newly created image
|
||||
cp -r "$ROOT_DIR"/sysroot/* "$tempmountdir"
|
||||
|
||||
# unmount all partitions
|
||||
if [ "$unamestr" = 'Linux' ]; then
|
||||
echo "Linux HDD Generation not implemented yet"
|
||||
rm -r $tempmountdir
|
||||
exit 200
|
||||
elif [ "$unamestr" = 'Darwin' ]; then
|
||||
diskutil unmount "$tempmountdir" >/dev/null 2>&1
|
||||
hdiutil detach "$loopback" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
rm -r "$tempmountdir"
|
||||
|
||||
# Install legacy BIOS placeholder to the new image
|
||||
dd if="$BUILD_DIR/boot/boot/bootsect-hdd.bin" of="$disk_name" conv=notrunc bs=446 count=1 >/dev/null 2>&1
|
||||
dd if="$BUILD_DIR/boot/boot/bootsect-hdd.bin" of="$disk_name" conv=notrunc bs=1 count=2 skip=510 seek=510 >/dev/null 2>&1
|
||||
|
||||
printf " done.\n"
|
39
utils/arch/i686/generate-iso.sh
Executable file
39
utils/arch/i686/generate-iso.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
printf "Please don't invoke this script manually. Run \`make livecd\` instead.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
disk_name=$1
|
||||
|
||||
uefi_image=$BUILD_DIR/uefi.img
|
||||
tempmountdir=$(mktemp -d 2>/dev/null)
|
||||
|
||||
# Create UEFI image
|
||||
dd if=/dev/zero of=$uefi_image bs=1k count=1440 >/dev/null 2>&1
|
||||
mformat -i $uefi_image -f 1440 :: >/dev/null 2>&1
|
||||
mmd -i $uefi_image ::/EFI >/dev/null 2>&1
|
||||
mmd -i $uefi_image ::/EFI/BOOT >/dev/null 2>&1
|
||||
mcopy -i $uefi_image $SYSROOT_DIR/EFI/BOOT/BOOTIA32.EFI ::/EFI/BOOT >/dev/null 2>&1
|
||||
## !FIXME: Huge hack! Make a filesystem.
|
||||
mmd -i $uefi_image ::/System >/dev/null 2>&1
|
||||
mcopy -i $uefi_image $SYSROOT_DIR/System/axkrnl ::/System >/dev/null 2>&1
|
||||
|
||||
# Create directory structure
|
||||
mkdir -p $tempmountdir/boot
|
||||
|
||||
cp $uefi_image $tempmountdir/boot/uefi.bin
|
||||
cp $BUILD_DIR/boot/boot/bootsect-cd.bin $tempmountdir/boot/bootcd.bin
|
||||
cp -r $ROOT_DIR/sysroot/* $tempmountdir/
|
||||
|
||||
# Create ISO
|
||||
xorriso -as mkisofs -b boot/bootcd.bin \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
--efi-boot boot/uefi.bin \
|
||||
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
||||
$tempmountdir -o $1 >/dev/null 2>&1
|
||||
|
||||
rm -rf $tempmountdir
|
||||
|
||||
printf " done.\n"
|
87
utils/arch/x86_64/generate-hdd.sh
Executable file
87
utils/arch/x86_64/generate-hdd.sh
Executable file
|
@ -0,0 +1,87 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
printf "Please don't invoke this script manually. Run \`make release_hdd\` instead.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#sysroot_size=$(du -hsm kernel | cut -f 1)
|
||||
sysroot_size=16
|
||||
efi_partition_size=32
|
||||
|
||||
disk_name=$1
|
||||
disk_size=$(($sysroot_size + $efi_partition_size + 2))
|
||||
|
||||
unamestr=$(uname)
|
||||
|
||||
# Check if we're running on a supported host
|
||||
if ! [[ "$unamestr" =~ ^('Linux'|'Darwin') ]]; then
|
||||
printf " failed. (unsupported host)\n"
|
||||
exit 128
|
||||
fi
|
||||
|
||||
# create a disk image
|
||||
dd if=/dev/zero of="$disk_name" bs=1M count="$disk_size" >/dev/null 2>&1
|
||||
|
||||
# create a partition table
|
||||
fdisk "$disk_name" >/dev/null 2>&1 << EOF
|
||||
g
|
||||
n p
|
||||
1
|
||||
|
||||
+$efi_partition_size\M
|
||||
t 1
|
||||
1
|
||||
n p
|
||||
2
|
||||
|
||||
|
||||
t 2
|
||||
11
|
||||
w
|
||||
EOF
|
||||
|
||||
tempmountdir=$(mktemp -d 2>/dev/null)
|
||||
|
||||
# mount disk
|
||||
if [ "$unamestr" = 'Linux' ]; then
|
||||
echo "Linux HDD Generation not implemented yet"
|
||||
rm -r $tempmountdir
|
||||
exit 200
|
||||
elif [ "$unamestr" = 'Darwin' ]; then
|
||||
loopback=$(hdiutil attach -nomount $disk_name)
|
||||
loopback=$(echo $loopback | cut -f1 -d" ")
|
||||
|
||||
loopback_efi="$loopback"s1
|
||||
fi
|
||||
|
||||
# format EFI partition
|
||||
mkfs.vfat -F32 -n "EFI" "$loopback_efi" >/dev/null 2>&1
|
||||
|
||||
# mount EFI partition
|
||||
if [ "$unamestr" = 'Darwin' ]; then
|
||||
diskutil mount -mountPoint "$tempmountdir" "$loopback_efi" >/dev/null 2>&1
|
||||
else
|
||||
mount "$loopback_efi" "$tempmountdir"
|
||||
fi
|
||||
|
||||
# Copy system root to the newly created image
|
||||
cp -r "$ROOT_DIR"/sysroot/* "$tempmountdir"
|
||||
|
||||
# unmount all partitions
|
||||
if [ "$unamestr" = 'Linux' ]; then
|
||||
echo "Linux HDD Generation not implemented yet"
|
||||
rm -r $tempmountdir
|
||||
exit 200
|
||||
elif [ "$unamestr" = 'Darwin' ]; then
|
||||
diskutil unmount "$tempmountdir" >/dev/null 2>&1
|
||||
hdiutil detach "$loopback" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
rm -r "$tempmountdir"
|
||||
|
||||
# Install legacy BIOS placeholder to the new image
|
||||
dd if="$BUILD_DIR/boot/pc-bios/stage1-hdd.bin" of="$disk_name" conv=notrunc bs=446 count=1 >/dev/null 2>&1
|
||||
dd if="$BUILD_DIR/boot/pc-bios/stage1-hdd.bin" of="$disk_name" conv=notrunc bs=1 count=2 skip=510 seek=510 >/dev/null 2>&1
|
||||
|
||||
printf " done.\n"
|
39
utils/arch/x86_64/generate-iso.sh
Executable file
39
utils/arch/x86_64/generate-iso.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
printf "Please don't invoke this script manually. Run \`make livecd\` instead.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
disk_name=$1
|
||||
|
||||
uefi_image=$BUILD_DIR/uefi.img
|
||||
tempmountdir=$(mktemp -d 2>/dev/null)
|
||||
|
||||
# Create UEFI image
|
||||
dd if=/dev/zero of=$uefi_image bs=1k count=1440 >/dev/null 2>&1
|
||||
mformat -i $uefi_image -f 1440 :: >/dev/null 2>&1
|
||||
mmd -i $uefi_image ::/EFI >/dev/null 2>&1
|
||||
mmd -i $uefi_image ::/EFI/BOOT >/dev/null 2>&1
|
||||
mcopy -i $uefi_image $SYSROOT_DIR/EFI/BOOT/BOOTX64.EFI ::/EFI/BOOT >/dev/null 2>&1
|
||||
## !FIXME: Huge hack! Make a filesystem.
|
||||
mmd -i $uefi_image ::/System >/dev/null 2>&1
|
||||
mcopy -i $uefi_image $SYSROOT_DIR/System/axkrnl ::/System >/dev/null 2>&1
|
||||
|
||||
# Create directory structure
|
||||
mkdir -p $tempmountdir/boot
|
||||
|
||||
cp $uefi_image $tempmountdir/boot/uefi.bin
|
||||
cp $BUILD_DIR/boot/pc-bios/stage1-cd.bin $tempmountdir/boot/bootcd.bin
|
||||
cp -r $ROOT_DIR/sysroot/* $tempmountdir/
|
||||
|
||||
# Create ISO
|
||||
xorriso -as mkisofs -b boot/bootcd.bin \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
--efi-boot boot/uefi.bin \
|
||||
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
||||
$tempmountdir -o $1 >/dev/null 2>&1
|
||||
|
||||
rm -rf $tempmountdir
|
||||
|
||||
printf " done.\n"
|
20
utils/download-ovmf.sh
Executable file
20
utils/download-ovmf.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
check_command() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
echo "[!] '$1' could not be found!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Make sure we have curl
|
||||
check_command curl
|
||||
|
||||
mkdir -p ovmf
|
||||
|
||||
curl https://retrage.github.io/edk2-nightly/bin/RELEASEX64_OVMF.fd -o ovmf/ovmf-x86_64.fd >/dev/null 2>&1
|
||||
curl https://retrage.github.io/edk2-nightly/bin/RELEASEIA32_OVMF.fd -o ovmf/ovmf-i686.fd >/dev/null 2>&1
|
||||
curl https://retrage.github.io/edk2-nightly/bin/RELEASEAARCH64_QEMU_EFI.fd -o ovmf/ovmf-aarch64.fd >/dev/null 2>&1
|
||||
curl https://retrage.github.io/edk2-nightly/bin/RELEASERISCV64_VIRT_CODE.fd -o ovmf/ovmf-riscv64.fd >/dev/null 2>&1
|
||||
|
||||
printf " done.\n"
|
Loading…
Add table
Add a link
Reference in a new issue