Commit f9c4c8d2 authored by Christopher Spinrath's avatar Christopher Spinrath
Browse files

image: introduce image_grub_install target to install grub modules

parent 905e3dfd
......@@ -71,6 +71,11 @@ ISO_CONTENT=$(ISO_IMAGE_DEST)/content
IMAGE_PART_FILE=$(WORKSPACE)/image.img.part
GRUB_ASSEMBLE_DIR=$(WORKSPACE)/grub
#GRUB_INSTALL_DIR is passed to grub mbr, so it has to be relative!
#Moreover, it has to be kept in sync with /contrib/image/grub_early.cfg
#and should not conflict with the secure boot grub shipped with the iso
#(usually /boot/grub)
GRUB_INSTALL_DIR=/grub
ifneq (,$(findstring release-prefix,$(ISO_PATTERN_FLAGS)))
ISO_PREFIX=$(ISO_RELEASE)-
......@@ -367,7 +372,7 @@ image_binary_files $(IMAGE_DIR)/.lipbinaries: image_git_pull $(IMAGE_BINARIES)
$(RSYNC) --progress "$(SECONDARY_ARCH_DIR)/gparted-live.iso" "$(IMAGE_DIR)/gparted-live-$(SECONDARY_ARCH).iso"
cd "$(PRIMARY_ARCH_DIR)$(ROOTFS)" && $(RSYNC) -L vmlinuz "$(IMAGE_DIR)/casper/vmlinuz-$(PRIMARY_ARCH)"
cd "$(SECONDARY_ARCH_DIR)$(ROOTFS)" && $(RSYNC) -L vmlinuz "$(IMAGE_DIR)/casper/vmlinuz-$(SECONDARY_ARCH)"
mkdir -p "$(IMAGE_DIR)/boot/grub/"
mkdir -p "$(IMAGE_DIR)/boot/grub/" #note: this must not be $$(GRUB_INSTALL_DIR)!
$(RSYNC) "$(PRIMARY_ARCH_DIR)$(ISO_CONTENT)/boot/grub/x86_64-efi" \
"$(IMAGE_DIR)/boot/grub/"
touch "$(IMAGE_DIR)/.lipbinaries"
......@@ -376,7 +381,7 @@ image_remaster $(IMAGE_DIR)/.remastered: $(IMAGE_DIR)/.lipbinaries
$(call patch_all,$(CURDIR)/patches/iso/,$(IMAGE_DIR))
touch "$(IMAGE_DIR)/.remastered"
image_content: image_git_pull $(IMAGE_DIR)/.remastered $(IMAGE_DIR)/grub/lipinfo.cfg
image_content: image_git_pull $(IMAGE_DIR)/.remastered $(IMAGE_DIR)$(GRUB_INSTALL_DIR)/lipinfo.cfg
@echo
@echo "Image content is ready: $(IMAGE_DIR)"
......@@ -398,7 +403,7 @@ $(GRUB_ASSEMBLE_DIR)/grub.x86_64-efi $(GRUB_ASSEMBLE_DIR)/grub.i386-efi : $(GRUB
image_grub_mkimage_mbr: $(GRUB_ASSEMBLE_DIR)/grub.i386-pc
$(GRUB_ASSEMBLE_DIR)/grub.i386-pc : | $(WORKSPACE)
mkdir -p "$(GRUB_ASSEMBLE_DIR)"
grub-mkimage --prefix "(hd0,msdos1)/grub" \
grub-mkimage --prefix "(hd0,msdos1)$(GRUB_INSTALL_DIR)" \
--output "$@" --format "i386-pc" \
$(IMAGE_GRUB_MBR_MODULES)
......@@ -407,6 +412,15 @@ $(GRUB_ASSEMBLE_DIR)/mbr.img : $(GRUB_ASSEMBLE_DIR)/grub.i386-pc
dd if=/usr/lib/grub/i386-pc/boot.img of="$@" bs=446 count=1
dd if="$(GRUB_ASSEMBLE_DIR)/grub.i386-pc" of="$@" bs=512 seek=1
image_grub_install:
mkdir -p "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)"
$(RSYNC) "/usr/lib/grub/x86_64-efi" "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)/"
$(RSYNC) "/usr/lib/grub/i386-efi" "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)/"
$(RSYNC) "/usr/lib/grub/i386-pc" "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)/"
$(RSYNC) "/usr/share/grub/themes" "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)/"
mkdir -p "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)/fonts"
$(RSYNC) "/usr/share/grub/unicode.pf2" "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)/fonts/"
image_assemble: $(IMAGE_FILE)
$(IMAGE_FILE): $(IMAGE_PART_FILE) $(GRUB_ASSEMBLE_DIR)/mbr.img
cp "$(GRUB_ASSEMBLE_DIR)/mbr.img" "$@"
......@@ -423,14 +437,14 @@ image_clean:
$(RM) -r "$(GRUB_ASSEMBLE_DIR)"
image_grub_lipinfo : $(IMAGE_DIR)/grub/lipinfo.cfg
$(IMAGE_DIR)/grub/lipinfo.cfg : | $(WORKSPACE)
mkdir -p $(IMAGE_DIR)/grub/
echo "#This file was generated by lipck." > $(IMAGE_DIR)/grub/lipinfo.cfg
echo "#Feel free to edit it." >> $(IMAGE_DIR)/grub/lipinfo.cfg
echo "set lip_flavor=\"$$(echo "$(ISO_FLAVOR)" | sed "s/\(.\)\(.*\)/\u\1\2/")\"" >> $(IMAGE_DIR)/grub/lipinfo.cfg
echo "set lip_version=\"$(ISO_VERSION)\"" >> $(IMAGE_DIR)/grub/lipinfo.cfg
echo "set lip_release=\"$(ISO_RELEASE)\"" >> $(IMAGE_DIR)/grub/lipinfo.cfg
echo "set lip_extra_info=\"$(IMAGE_EXTRA_INFO)\"" >> $(IMAGE_DIR)/grub/lipinfo.cfg
$(IMAGE_DIR)$(GRUB_INSTALL_DIR)/lipinfo.cfg : | $(WORKSPACE)
mkdir -p "$(IMAGE_DIR)$(GRUB_INSTALL_DIR)"
echo "#This file was generated by lipck." > "$@"
echo "#Feel free to edit it." >> "$@"
echo "set lip_flavor=\"$$(echo "$(ISO_FLAVOR)" | sed "s/\(.\)\(.*\)/\u\1\2/")\"" >> "$@"
echo "set lip_version=\"$(ISO_VERSION)\"" >> "$@"
echo "set lip_release=\"$(ISO_RELEASE)\"" >> "$@"
echo "set lip_extra_info=\"$(IMAGE_EXTRA_INFO)\"" >> "$@"
image : image_content
......@@ -539,7 +553,7 @@ ROOTFS_PHONY=rootfs_unsquash rootfs_prepare rootfs_remaster rootfs_finalize root
INITRD_PHONY=initrd_unpack initrd_remaster initrd_pack initrd_clean initrd_clean_both
APT_CACHE_PHONY=apt_cache apt_cache_clean
REPO_PHONY=repo repo_packages repo_package_info repo_metadata repo_clean
IMAGE_PHONY=image image_content image_skel_file image_assemble image_remaster image_git image_git_pull image_binary_files image_grub_lipinfo image_grub_mkimage_efi image_grub_mkimage_mbr image_grub_mbr_template image_clean
IMAGE_PHONY=image image_content image_skel_file image_assemble image_remaster image_git image_git_pull image_binary_files image_grub_lipinfo image_grub_mkimage_efi image_grub_mkimage_mbr image_grub_mbr_template image_grub_install image_clean
COMMON_PHONY=help workspace config config_clean clean_really_all
.PHONY : default $(COMMON_PHONY) $(ISO_PHONY) $(ROOTFS_PHONY) $(INITRD_PHONY) $(APT_CACHE_PHONY) $(IMAGE_PHONY) $(REPO_PHONY)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment