Skip to content
Snippets Groups Projects
Commit 7f806d7c authored by Christopher Spinrath's avatar Christopher Spinrath
Browse files

image: split image_skel_file

image_skel_file will now create a partition image (with FAT fs)
while the new image_assemble target will create a proper device
image from this partition (in particular, it adds a partition table).

This allows us to mount the partition and deploy the finished
image to a custom location in the end.
parent 1fb9d23c
No related branches found
No related tags found
No related merge requests found
...@@ -69,6 +69,8 @@ ISO_IMAGE=$(ISO_IMAGE_DEST)/image.iso ...@@ -69,6 +69,8 @@ ISO_IMAGE=$(ISO_IMAGE_DEST)/image.iso
ISO_URL=$(ISO_BASE_URL)/$(ISO_RELEASE)/$(ISO_CHANNEL) ISO_URL=$(ISO_BASE_URL)/$(ISO_RELEASE)/$(ISO_CHANNEL)
ISO_CONTENT=$(ISO_IMAGE_DEST)/content ISO_CONTENT=$(ISO_IMAGE_DEST)/content
IMAGE_PART_FILE=$(WORKSPACE)/image.img.part
ifneq (,$(findstring release-prefix,$(ISO_PATTERN_FLAGS))) ifneq (,$(findstring release-prefix,$(ISO_PATTERN_FLAGS)))
ISO_PREFIX=$(ISO_RELEASE)- ISO_PREFIX=$(ISO_RELEASE)-
else else
...@@ -374,17 +376,23 @@ image_content: image_git_pull $(IMAGE_DIR)/.remastered $(IMAGE_DIR)/grub/lipinfo ...@@ -374,17 +376,23 @@ image_content: image_git_pull $(IMAGE_DIR)/.remastered $(IMAGE_DIR)/grub/lipinfo
@echo @echo
@echo "Image content is ready: $(IMAGE_DIR)" @echo "Image content is ready: $(IMAGE_DIR)"
image_skel_file: | $(WORKSPACE) image_skel_file: $(IMAGE_PART_FILE)
truncate -s "$(IMAGE_PART_SIZE)" "$(IMAGE_FILE)".part $(IMAGE_PART_FILE):
mkfs.vfat -n "$(IMAGE_PART_LABEL)" "$(IMAGE_FILE)".part truncate -s "$(IMAGE_PART_SIZE)" "$@"
ddrescue --output-position=2048 --sparse "$(IMAGE_FILE)".part "$(IMAGE_FILE)" mkfs.vfat -n "$(IMAGE_PART_LABEL)" "$@"
@echo
@echo "Image partition skeleton is ready: $@"
image_assemble: $(IMAGE_FILE)
$(IMAGE_FILE): $(IMAGE_PART_FILE)
ddrescue --output-position=2048 --sparse "$(IMAGE_PART_FILE)" "$@"
#sfdisk: start, as large as possible, FAT, bootable #sfdisk: start, as large as possible, FAT, bootable
echo -e "label: dos\nunit: sectors\n2048,+,b,*"\ echo -e "label: dos\nunit: sectors\n2048,+,b,*"\
| sfdisk "$(IMAGE_FILE)" | sfdisk "$@"
@echo @echo
@echo "Image skeleton is ready: $(IMAGE_FILE)" @echo "Image is ready: $@"
@echo "You may want to mount appropriately (e.g. with kpartx) to $(IMAGE_DIR) and execute \"make image\""
image_grub_lipinfo : $(IMAGE_DIR)/grub/lipinfo.cfg image_grub_lipinfo : $(IMAGE_DIR)/grub/lipinfo.cfg
$(IMAGE_DIR)/grub/lipinfo.cfg : | $(WORKSPACE) $(IMAGE_DIR)/grub/lipinfo.cfg : | $(WORKSPACE)
...@@ -503,7 +511,7 @@ ROOTFS_PHONY=rootfs_unsquash rootfs_prepare rootfs_remaster rootfs_finalize root ...@@ -503,7 +511,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 INITRD_PHONY=initrd_unpack initrd_remaster initrd_pack initrd_clean initrd_clean_both
APT_CACHE_PHONY=apt_cache apt_cache_clean APT_CACHE_PHONY=apt_cache apt_cache_clean
REPO_PHONY=repo repo_packages repo_package_info repo_metadata repo_clean REPO_PHONY=repo repo_packages repo_package_info repo_metadata repo_clean
IMAGE_PHONY=image image_content image_skel_file image_remaster image_git image_git_pull image_binary_files image_grub_lipinfo IMAGE_PHONY=image image_content image_skel_file image_assemble image_remaster image_git image_git_pull image_binary_files image_grub_lipinfo
COMMON_PHONY=help workspace config config_clean clean_really_all 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) .PHONY : default $(COMMON_PHONY) $(ISO_PHONY) $(ROOTFS_PHONY) $(INITRD_PHONY) $(APT_CACHE_PHONY) $(IMAGE_PHONY) $(REPO_PHONY)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment