mirror of
https://github.com/rancher/os.git
synced 2025-09-08 02:01:27 +00:00
Add ipxe support
This commit is contained in:
@@ -32,6 +32,30 @@ isoinfo -x /rootfs.squashfs -R -i build/output.iso > build/output.squashfs
|
||||
isoinfo -x /boot/kernel.xz -R -i build/output.iso > build/output-kernel
|
||||
isoinfo -x /boot/rootfs.xz -R -i build/output.iso > build/output-initrd
|
||||
|
||||
|
||||
RELEASE_URL=${RELEASE_URL:-https://github.com/rancher/os/releases/download}
|
||||
INSTALL_CFG=${RELEASE_URL}/${VERSION}/example-cloud-init
|
||||
PXE_ASSET_VERSION="\${version}-\${arch}"
|
||||
if [ "${TAG}" = "dev" ]; then
|
||||
RELEASE_URL=tftp://10.0.2.2
|
||||
INSTALL_CFG=
|
||||
VERSION=${TAG}
|
||||
PXE_ASSET_VERSION=${TAG}
|
||||
fi
|
||||
|
||||
cat > build/output.ipxe << EOF
|
||||
#!ipxe
|
||||
set arch ${ARCH}
|
||||
set version ${VERSION}
|
||||
set url ${RELEASE_URL}/\${version}
|
||||
set kernel rancheros-${PXE_ASSET_VERSION}-kernel
|
||||
set initrd rancheros-${PXE_ASSET_VERSION}-initrd
|
||||
set rootfs rancheros-${PXE_ASSET_VERSION}.squashfs
|
||||
kernel \${url}/\${kernel} initrd=\${initrd} ip=dhcp rd.cos.disable root=live:\${url}/\${rootfs} rancheros.install.automatic=true rancheros.install.config_url=\${config} console=tty1 console=ttyS0
|
||||
initrd \${url}/\${initrd}
|
||||
boot
|
||||
EOF
|
||||
|
||||
mkdir -p dist/artifacts
|
||||
for i in build/output*; do
|
||||
mv -f $i dist/artifacts/rancheros-${TAG}${i##build/output}
|
||||
|
27
scripts/run
27
scripts/run
@@ -11,10 +11,34 @@ fi
|
||||
touch meta-data
|
||||
touch user-data
|
||||
rm -f seed.iso
|
||||
genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
|
||||
mkisofs -output seed.iso -volid cidata -joliet -rock user-data meta-data
|
||||
BOOT=
|
||||
|
||||
if [ "$1" = "pxe" ]; then
|
||||
shift 1
|
||||
if [ ! -e ipxe.cfg ]; then
|
||||
if [ ! -e ../dist/artifacts/rancheros-dev.ipxe ]; then
|
||||
make -C .. package
|
||||
fi
|
||||
if [ -e ../dist/artifacts/rancheros-dev.ipxe ]; then
|
||||
cp ../dist/artifacts/rancheros-dev.ipxe ipxe.cfg
|
||||
fi
|
||||
fi
|
||||
BOOT="-boot cn"
|
||||
|
||||
if [ ! -e dev ]; then
|
||||
ln -s ../dist/artifacts dev
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" == "" ] && [ ! -e output.iso ]; then
|
||||
make -C .. build iso
|
||||
fi
|
||||
|
||||
#-bios /usr/share/qemu/OVMF.fd \
|
||||
qemu-system-x86_64 \
|
||||
$BOOT \
|
||||
-enable-kvm \
|
||||
-m ${MEMORY:=4096} \
|
||||
-machine accel=${ACCEL:="kvm"} \
|
||||
@@ -23,6 +47,7 @@ qemu-system-x86_64 \
|
||||
-serial mon:stdio \
|
||||
-rtc base=utc,clock=rt \
|
||||
-chardev socket,path=qga.sock,server,nowait,id=qga0 \
|
||||
-nic user,tftp=./,bootfile=/ipxe.cfg \
|
||||
-device virtio-serial \
|
||||
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
|
||||
-drive if=virtio,media=disk,file=disk.img \
|
||||
|
Reference in New Issue
Block a user