diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-05 21:59:15 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-05 21:59:15 +0200 |
commit | 3e337374f35eaf153f8ced25cc466d896a8a0a4d (patch) | |
tree | 6778dbcc9125156258203b01e27a4ff56d195a58 | |
parent | 857e9176a37ec642e007ea33c142ee3fb87bbf85 (diff) |
add some basic genimage support
-rw-r--r-- | mk/image.mk | 10 | ||||
-rw-r--r-- | mk/rootfs.mk | 1 | ||||
-rw-r--r-- | package/grub/Makefile | 58 | ||||
-rw-r--r-- | target/config/Config.in.rootfs | 7 | ||||
-rw-r--r-- | target/x86_64/Makefile | 3 | ||||
-rw-r--r-- | target/x86_64/qemu-x86_64/genimage.cfg | 25 |
6 files changed, 98 insertions, 6 deletions
diff --git a/mk/image.mk b/mk/image.mk index ff7d99af0..edccdce3e 100644 --- a/mk/image.mk +++ b/mk/image.mk @@ -271,5 +271,15 @@ ${FW_DIR}/${ROOTFSISO}: ${TARGET_DIR} kernel-package -c boot/syslinux/boot.cat -no-emul-boot \ -boot-load-size 4 -boot-info-table ${TARGET_DIR} +${FW_DIR}/${GENIMAGE}: ${TARGET_DIR} kernel-package + rm -rf ${FW_DIR}/temp + mkdir -p ${FW_DIR}/temp + PATH='${HOST_PATH}' genimage \ + --config "$(ADK_TOPDIR)/target/$(ADK_TARGET_CPU_ARCH)/$(ADK_TARGET_SYSTEM)/genimage.cfg" \ + --tmppath "${FW_DIR}/temp" \ + --rootpath "$(TARGET_DIR)" \ + --inputpath "$(FW_DIR)" \ + --outputpath "$(FW_DIR)" + imageclean: rm -f $(FW_DIR)/$(ADK_TARGET_SYSTEM)-* ${BUILD_DIR}/$(ADK_TARGET_SYSTEM)-* diff --git a/mk/rootfs.mk b/mk/rootfs.mk index 7539185f7..4209d2cfa 100644 --- a/mk/rootfs.mk +++ b/mk/rootfs.mk @@ -64,5 +64,6 @@ $(eval $(call rootfs_template,jffs2,JFFS2,$(MTDDEV) rootfstype=jffs2)) $(eval $(call rootfs_template,nfsroot,NFSROOT,root=/dev/nfs ip=dhcp)) $(eval $(call rootfs_template,encrypted,ENCRYPTED)) $(eval $(call rootfs_template,iso,ISO)) +$(eval $(call rootfs_template,genimage,GENIMAGE)) export ADK_TARGET_FS diff --git a/package/grub/Makefile b/package/grub/Makefile index 69165a3e6..608280cbb 100644 --- a/package/grub/Makefile +++ b/package/grub/Makefile @@ -19,17 +19,52 @@ PKG_ARCH_DEPENDS:= x86 x86_64 PKG_SUBPKGS:= GRUB GRUB_TOOLS PKGSD_GRUB_TOOLS:= grub2 tools -PKG_CHOICES_GRUB:= PC EFI +PKG_CHOICES_GRUB:= PC EFI_X86 EFI_X86_64 PKGCD_PC:= build for PC BIOS -PKGCD_EFI:= build for EFI +PKGCD_EFI_X86:= build for EFI x86 +PKGCD_EFI_X86_64:= build for EFI x86_64 +include $(ADK_TOPDIR)/mk/host.mk include $(ADK_TOPDIR)/mk/package.mk +$(eval $(call HOST_template,GRUB,grub,$(PKG_VERSION)-${PKG_RELEASE})) $(eval $(call PKG_template,GRUB,grub,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,GRUB_TOOLS,grub-tools,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -TARGET_CFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_CFLAGS)) -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) +TARGET_CFLAGS:=$(filter-out -fstack-protector-all,$(TARGET_CFLAGS)) +TARGET_CFLAGS:=$(filter-out -flto,$(TARGET_CFLAGS)) + +GRUB2_BOOT_PARTITION:= hd0,msdos1 + +ifeq ($(ADK_PACKAGE_GRUB_PC),y) +GRUB2_IMAGE = $(FW_DIR)/grub.img +GRUB2_CFG = $(TARGET_DIR)/boot/grub/grub.cfg +GRUB2_PREFIX = ($(GRUB2_BOOT_PARTITION))/boot/grub +GRUB2_TUPLE = i386-pc +GRUB2_TARGET = i386 +GRUB2_PLATFORM = pc +GRUB2_MODULES = boot linux ext2 fat part_msdos part_gpt normal biosdisk +endif + +ifeq ($(ADK_PACKAGE_GRUB_EFI_X86),y) +GRUB2_IMAGE = $(FW_DIR)/efi-part/EFI/BOOT/bootia32.efi +GRUB2_CFG = $(FW_DIR)/efi-part/EFI/BOOT/grub.cfg +GRUB2_PREFIX = /EFI/BOOT +GRUB2_TUPLE = i386-efi +GRUB2_TARGET = i386 +GRUB2_PLATFORM = efi +GRUB2_MODULES = boot linux ext2 fat part_msdos part_gpt normal efi_gop +endif + +ifeq ($(ADK_PACKAGE_GRUB_EFI_X86_64),y) +GRUB2_IMAGE = $(FW_DIR)/efi-part/EFI/BOOT/bootx64.efi +GRUB2_CFG = $(FW_DIR)/efi-part/EFI/BOOT/grub.cfg +GRUB2_PREFIX = /EFI/BOOT +GRUB2_TUPLE = x86_64-efi +GRUB2_TARGET = x86_64 +GRUB2_PLATFORM = efi +GRUB2_MODULES = boot linux ext2 fat part_msdos part_gpt normal efi_gop +endif # core.img is generated via # grub-mkimage -O ${GRUB_ARCH} -o core.img -c embed.cfg ${GRUB_MODULES} @@ -39,7 +74,7 @@ ifeq ($(ADK_PACKAGE_GRUB_PC),y) GRUB_ARCH:= i386-pc CONFIGURE_ARGS+= --with-platform=pc endif -ifeq ($(ADK_PACKAGE_GRUB_EFI),y) +ifeq ($(ADK_PACKAGE_GRUB_EFI_X86)$(ADK_PACKAGE_GRUB_EFI_X86_64),y) GRUB_ARCH:= x86_64-efi CONFIGURE_ARGS+= --with-platform=efi endif @@ -55,8 +90,18 @@ grub-install: ${INSTALL_DIR} $(IDIR_GRUB)/boot/grub/${GRUB_ARCH} ${CP} ${WRKINST}/usr/lib/grub/${GRUB_ARCH}/*{mod,lst,img} \ $(IDIR_GRUB)/boot/grub/${GRUB_ARCH}/ - -${CP} ./files/core.img.${GRUB_ARCH} \ + $(STAGING_HOST_DIR)/usr/bin/grub-mkimage \ + -d $(STAGING_HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE) \ + -O $(GRUB2_TUPLE) \ + -o $(GRUB2_IMAGE) \ + -p "$(GRUB2_PREFIX)" \ + $(GRUB2_MODULES) +ifeq ($(ADK_PACKAGE_GRUB_PC),y) + $(CP) ./files/core.img.${GRUB_ARCH} \ $(IDIR_GRUB)/boot/grub/core.img + $(CP) $(WRKINST)/usr/lib/grub/i386-pc/boot.img \ + $(FW_DIR)/ +endif grub-tools-install: ${INSTALL_DIR} $(IDIR_GRUB_TOOLS)/usr/{sbin,bin,share,lib} @@ -77,4 +122,5 @@ grub-tools-install: ${CP} ${WRKINST}/usr/share/grub \ $(IDIR_GRUB_TOOLS)/usr/share +include ${ADK_TOPDIR}/mk/host-bottom.mk include ${ADK_TOPDIR}/mk/pkg-bottom.mk diff --git a/target/config/Config.in.rootfs b/target/config/Config.in.rootfs index 0c8cdfcfa..442130c01 100644 --- a/target/config/Config.in.rootfs +++ b/target/config/Config.in.rootfs @@ -150,6 +150,13 @@ config ADK_TARGET_ROOTFS_ARCHIVE help Use this option if your root filesystem is ext2/ext3/ext4/xfs. +config ADK_TARGET_ROOTFS_GENIMAGE + bool "Create a disk image for the target" + select ADK_KERNEL_EXT2_FS if ADK_TARGET_QEMU || ADK_TARGET_VBOX + select ADK_TARGET_QEMU_WITH_BLOCK + help + Create a complete disk image for the target with genimage. + endchoice choice diff --git a/target/x86_64/Makefile b/target/x86_64/Makefile index 8fa5b0ddf..cd6530c91 100644 --- a/target/x86_64/Makefile +++ b/target/x86_64/Makefile @@ -108,6 +108,9 @@ endif ifeq (${ADK_TARGET_FS},iso) imageinstall: ${FW_DIR}/${ROOTFSISO} targethelp endif +ifeq (${ADK_TARGET_FS},genimage) +imageinstall: ${FW_DIR}/${GENIMAGE} targethelp +endif ifeq ($(ADK_TARGET_FS),nfsroot) imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp endif diff --git a/target/x86_64/qemu-x86_64/genimage.cfg b/target/x86_64/qemu-x86_64/genimage.cfg new file mode 100644 index 000000000..a958d560d --- /dev/null +++ b/target/x86_64/qemu-x86_64/genimage.cfg @@ -0,0 +1,25 @@ +image disk.img { + + hdimage { + } + + partition boot { + in-partition-table = "no" + image = "boot.img" + offset = 0 + size = 512 + } + + partition grub { + in-partition-table = "no" + image = "grub.img" + offset = 512 + } + + partition root { + partition-type = 0x83 + image = "rootfs.ext2" + } + +} + |