Browse Source

qemu-x86_64: various fixes

- fix dual-boot for EFI setups
- normal BIOS does not work in dual-boot
- VGA and EFI does not work
Waldemar Brodkorb 1 month ago
parent
commit
0fe580b5ea

+ 6 - 0
mk/build.mk

@@ -101,6 +101,12 @@ POSTCONFIG=		-@\
 				rebuild=1;\
 			fi; \
 		done; \
+		for i in ADK_TARGET_DUAL_BOOT ADK_TARGET_QEMU_WITH_GRAPHIC;do \
+			if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
+				touch .rebuild.grub;\
+				rebuild=1;\
+			fi; \
+		done; \
 		for i in ADK_TARGET_GPU_MEM ADK_LINUX_KERNEL_SND_BCM2708;do \
 			if [ "$$(grep ^$$i .config|md5sum)" != "$$(grep ^$$i .config.old|md5sum)" ];then \
 				touch .rebuild.bcm28xx-bootloader;\

+ 4 - 4
mk/image.mk

@@ -347,7 +347,7 @@ ${FW_DIR}/${GENIMAGE}: ${TARGET_DIR} kernel-package
 	mkdir -p $(TARGET_DIR)/boot/extlinux
 	$(CP) $(EXTLINUX) $(TARGET_DIR)/boot/extlinux
 	$(CP) $(FW_DIR)/kernel $(TARGET_DIR)/boot
-	-$(CP) $(FW_DIR)/*.dtb $(TARGET_DIR)/boot
+	-$(CP) $(FW_DIR)/*.dtb $(TARGET_DIR)/boot 2>/dev/null
 ifeq ($(ADK_RUNTIME_FIX_PERMISSION),y)
 	echo '#!/bin/sh' > $(ADK_TOPDIR)/scripts/fakeroot.sh
 	echo "chown -R 0:0 $(TARGET_DIR)" >> $(ADK_TOPDIR)/scripts/fakeroot.sh
@@ -359,7 +359,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) 2>/dev/null
 	mkdir $(TARGET_DIR)/extlinux
 	$(CP) $(EXTLINUX) $(TARGET_DIR)/extlinux
 	$(SED) "s#root=.*#root=/dev/$(ADK_TARGET_ROOTDEV)p1#" $(TARGET_DIR)/extlinux/extlinux.conf
@@ -393,10 +393,10 @@ endif
 ifeq ($(ADK_TARGET_DUAL_BOOT),y)
 	(cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | sort | \
 		PATH='${HOST_PATH}' $(CPIO) -o --quiet -Hustar --owner=0:0 | \
-		${GZIP} -c > ${FW_DIR}/openadk.tar.gz)
+		gzip -c > ${FW_DIR}/openadk.tar.gz)
 	(cd ${FW_DIR}; PATH='${HOST_PATH}' sha256sum openadk.tar.gz \
 		| cut -d\  -f1 > sha256.txt)
-	(cd ${FW_DIR}; PATH='${HOST_PATH}' tar -cf ${ADK_TARGET_SYSTEM}-update.tar openadk.tar.gzip sha256.txt)
+	(cd ${FW_DIR}; PATH='${HOST_PATH}' tar -cf ${ADK_TARGET_SYSTEM}-update.tar openadk.tar.gz sha256.txt)
 	@rm -rf ${FW_DIR}/temp
 endif
 ifeq ($(ADK_PACKAGE_GRUB_EFI_X86)$(ADK_PACKAGE_GRUB_EFI_X86_64),y)

+ 12 - 7
package/grub/Makefile

@@ -66,6 +66,11 @@ GRUB_PREFIX=		(hd0,msdos1)/boot/grub
 GRUB_TARGET=		i386
 GRUB_PLATFORM=		pc
 GRUB_MODULES=		boot linux ext2 fat part_msdos part_gpt normal biosdisk
+ifeq ($(ADK_TARGET_QEMU_WITH_GRAPHIC),y)
+GRUB_CFG=		grub-pc-vga.cfg
+else
+GRUB_CFG=		grub-pc-serial.cfg
+endif
 endif
 
 ifeq ($(ADK_PACKAGE_GRUB_EFI_X86),y)
@@ -77,6 +82,11 @@ GRUB_PREFIX=		/EFI/BOOT
 GRUB_TARGET=		i386
 GRUB_PLATFORM=		efi
 GRUB_MODULES=		boot linux ext2 fat part_msdos part_gpt normal efi_gop
+ifeq ($(ADK_TARGET_DUAL_BOOT),y)
+GRUB_CFG=		grub-efi-serial-dual.cfg
+else
+GRUB_CFG=		grub-efi-serial.cfg
+endif
 endif
 
 ifeq ($(ADK_PACKAGE_GRUB_EFI_X86_64),y)
@@ -88,15 +98,10 @@ GRUB_PREFIX=		/EFI/BOOT
 GRUB_TARGET=		x86_64
 GRUB_PLATFORM=		efi
 GRUB_MODULES=		boot linux ext2 fat part_msdos part_gpt normal efi_gop
-endif
-
 ifeq ($(ADK_TARGET_DUAL_BOOT),y)
-GRUB_CFG=		grub-dual.cfg
-else
-ifeq ($(ADK_TARGET_QEMU_WITH_GRAPHIC),y)
-GRUB_CFG=		grub-pc-vga.cfg
+GRUB_CFG=		grub-efi-dual-serial.cfg
 else
-GRUB_CFG=		grub.cfg
+GRUB_CFG=		grub-efi-serial.cfg
 endif
 endif
 

+ 6 - 2
package/grub/files/grub-dual.cfg → package/grub/files/grub-efi-dual-serial.cfg

@@ -1,13 +1,17 @@
+serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
+terminal_input serial
+terminal_output serial
+
 if [ "x\${timeout}" != "x-1" ]; then
   if keystatus; then
     if keystatus --shift; then
       set timeout=-1
     else
-      set timeout=0
+      set timeout=2
     fi
   else
     if sleep --interruptible 2; then
-      set timeout=0
+      set timeout=2
     fi
   fi
 fi

+ 0 - 0
package/grub/files/grub.cfg → package/grub/files/grub-efi-serial.cfg


+ 14 - 0
package/grub/files/grub-pc-serial.cfg

@@ -0,0 +1,14 @@
+serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
+terminal_input serial
+terminal_output serial
+
+set default=0
+set timeout=3
+
+menuentry "OpenADK" {
+  insmod msdospart
+  insmod ext2
+  set root='hd0,1'
+  echo "Loading OpenADK"
+  linux /boot/kernel root=/dev/sda1 rootfstype=ext4 rootwait panic=10
+}

+ 1 - 1
package/grub/files/grub-pc-vga.cfg

@@ -6,5 +6,5 @@ menuentry "OpenADK" {
   insmod ext2
   set root='hd0,1'
   echo "Loading OpenADK"
-  linux /boot/kernel root=/dev/sda1 rootfstype=ext4 rootwait panic=10
+  linux /boot/kernel console=tty0 root=/dev/sda1 rootfstype=ext4 rootwait panic=10
 }

+ 1 - 0
target/x86_64/qemu-x86_64/genimage-dual.cfg

@@ -8,6 +8,7 @@ image disk.img {
     image = "boot.img"
     offset = 0
     size = 512
+    holes = {"(440; 512)"}
   }
 
   partition grub {

+ 4 - 4
target/x86_64/qemu-x86_64/genimage-efi-dual.cfg

@@ -22,14 +22,14 @@ image disk.img {
 
   partition root1 {
     partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
-    image = "rootfs.ext"
-    size = 128M
+    image = "rootfs1.ext"
+    size = 64M
   }
 
   partition root2 {
     partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
-    image = "rootfs.ext"
-    size = 128M
+    image = "rootfs2.ext"
+    size = 64M
   }
 
   partition cfgfs {