Browse Source

add different genimage configs for PC Bios and EFI

Waldemar Brodkorb 7 years ago
parent
commit
b1f2caa365

+ 1 - 1
mk/image.mk

@@ -307,7 +307,7 @@ endif
 		-d "$(TARGET_DIR)" \
 		-o $(FW_DIR)/rootfs.ext $(MAKE_TRACE)
 	PATH='${HOST_PATH}' genimage \
-		--config "$(ADK_TOPDIR)/target/$(ADK_TARGET_ARCH)/$(ADK_TARGET_SYSTEM)/genimage.cfg" \
+		--config "$(ADK_TOPDIR)/target/$(ADK_TARGET_ARCH)/$(ADK_TARGET_SYSTEM)/$(ADK_TARGET_GENIMAGE_FILENAME)" \
 		--tmppath "${FW_DIR}/temp" \
 		--rootpath "$(TARGET_DIR)" \
 		--inputpath "$(FW_DIR)" \

+ 2 - 0
package/grub/Makefile

@@ -114,6 +114,8 @@ ifeq ($(ADK_PACKAGE_GRUB_PC),y)
 		-p "$(GRUB_PREFIX)" \
 		-o $(IDIR_GRUB)/$(GRUB_DIR)/core.img \
 		-c ./files/embed.cfg ext2 part_msdos biosdisk
+	$(CP) $(WRKINST)/usr/lib/grub/i386-pc/boot.img \
+		$(FW_DIR)/
 endif
 ifeq ($(ADK_PACKAGE_GRUB_EFI_X86)$(ADK_PACKAGE_GRUB_EFI_X86_64),y)
 	${CP} ${WRKINST}/usr/lib/grub/$(GRUB_ARCH) \

+ 1 - 0
rules.mk

@@ -72,6 +72,7 @@ ADK_TARGET_KERNEL_GIT:=			$(strip $(subst ",, $(ADK_TARGET_KERNEL_GIT)))
 ADK_TARGET_KERNEL_GIT_VER:=		$(strip $(subst ",, $(ADK_TARGET_KERNEL_GIT_VER)))
 ADK_TARGET_KERNEL_GIT_TYPE:=		$(strip $(subst ",, $(ADK_TARGET_KERNEL_GIT_TYPE)))
 ADK_TARGET_KERNEL_DEFCONFIG:=		$(strip $(subst ",, $(ADK_TARGET_KERNEL_DEFCONFIG)))
+ADK_TARGET_GENIMAGE_FILENAME:=		$(strip $(subst ",, $(ADK_TARGET_GENIMAGE_FILENAME)))
 
 ADK_TARGET_KARCH:=$(ADK_TARGET_ARCH)
 

+ 5 - 0
target/config/Config.in.rootfs

@@ -164,3 +164,8 @@ config ADK_TARGET_ROOTFS_GENIMAGE
 	  Create a complete disk image for the target with genimage.
 
 endchoice
+
+config ADK_TARGET_GENIMAGE_FILENAME
+	string
+	default "genimage-efi.cfg" if ADK_PACKAGE_GRUB_EFI_X86_64 || ADK_PACKAGE_GRUB_EFI_X86
+	default "genimage.cfg"

+ 30 - 0
target/x86_64/qemu-x86_64/genimage-efi.cfg

@@ -0,0 +1,30 @@
+image efi-part.vfat {
+  vfat {
+    file EFI {
+      image = "efi-part/EFI"
+    }
+  }
+  size = 32M
+}
+
+image disk.img {
+
+  hdimage {
+  }
+
+  partition boot {
+    partition-type = 0xEF
+    image = "efi-part.vfat"
+  }
+
+  partition root {
+    partition-type = 0x83
+    image = "rootfs.ext"
+  }
+
+  partition cfgfs {
+    partition-type = 0x88
+    image = "cfgfs.img"
+  }
+
+}

+ 10 - 11
target/x86_64/qemu-x86_64/genimage.cfg

@@ -1,20 +1,19 @@
-image efi-part.vfat {
-  vfat {
-    file EFI {
-      image = "efi-part/EFI"
-    }
-  }
-  size = 32M
-}
-
 image disk.img {
 
   hdimage {
   }
 
   partition boot {
-    partition-type = 0xEF
-    image = "efi-part.vfat"
+    in-partition-table = "no"
+    image = "boot.img"
+    offset = 0
+    size = 512
+  }
+
+  partition grub {
+    in-partition-table = "no"
+    image = "grub.img"
+    offset = 512
   }
 
   partition root {