x86: sync with upstream
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
606fbf7ab1
commit
396367e818
@ -1,15 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/Generic
|
||||
NAME:=Generic
|
||||
endef
|
||||
|
||||
define Profile/Generic/Description
|
||||
Generic Profile
|
||||
endef
|
||||
$(eval $(call Profile,Generic))
|
||||
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
ARCH:=i386
|
||||
BOARD:=x86
|
||||
BOARDNAME:=x86
|
||||
FEATURES:=squashfs vdi vmdk pcmcia fpu
|
||||
FEATURES:=squashfs ext4 vdi vmdk pcmcia targz fpu boot-part rootfs-part
|
||||
SUBTARGETS:=64 generic zen legacy geode
|
||||
MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
@ -28,6 +28,9 @@ kmod-usb-net kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 km
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
|
||||
$(eval $(call $(if $(CONFIG_TARGET_ROOTFS_ISO),RequireCommand,Ignore),mkisofs, \
|
||||
Please install mkisofs. \
|
||||
$(eval $(call $(if $(CONFIG_ISO_IMAGES),SetupHostCommand,Ignore),mkisofs, \
|
||||
Please install mkisofs. , \
|
||||
mkisofs -v 2>&1 , \
|
||||
genisoimage -v 2>&1 | grep genisoimage, \
|
||||
xorrisofs -v 2>&1 | grep xorriso \
|
||||
))
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/Generic
|
||||
NAME:=Generic
|
||||
PACKAGES:=kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci \
|
||||
kmod-pcnet32 kmod-8139too kmod-r8169 kmod-sis900 kmod-tg3 \
|
||||
kmod-via-rhine kmod-via-velocity
|
||||
endef
|
||||
|
||||
define Profile/Generic/Description
|
||||
Generic Profile
|
||||
endef
|
||||
$(eval $(call Profile,Generic))
|
||||
@ -1,20 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/Generic
|
||||
NAME:=Generic
|
||||
PACKAGES:= \
|
||||
soloscli linux-atm br2684ctl ppp-mod-pppoa pppdump pppstats \
|
||||
hwclock flashrom tc kmod-pppoa kmod-8139cp kmod-mppe \
|
||||
kmod-usb-ohci-pci kmod-hwmon-lm90 \
|
||||
kmod-via-rhine
|
||||
endef
|
||||
|
||||
define Profile/Generic/Description
|
||||
Generic Profile for all Geode boards.
|
||||
endef
|
||||
$(eval $(call Profile,Generic))
|
||||
@ -1,19 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/Geos
|
||||
NAME:=Geos
|
||||
PACKAGES:= \
|
||||
soloscli linux-atm br2684ctl ppp-mod-pppoa pppdump pppstats \
|
||||
hwclock flashrom tc kmod-pppoa kmod-8139cp kmod-mppe \
|
||||
kmod-usb-ohci-pci kmod-hwmon-lm90
|
||||
endef
|
||||
|
||||
define Profile/Geos/Description
|
||||
Traverse Technologies Geos ADSL router
|
||||
endef
|
||||
$(eval $(call Profile,Geos))
|
||||
7
target/linux/x86/image/64.mk
Normal file
7
target/linux/x86/image/64.mk
Normal file
@ -0,0 +1,7 @@
|
||||
define Device/generic
|
||||
DEVICE_TITLE := Generic x86/64
|
||||
DEVICE_PACKAGES += kmod-amazon-ena kmod-bnx2 kmod-e1000e kmod-e1000 \
|
||||
kmod-forcedeth kmod-igb kmod-ixgbe kmod-amd-xgbe kmod-r8169
|
||||
GRUB2_VARIANT := generic
|
||||
endef
|
||||
TARGET_DEVICES += generic
|
||||
@ -1,33 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2006-2020 OpenWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
export PATH=$(TARGET_PATH):/sbin
|
||||
|
||||
SUPPORTED_DEVICES :=
|
||||
|
||||
GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga
|
||||
GRUB2_MODULES_LEGACY = $(GRUB2_MODULES)
|
||||
GRUB2_MODULES_LEGACY += part_gpt search fat exfat
|
||||
GRUB2_MODULES_EFI = boot chain configfile ext2 linux ls part_msdos reboot serial part_gpt part_msdos search fat exfat ext2 efi_gop efi_uga gfxterm
|
||||
GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga
|
||||
GRUB2_VARIANT =
|
||||
GRUB_TERMINALS =
|
||||
GRUB_SERIAL_CONFIG =
|
||||
GRUB_TERMINAL_CONFIG =
|
||||
GRUB_CONSOLE_CMDLINE =
|
||||
GRUB_ROOT = hd0,msdos1
|
||||
|
||||
USE_ATKBD = generic 64
|
||||
|
||||
ifneq ($(strip $(foreach subtarget,$(USE_ATKBD),$(CONFIG_TARGET_x86_$(subtarget)))),)
|
||||
GRUB2_MODULES += at_keyboard
|
||||
GRUB2_MODULES_ISO += at_keyboard
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_GRUB_CONSOLE),)
|
||||
GRUB_CONSOLE_CMDLINE += console=tty0
|
||||
@ -46,313 +28,124 @@ ifneq ($(GRUB_TERMINALS),)
|
||||
GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
|
||||
endif
|
||||
|
||||
SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0xFFFFFFFF))')
|
||||
EFI_SIGNATURE:=$(strip $(shell uuidgen | sed "s/[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]$$/0002/" | tr '[a-z]' '[A-Z]'))
|
||||
ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
|
||||
ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(SIGNATURE)-02)
|
||||
ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(IMG_PART_SIGNATURE)-02)
|
||||
GPT_ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
|
||||
GPT_ROOTPART:=$(if $(GPT_ROOTPART),$(GPT_ROOTPART),PARTUUID=$(shell echo $(IMG_PART_DISKGUID) | sed 's/00$$/02/'))
|
||||
|
||||
GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT))
|
||||
GRUB_TITLE:=$(call qstrip,$(CONFIG_GRUB_TITLE))
|
||||
|
||||
ifneq ($(CONFIG_TARGET_x86_xen_domu),)
|
||||
GRUB_ROOT = xen/xvda,msdos1
|
||||
endif
|
||||
BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS))
|
||||
|
||||
ifneq ($(CONFIG_GRUB_IMAGES)$(CONFIG_EFI_IMAGES),)
|
||||
|
||||
BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS))
|
||||
|
||||
define Image/cmdline/ext4
|
||||
root=$(ROOTPART) rootfstype=ext4 rootwait
|
||||
endef
|
||||
|
||||
define Image/cmdline/squashfs
|
||||
root=$(ROOTPART) rootfstype=squashfs rootwait
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_EFI_IMAGES),)
|
||||
|
||||
define Image/cmdline/efi
|
||||
$(subst $(SIGNATURE)-02,$2,$(call Image/cmdline/$(1)))
|
||||
endef
|
||||
|
||||
define Image/Build/efi
|
||||
# left here because the image builder doesnt need these
|
||||
rm -rf $(KDIR)/root.grub/ || true
|
||||
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
|
||||
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
|
||||
echo '(hd0) $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img' > $(KDIR)/grub2/device.map
|
||||
sed \
|
||||
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
|
||||
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
|
||||
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/efi,$(1),$(EFI_SIGNATURE)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
|
||||
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
|
||||
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
|
||||
-e 's#set root.*#search --file /boot/grub/$(SIGNATURE).cfg --set=root#g' \
|
||||
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
|
||||
sed \
|
||||
-e 's/(hd0,msdos1)/(hd0,gpt1)/' ./grub-early.cfg > \
|
||||
$(KDIR)/root.grub/boot/grub/grub-early.cfg
|
||||
|
||||
$(CP) $(KDIR)/root.grub/boot/grub/grub.cfg $(KDIR)/root.grub/boot/grub/$(SIGNATURE).cfg
|
||||
grub-mkimage \
|
||||
-d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
|
||||
-o $(KDIR)/grub2/core.img \
|
||||
-O i386-pc \
|
||||
-p '(hd0,gpt1)/boot/grub' \
|
||||
-c $(KDIR)/root.grub/boot/grub/grub-early.cfg \
|
||||
$(GRUB2_MODULES_LEGACY)
|
||||
$(CP) $(STAGING_DIR_HOST)/lib/grub/i386-pc/*.img $(KDIR)/grub2/
|
||||
|
||||
# Build the efi grub version
|
||||
rm -rf $(KDIR)/grub2.efi/ || true
|
||||
$(INSTALL_DIR) $(KDIR)/grub2.efi/efi/boot/
|
||||
|
||||
# Generate the grub search root config (grub will search for the $(SIGNATURE).cfg file placed on the boot partition as grub does not support search of GPT UUID yet)
|
||||
echo "search --file /boot/grub/$(SIGNATURE).cfg --set=root" > $(KDIR)/grub2.efi/efi/boot/grub.cfg
|
||||
echo "configfile /boot/grub/grub.cfg" >> $(KDIR)/grub2.efi/efi/boot/grub.cfg
|
||||
|
||||
# Create the EFI grub binary
|
||||
grub-mkimage-efi \
|
||||
-d $(STAGING_DIR_HOST)/lib/grub/x86_64-efi \
|
||||
-o $(KDIR)/grub2.efi/efi/boot/bootx64.efi \
|
||||
-O x86_64-efi \
|
||||
-p /efi/boot \
|
||||
-c $(KDIR)/grub2.efi/efi/boot/grub.cfg \
|
||||
$(GRUB2_MODULES_EFI)
|
||||
|
||||
# Generate the EFI VFAT bootfs
|
||||
rm $(KDIR)/kernel.efi || true
|
||||
mkfs.fat -C $(KDIR)/kernel.efi -S 512 1024
|
||||
mcopy -s -i "$(KDIR)/kernel.efi" $(KDIR)/grub2.efi/* ::/
|
||||
|
||||
SIGNATURE="$(SIGNATURE)" PATH="$(TARGET_PATH)" ./gen_image_efi.sh \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img \
|
||||
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
|
||||
1 $(KDIR)/kernel.efi \
|
||||
1 \
|
||||
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \
|
||||
define Build/combined
|
||||
$(CP) $(KDIR)/$(KERNEL_NAME) $@.boot/boot/vmlinuz
|
||||
-$(CP) $(STAGING_DIR_ROOT)/boot/. $@.boot/boot/
|
||||
$(CP) $(STAGING_DIR_IMAGE)/grub2/boot.img $@.boot/boot/grub/
|
||||
$(CP) $(STAGING_DIR_IMAGE)/grub2/$(if $(filter $(1),efi),gpt,$(GRUB2_VARIANT))-core.img \
|
||||
$@.boot/boot/grub/core.img
|
||||
$(if $(filter $(1),efi),
|
||||
$(INSTALL_DIR) $@.boot/efi/boot
|
||||
$(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi $@.boot/efi/boot/
|
||||
)
|
||||
PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \
|
||||
$(if $(filter $(1),efi),GUID="$(IMG_PART_DISKGUID)") $(SCRIPT_DIR)/gen_image_generic.sh \
|
||||
$@ \
|
||||
$(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
|
||||
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
|
||||
256
|
||||
|
||||
# Setup legacy bios for hybrid MBR (optional)
|
||||
grub-bios-setup \
|
||||
--device-map="$(KDIR)/grub2/device.map" \
|
||||
-d "$(KDIR)/grub2" \
|
||||
-r "hd0,msdos1" \
|
||||
"$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img"
|
||||
|
||||
# Convert the MBR partition to GPT and set EFI ROOTFS signature
|
||||
dd if=/dev/zero of="$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img" bs=512 count=34 conv=notrunc oflag=append
|
||||
sgdisk -g "$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img"
|
||||
sgdisk -t 2:EF00 "$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img"
|
||||
sgdisk -t 3:EF02 "$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img"
|
||||
sgdisk -u 4:$(EFI_SIGNATURE) "$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img"
|
||||
sgdisk -h "$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img"
|
||||
|
||||
# Setup EFI grub
|
||||
grub-bios-setup-efi \
|
||||
--device-map="$(KDIR)/grub2/device.map" \
|
||||
-d "$(KDIR)/grub2" \
|
||||
-r "hd0,gpt1" \
|
||||
"$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img"
|
||||
endef
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_GRUB_IMAGES),)
|
||||
define Image/Build/grub2
|
||||
# left here because the image builder doesnt need these
|
||||
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
|
||||
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
|
||||
grub-mkimage \
|
||||
-p /boot/grub \
|
||||
-d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
|
||||
-o $(KDIR)/grub2/core.img \
|
||||
-O i386-pc \
|
||||
-c ./grub-early.cfg \
|
||||
$(GRUB2_MODULES)
|
||||
$(CP) $(STAGING_DIR_HOST)/lib/grub/i386-pc/*.img $(KDIR)/grub2/
|
||||
echo '(hd0) $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img' > $(KDIR)/grub2/device.map
|
||||
sed \
|
||||
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
|
||||
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
|
||||
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
|
||||
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
|
||||
-e 's#@ROOT@#$(GRUB_ROOT)#g' \
|
||||
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
|
||||
./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
|
||||
-$(CP) $(STAGING_DIR_ROOT)/boot/. $(KDIR)/root.grub/boot/
|
||||
PADDING="$(CONFIG_TARGET_IMAGES_PAD)" SIGNATURE="$(SIGNATURE)" PATH="$(TARGET_PATH)" $(SCRIPT_DIR)/gen_image_generic.sh \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
|
||||
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
|
||||
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \
|
||||
256
|
||||
grub-bios-setup \
|
||||
--device-map="$(KDIR)/grub2/device.map" \
|
||||
-d "$(KDIR)/grub2" \
|
||||
-r "hd0,msdos1" \
|
||||
"$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img"
|
||||
endef
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
define Image/Build/squashfs
|
||||
dd if=/dev/zero bs=128k count=1 >> $(KDIR)/root.squashfs
|
||||
endef
|
||||
|
||||
define Image/Build/iso
|
||||
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
|
||||
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
|
||||
grub-mkimage \
|
||||
-p /boot/grub \
|
||||
-d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
|
||||
-o $(KDIR)/grub2/eltorito.img \
|
||||
-O i386-pc \
|
||||
-c ./grub-early.cfg \
|
||||
$(GRUB2_MODULES_ISO)
|
||||
define Build/grub-config
|
||||
rm -fR $@.boot
|
||||
$(INSTALL_DIR) $@.boot/boot/grub
|
||||
sed \
|
||||
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
|
||||
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
|
||||
-e 's#@ROOTPART@#root=$(ROOTPART) rootwait#g' \
|
||||
-e 's#@GPT_ROOTPART@#root=$(GPT_ROOTPART) rootwait#g' \
|
||||
-e 's#@CMDLINE@#$(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE)#g' \
|
||||
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
|
||||
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
|
||||
./grub-$(1).cfg > $@.boot/boot/grub/grub.cfg
|
||||
endef
|
||||
|
||||
define Build/grub-install
|
||||
rm -fR $@.grub2
|
||||
$(INSTALL_DIR) $@.grub2
|
||||
$(CP) $(STAGING_DIR_IMAGE)/grub2/boot.img $@.grub2/
|
||||
$(CP) $(STAGING_DIR_IMAGE)/grub2/$(if $(filter $(1),efi),gpt,$(GRUB2_VARIANT))-core.img $@.grub2/core.img
|
||||
echo '(hd0) $@' > $@.grub2/device.map
|
||||
$(STAGING_DIR_HOST)/bin/grub-bios-setup \
|
||||
-m "$@.grub2/device.map" \
|
||||
-d "$@.grub2" \
|
||||
-r "hd0,$(if $(filter $(1),efi),gpt1,msdos1)" \
|
||||
$@
|
||||
endef
|
||||
|
||||
define Build/iso
|
||||
$(CP) $(KDIR)/$(KERNEL_NAME) $@.boot/boot/vmlinuz
|
||||
cat \
|
||||
$(STAGING_DIR_HOST)/lib/grub/i386-pc/cdboot.img \
|
||||
$(KDIR)/grub2/eltorito.img \
|
||||
> $(KDIR)/root.grub/boot/grub/eltorito.img
|
||||
sed \
|
||||
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
|
||||
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
|
||||
-e 's#@CMDLINE@#root=/dev/sr0 rootfstype=iso9660 rootwait $(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
|
||||
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
|
||||
-e 's#@TITLE@#$(GRUB_TITLE)#g' \
|
||||
./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
|
||||
-$(CP) $(STAGING_DIR_ROOT)/boot/. $(KDIR)/root.grub/boot/
|
||||
$(STAGING_DIR_IMAGE)/grub2/cdboot.img \
|
||||
$(STAGING_DIR_IMAGE)/grub2/eltorito.img \
|
||||
> $@.boot/boot/grub/eltorito.img
|
||||
-$(CP) $(STAGING_DIR_ROOT)/boot/. $@.boot/boot/
|
||||
$(if $(filter $(1),efi),
|
||||
mkfs.fat -C $@.boot/boot/grub/isoboot.img -S 512 1440
|
||||
mmd -i $@.boot/boot/grub/isoboot.img ::/efi ::/efi/boot
|
||||
mcopy -i $@.boot/boot/grub/isoboot.img \
|
||||
$(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \
|
||||
::/efi/boot/boot$(if $(CONFIG_x86_64),x64,ia32).efi
|
||||
)
|
||||
mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
|
||||
-o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
|
||||
$(if $(filter $(1),efi),-boot-load-size 4 -c boot.cat -eltorito-alt-boot -b boot/grub/isoboot.img -no-emul-boot) \
|
||||
-o $@ $@.boot $(TARGET_DIR)
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_VDI_IMAGES),)
|
||||
define Image/Build/vdi
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vdi || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -f raw -O vdi \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vdi
|
||||
# XXX: VBoxManage insists on setting perms to 0600
|
||||
chmod 0644 $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vdi
|
||||
endef
|
||||
define Image/Build/vdi_efi
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vdi || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -f raw -O vdi \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vdi
|
||||
# XXX: VBoxManage insists on setting perms to 0600
|
||||
chmod 0644 $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vdi
|
||||
endef
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_VMDK_IMAGES),)
|
||||
define Image/Build/vmdk
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vmdk || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -f raw -O vmdk -o adapter_type=lsilogic \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vmdk
|
||||
#build the ESXI VMDK with
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1)-esxi.vmdk || true
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1)-esxi-flat.vmdk || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -f raw -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1)-esxi.vmdk
|
||||
endef
|
||||
define Image/Build/vmdk_efi
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vmdk || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -f raw -O vmdk -o adapter_type=lsilogic \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vmdk
|
||||
endef
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_VHD_IMAGES),)
|
||||
define Image/Build/vhd
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vhdx || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -O vhdx \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vhdx
|
||||
endef
|
||||
define Image/Build/vhd_efi
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vhdx || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -O vhdx \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vhdx
|
||||
endef
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_QCOW2_IMAGES),)
|
||||
define Image/Build/qcow2
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).qcow2 || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -f raw -O qcow2 \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).qcow2
|
||||
endef
|
||||
define Image/Build/qcow2_efi
|
||||
rm $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).qcow2 || true
|
||||
$(STAGING_DIR_HOST)/bin/qemu-img convert -f raw -O qcow2 \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).qcow2
|
||||
endef
|
||||
endif
|
||||
|
||||
define Image/Build/gzip
|
||||
gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
|
||||
ifneq ($(CONFIG_GRUB_IMAGES),)
|
||||
gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img
|
||||
endif
|
||||
ifneq ($(CONFIG_EFI_IMAGES),)
|
||||
gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img
|
||||
endif
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
|
||||
define Image/Build/gzip/ext4
|
||||
$(call Image/Build/gzip,ext4)
|
||||
endef
|
||||
define Image/Build/gzip/squashfs
|
||||
$(call Image/Build/gzip,squashfs)
|
||||
endef
|
||||
endif
|
||||
|
||||
define Image/BuildKernel
|
||||
$(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-vmlinuz
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
$(call Image/Prepare/grub2)
|
||||
endef
|
||||
|
||||
define Image/Build/Initramfs
|
||||
$(CP) $(KDIR)/bzImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-ramfs.bzImage
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
$(call Image/Build/$(1))
|
||||
ifneq ($(1),iso)
|
||||
$(call Image/Build/grub2,$(1))
|
||||
$(call Image/Build/efi,$(1))
|
||||
ifneq ($(CONFIG_GRUB_IMAGES),)
|
||||
$(call Image/Build/vdi,$(1))
|
||||
$(call Image/Build/vmdk,$(1))
|
||||
$(call Image/Build/vhd,$(1))
|
||||
$(call Image/Build/qcow2,$(1))
|
||||
endif
|
||||
ifneq ($(CONFIG_EFI_IMAGES),)
|
||||
$(call Image/Build/vdi_efi,$(1))
|
||||
$(call Image/Build/vmdk_efi,$(1))
|
||||
$(call Image/Build/vhd_efi,$(1))
|
||||
$(call Image/Build/qcow2_efi,$(1))
|
||||
endif
|
||||
$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
|
||||
DEVICE_VARS += GRUB2_VARIANT
|
||||
define Device/Default
|
||||
ARTIFACT/image.iso := grub-config iso | iso
|
||||
IMAGE/combined.img := grub-config pc | combined | grub-install | append-metadata
|
||||
IMAGE/combined.img.gz := grub-config pc | combined | grub-install | gzip | append-metadata
|
||||
IMAGE/combined.vdi := grub-config pc | combined | grub-install | qemu-image vdi
|
||||
IMAGE/combined.vmdk := grub-config pc | combined | grub-install | qemu-image vmdk
|
||||
IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE)
|
||||
IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip
|
||||
ARTIFACT/image-efi.iso := grub-config iso | iso efi
|
||||
IMAGE/combined-efi.img := grub-config efi | combined efi | grub-install efi | append-metadata
|
||||
IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata
|
||||
IMAGE/combined-efi.vdi := grub-config efi | combined efi | grub-install efi | qemu-image vdi
|
||||
IMAGE/combined-efi.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk
|
||||
ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y)
|
||||
IMAGES-y := rootfs.img.gz
|
||||
IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.img.gz
|
||||
IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.img.gz
|
||||
else
|
||||
$(CP) $(KDIR)/root.iso $(BIN_DIR)/$(IMG_PREFIX).iso
|
||||
IMAGES-y := rootfs.img
|
||||
IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.img
|
||||
IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.img
|
||||
endif
|
||||
$(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-vmlinuz
|
||||
$(call Image/Build/gzip/$(1))
|
||||
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
||||
$(call Image/Build/Initramfs)
|
||||
endif
|
||||
KERNEL := kernel-bin
|
||||
KERNEL_INSTALL := 1
|
||||
KERNEL_NAME := bzImage
|
||||
ifeq ($(CONFIG_ISO_IMAGES),y)
|
||||
ARTIFACTS-$$(CONFIG_GRUB_IMAGES) += image.iso
|
||||
ARTIFACTS-$$(CONFIG_GRUB_EFI_IMAGES) += image-efi.iso
|
||||
endif
|
||||
ifeq ($(CONFIG_VDI_IMAGES),y)
|
||||
IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vdi
|
||||
IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vdi
|
||||
endif
|
||||
ifeq ($(CONFIG_VMDK_IMAGES),y)
|
||||
IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vmdk
|
||||
IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vmdk
|
||||
endif
|
||||
IMAGES := $$(IMAGES-y)
|
||||
ARTIFACTS := $$(ARTIFACTS-y)
|
||||
SUPPORTED_DEVICES :=
|
||||
endef
|
||||
|
||||
include $(SUBTARGET).mk
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
[ $# == 8 -o $# == 9 ] || {
|
||||
echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <efi size> <efi image> <efigrubmodule size> <rootfs size> <rootfs image> [<align>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
OUTPUT="$1"
|
||||
KERNELSIZE="$2"
|
||||
KERNELDIR="$3"
|
||||
EFISIZE="$4"
|
||||
EFIIMAGE="$5"
|
||||
EFIGRUBSIZE="$6"
|
||||
ROOTFSSIZE="$7"
|
||||
ROOTFSIMAGE="$8"
|
||||
ALIGN="$9"
|
||||
|
||||
rm -f "$OUTPUT"
|
||||
|
||||
head=16
|
||||
sect=63
|
||||
cyl=$(( ($KERNELSIZE + $EFISIZE + $EFIGRUBSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512) ))
|
||||
|
||||
# create partition table
|
||||
set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${EFISIZE}m -p ${EFIGRUBSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE}`
|
||||
|
||||
KERNELOFFSET="$(($1 / 512))"
|
||||
KERNELSIZE="$2"
|
||||
EFIOFFSET="$(($3 / 512))"
|
||||
EFISIZE="$(($4 / 512))"
|
||||
EFIGRUBOFFSET="$(($5 / 512))"
|
||||
EFIGRUBSIZE="$(($6 / 512))"
|
||||
ROOTFSOFFSET="$(($7 / 512))"
|
||||
ROOTFSSIZE="$(($8 / 512))"
|
||||
|
||||
dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE"
|
||||
dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
|
||||
dd if="$EFIIMAGE" of="$OUTPUT" bs=512 seek="$EFIOFFSET" conv=notrunc
|
||||
|
||||
[ -n "$NOGRUB" ] && exit 0
|
||||
|
||||
make_ext4fs -J -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR"
|
||||
dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc
|
||||
rm -f "$OUTPUT.kernel"
|
||||
8
target/linux/x86/image/generic.mk
Normal file
8
target/linux/x86/image/generic.mk
Normal file
@ -0,0 +1,8 @@
|
||||
define Device/generic
|
||||
DEVICE_TITLE := Generic x86
|
||||
DEVICE_PACKAGES += kmod-3c59x kmod-8139too kmod-e100 kmod-e1000 kmod-natsemi \
|
||||
kmod-ne2k-pci kmod-pcnet32 kmod-r8169 kmod-sis900 kmod-tg3 \
|
||||
kmod-via-rhine kmod-via-velocity kmod-forcedeth
|
||||
GRUB2_VARIANT := generic
|
||||
endef
|
||||
TARGET_DEVICES += generic
|
||||
14
target/linux/x86/image/geode.mk
Normal file
14
target/linux/x86/image/geode.mk
Normal file
@ -0,0 +1,14 @@
|
||||
define Device/generic
|
||||
DEVICE_TITLE := Generic x86/Geode
|
||||
DEVICE_PACKAGES += kmod-crypto-cbc kmod-crypto-hw-geode kmod-ledtrig-gpio
|
||||
GRUB2_VARIANT := legacy
|
||||
endef
|
||||
TARGET_DEVICES += generic
|
||||
|
||||
define Device/geos
|
||||
$(call Device/generic)
|
||||
DEVICE_TITLE := Traverse Technologies Geos
|
||||
DEVICE_PACKAGES += br2684ctl flashrom kmod-hwmon-lm90 kmod-mppe kmod-pppoa \
|
||||
kmod-usb-ohci-pci linux-atm ppp-mod-pppoa pppdump pppstats soloscli tc
|
||||
endef
|
||||
TARGET_DEVICES += geos
|
||||
@ -1 +0,0 @@
|
||||
configfile (hd0,msdos1)/boot/grub/grub.cfg
|
||||
13
target/linux/x86/image/grub-efi.cfg
Normal file
13
target/linux/x86/image/grub-efi.cfg
Normal file
@ -0,0 +1,13 @@
|
||||
@SERIAL_CONFIG@
|
||||
@TERMINAL_CONFIG@
|
||||
|
||||
set default="0"
|
||||
set timeout="@TIMEOUT@"
|
||||
set root='(hd0,gpt1)'
|
||||
|
||||
menuentry "@TITLE@" {
|
||||
linux /boot/vmlinuz @GPT_ROOTPART@ @CMDLINE@ noinitrd
|
||||
}
|
||||
menuentry "@TITLE@ (failsafe)" {
|
||||
linux /boot/vmlinuz failsafe=true @GPT_ROOTPART@ @CMDLINE@ noinitrd
|
||||
}
|
||||
@ -3,8 +3,13 @@
|
||||
|
||||
set default="0"
|
||||
set timeout="@TIMEOUT@"
|
||||
set root='(cd)'
|
||||
|
||||
if [ "${grub_platform}" = "efi" ]; then
|
||||
set root='(cd0)'
|
||||
else
|
||||
set root='(cd)'
|
||||
fi
|
||||
|
||||
menuentry "@TITLE@" {
|
||||
linux /boot/vmlinuz @CMDLINE@ noinitrd
|
||||
linux /boot/vmlinuz root=/dev/sr0 rootfstype=iso9660 rootwait @CMDLINE@ noinitrd
|
||||
}
|
||||
|
||||
13
target/linux/x86/image/grub-pc.cfg
Normal file
13
target/linux/x86/image/grub-pc.cfg
Normal file
@ -0,0 +1,13 @@
|
||||
@SERIAL_CONFIG@
|
||||
@TERMINAL_CONFIG@
|
||||
|
||||
set default="0"
|
||||
set timeout="@TIMEOUT@"
|
||||
set root='(hd0,msdos1)'
|
||||
|
||||
menuentry "@TITLE@" {
|
||||
linux /boot/vmlinuz @ROOTPART@ @CMDLINE@ noinitrd
|
||||
}
|
||||
menuentry "@TITLE@ (failsafe)" {
|
||||
linux /boot/vmlinuz failsafe=true @ROOTPART@ @CMDLINE@ noinitrd
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
@SERIAL_CONFIG@
|
||||
@TERMINAL_CONFIG@
|
||||
|
||||
set default="0"
|
||||
set timeout="@TIMEOUT@"
|
||||
set root='(@ROOT@)'
|
||||
|
||||
menuentry "@TITLE@" {
|
||||
linux /boot/vmlinuz @CMDLINE@ noinitrd
|
||||
}
|
||||
menuentry "@TITLE@ (failsafe)" {
|
||||
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
|
||||
}
|
||||
8
target/linux/x86/image/legacy.mk
Normal file
8
target/linux/x86/image/legacy.mk
Normal file
@ -0,0 +1,8 @@
|
||||
define Device/generic
|
||||
DEVICE_TITLE := Generic x86/legacy
|
||||
DEVICE_PACKAGES += kmod-3c59x kmod-8139too kmod-e100 kmod-e1000 \
|
||||
kmod-natsemi kmod-ne2k-pci kmod-pcnet32 kmod-r8169 kmod-sis900 \
|
||||
kmod-tg3 kmod-via-rhine kmod-via-velocity kmod-forcedeth
|
||||
GRUB2_VARIANT := legacy
|
||||
endef
|
||||
TARGET_DEVICES += generic
|
||||
5
target/linux/x86/image/zen.mk
Normal file
5
target/linux/x86/image/zen.mk
Normal file
@ -0,0 +1,5 @@
|
||||
define Device/generic
|
||||
DEVICE_TITLE := Generic Zen Architecture
|
||||
GRUB2_VARIANT := generic
|
||||
endef
|
||||
TARGET_DEVICES += generic
|
||||
@ -1,18 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/Generic
|
||||
NAME:=Generic
|
||||
PACKAGES:=kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi kmod-ne2k-pci \
|
||||
kmod-pcnet32 kmod-8139too kmod-r8169 kmod-sis900 kmod-tg3 \
|
||||
kmod-via-rhine kmod-via-velocity
|
||||
endef
|
||||
|
||||
define Profile/Generic/Description
|
||||
Generic Profile
|
||||
endef
|
||||
$(eval $(call Profile,Generic))
|
||||
@ -1,15 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/Generic
|
||||
NAME:=Generic
|
||||
endef
|
||||
|
||||
define Profile/Generic/Description
|
||||
Generic Profile
|
||||
endef
|
||||
$(eval $(call Profile,Generic))
|
||||
Loading…
Reference in New Issue
Block a user