
set root=(http,$SERVER_IP$)
set pxe_http_port=$HTTP_PORT$
set prefix=(http,$SERVER_IP$)/uis_loader/grub2

uds_func_install_mods
#uds_func_set_gfx

set timeout=0

set default=$BIOS_MODE$

set xen_para="dom0_max_vcpus=1-2 dom0_mem=1024M,max:1024M com1=115200,8n1 console=com1,vga"
set vmlinuz_para="$EXT_BOOT_OPT$ xencons=hvc console=hvc0 console=tty0  network_config=static:ip=$CLIENT_IP$;netmask=$SERVER_MASK$;gateway=$GATEWAY_IP$ answerfile_device=$CLIENT_MAC_COLON_LOWER$ answerfile=http://$SERVER_IP$:$HTTP_PORT$/kickstart/01-$CLIENT_MAC_DASH_LOWER$.auto  install"

menuentry 'LEGACY' {
    multiboot  $HTTP_IMG_ROOT$/boot/xen.gz "pre_dummy ${xen_para} post_dummy"
    module $HTTP_IMG_ROOT$/boot/vmlinuz "pre_dummy ${vmlinuz_para} post_dummy"
    module $HTTP_IMG_ROOT$/install.img
    boot
}

menuentry 'UEFI' {
	
	echo -en 'Downloading xen.gz ... '
	read_file_to_mem $HTTP_IMG_ROOT$/boot/xen.gz   xen_mem
	
	echo -en 'OK\nDownloading vmlinuz ... '
	read_file_to_mem $HTTP_IMG_ROOT$/boot/vmlinuz  vmlinuz_mem
	
	echo -en 'OK\nDownloading install.img ... '
	read_file_to_mem $HTTP_IMG_ROOT$/install.img   install_mem

	echo -en 'OK\nBooting ... '
	chainloader /uis_loader/grub_chain_xen.efi \
		multiboot2 mem:${xen_mem_addr}:size:${xen_mem_size} ${xen_para} @N@ \
		module2 mem:${vmlinuz_mem_addr}:size:${vmlinuz_mem_size} ${vmlinuz_para} @N@ \
		module2 mem:${install_mem_addr}:size:${install_mem_size} @N@ \
		boot
    
	boot
}
