made minix3 bootable via EFI
Change-Id: I61d995e240deb6ebb3027d3ab07e6e3759e52b01
This commit is contained in:
parent
03de4d97b4
commit
1717959aeb
@ -245,6 +245,85 @@ create_protos()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Clone grub repository and build efi boot binary
|
||||||
|
#
|
||||||
|
fetch_and_build_grub()
|
||||||
|
{
|
||||||
|
if [ -d ${RELEASETOOLSDIR}/grub ]
|
||||||
|
then
|
||||||
|
echo grub is already checked out
|
||||||
|
else
|
||||||
|
git clone git://git.savannah.gnu.org/grub.git ${RELEASETOOLSDIR}/grub
|
||||||
|
pushd ${RELEASETOOLSDIR}/grub
|
||||||
|
# most recent known working commit at the time of writing
|
||||||
|
git clone b524fa27f56381bb0efa4944e36f50265113aee5
|
||||||
|
./autogen.sh
|
||||||
|
./configure --with-platform=efi --target=i386
|
||||||
|
make clean
|
||||||
|
make -j ${JOBS}
|
||||||
|
cd grub-core
|
||||||
|
../grub-mkimage -v -d . -o booti386.efi -O i386-efi -p /boot/efi normal part_msdos fat chain boot configfile multiboot minix3 gzio efi_uga
|
||||||
|
ls -l booti386.efi
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create grub.cfg for efi boot
|
||||||
|
#
|
||||||
|
create_grub_cfg()
|
||||||
|
{
|
||||||
|
cat > ${EFI_DIR}/boot/efi/grub.cfg <<END_GRUBCFG
|
||||||
|
|
||||||
|
insmod serial
|
||||||
|
insmod minix3
|
||||||
|
insmod gzio
|
||||||
|
#insmod efi_uga
|
||||||
|
#insmod video_fb
|
||||||
|
insmod all_video
|
||||||
|
|
||||||
|
set timeout=30
|
||||||
|
set default=0
|
||||||
|
|
||||||
|
set gfxmode=text
|
||||||
|
|
||||||
|
menuentry "Minix Boot" {
|
||||||
|
set root=(hd0,1)
|
||||||
|
multiboot /boot/minix_default/kernel rootdevname=c0d0p0
|
||||||
|
module /boot/minix_default/mod01_ds
|
||||||
|
module /boot/minix_default/mod02_rs
|
||||||
|
module /boot/minix_default/mod03_pm
|
||||||
|
module /boot/minix_default/mod04_sched
|
||||||
|
module /boot/minix_default/mod05_vfs
|
||||||
|
module /boot/minix_default/mod06_memory
|
||||||
|
module /boot/minix_default/mod07_tty
|
||||||
|
module /boot/minix_default/mod08_mib
|
||||||
|
module /boot/minix_default/mod09_vm
|
||||||
|
module /boot/minix_default/mod10_pfs
|
||||||
|
module /boot/minix_default/mod11_mfs
|
||||||
|
module /boot/minix_default/mod12_init
|
||||||
|
}
|
||||||
|
|
||||||
|
menuentry "Minix Boot (serial)" {
|
||||||
|
set root=(hd0,1)
|
||||||
|
multiboot /boot/minix_default/kernel rootdevname=c0d0p0 cttyline=0 ttybaud=115200 console=tty00 consdev=com0
|
||||||
|
module /boot/minix_default/mod01_ds
|
||||||
|
module /boot/minix_default/mod02_rs
|
||||||
|
module /boot/minix_default/mod03_pm
|
||||||
|
module /boot/minix_default/mod04_sched
|
||||||
|
module /boot/minix_default/mod05_vfs
|
||||||
|
module /boot/minix_default/mod06_memory
|
||||||
|
module /boot/minix_default/mod07_tty
|
||||||
|
module /boot/minix_default/mod08_mib
|
||||||
|
module /boot/minix_default/mod09_vm
|
||||||
|
module /boot/minix_default/mod10_pfs
|
||||||
|
module /boot/minix_default/mod11_mfs
|
||||||
|
module /boot/minix_default/mod12_init
|
||||||
|
}
|
||||||
|
END_GRUBCFG
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create ramdisk image from root directory
|
# Create ramdisk image from root directory
|
||||||
#
|
#
|
||||||
|
@ -26,6 +26,7 @@ fi
|
|||||||
: ${ROOT_SIZE=$(( 128*(2**20) - ${BOOTXX_SECS} * 512 ))}
|
: ${ROOT_SIZE=$(( 128*(2**20) - ${BOOTXX_SECS} * 512 ))}
|
||||||
: ${HOME_SIZE=$(( 128*(2**20) ))}
|
: ${HOME_SIZE=$(( 128*(2**20) ))}
|
||||||
: ${USR_SIZE=$(( 1792*(2**20) ))}
|
: ${USR_SIZE=$(( 1792*(2**20) ))}
|
||||||
|
: ${EFI_SIZE=$(( 0 ))}
|
||||||
|
|
||||||
# set up disk creation environment
|
# set up disk creation environment
|
||||||
. releasetools/image.defaults
|
. releasetools/image.defaults
|
||||||
@ -80,6 +81,18 @@ ROOTSIZEARG="-b $((${ROOT_SIZE} / 512 / 8))"
|
|||||||
USRSIZEARG="-b $((${USR_SIZE} / 512 / 8))"
|
USRSIZEARG="-b $((${USR_SIZE} / 512 / 8))"
|
||||||
HOMESIZEARG="-b $((${HOME_SIZE} / 512 / 8))"
|
HOMESIZEARG="-b $((${HOME_SIZE} / 512 / 8))"
|
||||||
|
|
||||||
|
if [ ${EFI_SIZE} -ge 512 ]
|
||||||
|
then
|
||||||
|
fetch_and_build_grub
|
||||||
|
|
||||||
|
: ${EFI_DIR=$OBJ/efi}
|
||||||
|
rm -rf ${EFI_DIR} && mkdir -p ${EFI_DIR}/boot/minix_default ${EFI_DIR}/boot/efi
|
||||||
|
create_grub_cfg
|
||||||
|
cp ${MODDIR}/* ${EFI_DIR}/boot/minix_default/
|
||||||
|
cp ${RELEASETOOLSDIR}/grub/grub-core/booti386.efi ${EFI_DIR}/boot/efi
|
||||||
|
cp ${RELEASETOOLSDIR}/grub/grub-core/*.mod ${EFI_DIR}/boot/efi
|
||||||
|
fi
|
||||||
|
|
||||||
ROOT_START=${BOOTXX_SECS}
|
ROOT_START=${BOOTXX_SECS}
|
||||||
echo " * ROOT"
|
echo " * ROOT"
|
||||||
_ROOT_SIZE=$(${CROSS_TOOLS}/nbmkfs.mfs -d ${ROOTSIZEARG} -I $((${ROOT_START}*512)) ${IMG} ${WORK_DIR}/proto.root)
|
_ROOT_SIZE=$(${CROSS_TOOLS}/nbmkfs.mfs -d ${ROOTSIZEARG} -I $((${ROOT_START}*512)) ${IMG} ${WORK_DIR}/proto.root)
|
||||||
@ -97,7 +110,18 @@ _HOME_SIZE=$(($_HOME_SIZE / 512))
|
|||||||
# Write the partition table using the natively compiled
|
# Write the partition table using the natively compiled
|
||||||
# minix partition utility
|
# minix partition utility
|
||||||
#
|
#
|
||||||
${CROSS_TOOLS}/nbpartition -m ${IMG} ${BOOTXX_SECS} 81:${_ROOT_SIZE} 81:${_USR_SIZE} 81:${_HOME_SIZE}
|
if [ ${EFI_SIZE} -ge 512 ]
|
||||||
|
then
|
||||||
|
dd if=/dev/zero bs=${EFI_SIZE} count=1 > ${OBJ}/efi.img
|
||||||
|
EFI_START=$((${HOME_START} + ${_HOME_SIZE}))
|
||||||
|
echo " * EFI"
|
||||||
|
${CROSS_TOOLS}/nbmakefs -t msdos -s ${EFI_SIZE} -o "F=32,c=1" ${OBJ}/efi.img ${EFI_DIR}
|
||||||
|
dd if=${OBJ}/efi.img >> ${IMG}
|
||||||
|
${CROSS_TOOLS}/nbpartition -m ${IMG} ${BOOTXX_SECS} 81:${_ROOT_SIZE}* 81:${_USR_SIZE} 81:${_HOME_SIZE} EF:1+
|
||||||
|
else
|
||||||
|
${CROSS_TOOLS}/nbpartition -m ${IMG} ${BOOTXX_SECS} 81:${_ROOT_SIZE}* 81:${_USR_SIZE} 81:${_HOME_SIZE}
|
||||||
|
fi
|
||||||
|
|
||||||
${CROSS_TOOLS}/nbinstallboot -f -m ${ARCH} ${IMG} ${DESTDIR}/usr/mdec/bootxx_minixfs3
|
${CROSS_TOOLS}/nbinstallboot -f -m ${ARCH} ${IMG} ${DESTDIR}/usr/mdec/bootxx_minixfs3
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@ -108,3 +132,5 @@ echo "qemu-system-i386 --enable-kvm -m 256 -hda `pwd`/${IMG}"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "To boot this image on kvm:"
|
echo "To boot this image on kvm:"
|
||||||
echo "cd ${MODDIR} && qemu-system-i386 --enable-kvm -m 256M -kernel kernel -append \"rootdevname=c0d0p0\" -initrd \"${mods}\" -hda `pwd`/${IMG}"
|
echo "cd ${MODDIR} && qemu-system-i386 --enable-kvm -m 256M -kernel kernel -append \"rootdevname=c0d0p0\" -initrd \"${mods}\" -hda `pwd`/${IMG}"
|
||||||
|
echo "To boot this image on kvm with EFI (tianocore OVMF):"
|
||||||
|
echo "qemu-system-i386 -L . -bios OVMF-i32.fd -m 256M -drive file=minix_x86.img,if=ide,format=raw"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user