set zos=/boot/zefieos


## Change these for your device ##

# For block devices, We do not use /dev/block like Android,
# so remove "/block", eg /dev/block/mmcblk0 becomes /dev/mmcblk0

# Destination (target disk), typically /dev/mmcblk0
set zefie_destination_dev=/dev/mmcblk0

# Source (USB) partition, typically /dev/sda1
set zefie_source_dev=/dev/sda1

# Kernel file name
set kernel_name=zImage

# Define ramdisks to layer on top of rootfs, in reverse order of priority (most important last)
set load_ramdisks=$zos/oem.cpio.gz

# Does your kernel need extra parameters?
set custom_boot_flags="loglevel=0 quiet vga=current"

## End zefieOS configuration ##

set default=0
set timeout=0
search --file --no-floppy --set=root $zos/zImage

## For QEMU Testing ##
if [ -f /boot/grub/force_qemu.txt ]; then
	set default=0
	set timeout=3
	set kernel_name=zImage-qemu
	set zefie_source_dev=/dev/sda
	set zefie_destination_dev=/dev/sdb
	set load_ramdisks=$zos/qemu.cpio.gz
fi

menuentry 'zefieOS EFI Restore system' {
	linux $zos/$kernel_name root=/dev/ram0 console=tty init=/sbin/init zefie.dest=$zefie_destination_dev zefie.usb=$zefie_source_dev $custom_boot_flags
	initrd $zos/rootfs.cpio.gz $zos/zefieos.cpio.gz $load_ramdisks
}

menuentry 'zefieOS System Only (Unsupported)' {
	linux $zos/$kernel_name root=/dev/ram0 console=tty init=/sbin/init zefie.dest=$zefie_desintation_dev zefie.usb=$zefie_source_dev $custom_boot_flags
	initrd $zos/rootfs.cpio.gz $load_ramdisks
}
