From 90e4f5d187fe735f9dea0776ce6642af8ed19831 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Fri, 10 Feb 2023 12:28:12 +0100
Subject: sync dual-boot with single boot, use gpt/efi

---
 mk/image.mk                                     |  2 +-
 package/grub/files/grub-dual.cfg                | 12 ++++++++----
 target/x86_64/qemu-x86_64/genimage-efi-dual.cfg | 11 +++++++----
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/mk/image.mk b/mk/image.mk
index 85a83ad60..19e06b6b9 100644
--- a/mk/image.mk
+++ b/mk/image.mk
@@ -357,7 +357,7 @@ ifeq ($(ADK_RUNTIME_FIX_PERMISSION),y)
 endif
 ifeq ($(ADK_TARGET_DUAL_BOOT),y)
 	$(CP) $(FW_DIR)/kernel $(TARGET_DIR)
-	$(CP) $(FW_DIR)/*.dtb $(TARGET_DIR)
+	-$(CP) $(FW_DIR)/*.dtb $(TARGET_DIR)
 	mkdir $(TARGET_DIR)/extlinux
 	$(CP) $(EXTLINUX) $(TARGET_DIR)/extlinux
 	$(SED) "s#root=.*#root=/dev/$(ADK_TARGET_ROOTDEV)p1#" $(TARGET_DIR)/extlinux/extlinux.conf
diff --git a/package/grub/files/grub-dual.cfg b/package/grub/files/grub-dual.cfg
index bae2fa414..46b5451ad 100644
--- a/package/grub/files/grub-dual.cfg
+++ b/package/grub/files/grub-dual.cfg
@@ -40,11 +40,15 @@ function savedefault {
 }
 
 menuentry "OpenADK1" {
-  set root=(hd0,2)
-  linux (hd0,2)/kernel root=/dev/@@ROOTDEV@@2 rootfstype=ext4 rootwait panic=5
+  insmod part_gpt
+  insmod ext2
+  set root=(hd0,gpt2)
+  linux (hd0,2)/boot/kernel root=/dev/@@ROOTDEV@@2 rootfstype=ext4 rootwait panic=5
 }
 menuentry "OpenADK2" {
-  set root=(hd0,3)
-  linux (hd0,3)/kernel root=/dev/@@ROOTDEV@@3 rootfstype=ext4 rootwait panic=5
+  insmod part_gpt
+  insmod ext2
+  set root=(hd0,gpt3)
+  linux (hd0,3)/boot/kernel root=/dev/@@ROOTDEV@@3 rootfstype=ext4 rootwait panic=5
 }
 
diff --git a/target/x86_64/qemu-x86_64/genimage-efi-dual.cfg b/target/x86_64/qemu-x86_64/genimage-efi-dual.cfg
index 7c82a0bcb..ff3cb08d2 100644
--- a/target/x86_64/qemu-x86_64/genimage-efi-dual.cfg
+++ b/target/x86_64/qemu-x86_64/genimage-efi-dual.cfg
@@ -10,27 +10,30 @@ image efi-part.vfat {
 image disk.img {
 
   hdimage {
+    partition-table-type = "gpt"
   }
 
   partition boot {
-    partition-type = 0xEF
     image = "efi-part.vfat"
+    partition-type-uuid = U
+    offset = 32K
+    bootable = true
   }
 
   partition root1 {
-    partition-type = 0x83
+    partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
     image = "rootfs.ext"
     size = 128M
   }
 
   partition root2 {
-    partition-type = 0x83
+    partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
     image = "rootfs.ext"
     size = 128M
   }
 
   partition cfgfs {
-    partition-type = 0x88
+    partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
     image = "cfgfs.img"
   }
 
-- 
cgit v1.2.3