Skip to content

Instantly share code, notes, and snippets.

@TruDan
Created April 4, 2022 09:29
Show Gist options
  • Save TruDan/5969865561e6c32b4ed51605e3c58b37 to your computer and use it in GitHub Desktop.
Save TruDan/5969865561e6c32b4ed51605e3c58b37 to your computer and use it in GitHub Desktop.
(Note: Subdirectories indicated using `~` as GitHub Gist does not allow `/` in filenames) WAGO-firmware-sdk custom build for hero, goal: 3rd partition on SD card with pre-installed files from `/hero_src/hero/` (startup scripts/custom package omitted as it is irrelevant+confidential)
## SECTION=image2
config IMAGE_HERO_TGZ
tristate
prompt "Generate images/hero.tgz"
help
FIXME
config IMAGE_HEROSD
tristate
select HOST_GENIMAGE
select IMAGE_BOOT_VFAT
select IMAGE_ROOT_EXT
select IMAGE_HERO_TGZ
prompt "Generate images/herosd.hdimg"
help
FIXME
# -*-makefile-*-
#
# Copyright (C) 2012 by Jan Luebbe <jlu@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#
#
# We provide this package
#
IMAGE_PACKAGES-$(PTXCONF_IMAGE_HEROSD) += image-herosd
#
# Paths and names
#
IMAGE_HEROSD := image-herosd
IMAGE_HEROSD_DIR := $(BUILDDIR)/$(IMAGE_HEROSD)
IMAGE_HEROSD_IMAGE := $(IMAGEDIR)/herosd.hdimg
IMAGE_HEROSD_FILES := $(IMAGEDIR)/root.tgz
IMAGE_HEROSD_CONFIG := herosd.config
# ----------------------------------------------------------------------------
# Image
# ----------------------------------------------------------------------------
$(IMAGE_HEROSD_IMAGE):
@$(call targetinfo)
@$(call image/genimage, IMAGE_HEROSD)
@$(call finish)
# vim: syntax=make
image @IMAGE@ {
hdimage {
align = 8M
}
size = 1G
partition boot {
image = boot.vfat
partition-type = 0x0C
bootable = true
}
partition root {
image = root.ext2
partition-type = 0x83
size = 150M
}
partition hero {
image = hero.tgz
partition-type = 0x83
size = 400M
}
}
image hero.tgz {
file { }
mountpoint = "/hero"
}
# -*-makefile-*-
#
# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# For further information about the PTXdist project and license conditions
# see the README file.
#
#
# We provide this package
#
IMAGE_PACKAGES-$(PTXCONF_IMAGE_HERO_TGZ) += image-hero-tgz
#
# Paths and names
#
IMAGE_HERO_TGZ := image-hero-tgz
IMAGE_HERO_TGZ_DIR := $(BUILDDIR)/$(IMAGE_HERO_TGZ)
IMAGE_HERO_TGZ_SRC_DIR := $(PTXDIST_WORKSPACE)/hero_src/hero
IMAGE_HERO_TGZ_IMAGE := $(IMAGEDIR)/hero.tgz
IMAGE_HERO_TGZ_LABEL := $(call remove_quotes, $(PTXCONF_IMAGE_HERO_TGZ_LABEL))
LOCAL_TEMPDIR = $(PTXDIST_TEMPDIR)/$(notdir $@)
IMAGE_HERO_TMP_DIR = $(LOCAL_TEMPDIR)/hero
# ----------------------------------------------------------------------------
# Image
# ----------------------------------------------------------------------------
ifdef PTXCONF_IMAGE_HERO_TGZ
$(IMAGE_HERO_TGZ_IMAGE):
@$(call targetinfo)
@mkdir -p $(IMAGE_HERO_TMP_DIR)
@mkdir -p $(IMAGE_HERO_TGZ_DIR)
# 2. copy hero partition files
@cp -r $(IMAGE_HERO_TGZ_SRC_DIR)/* $(IMAGE_HERO_TMP_DIR)/
# 5. finally generate the archive
@cd $(LOCAL_TEMPDIR) && \
tar cfz $(notdir $@) hero/
@cp $(LOCAL_TEMPDIR)/$(notdir $@) $(IMAGEDIR)
@rm -rf $(IMAGE_HERO_TMP_DIR)
@$(call finish)
endif
# vim: syntax=make
## SECTION=wago_specific
config IMAGE_ROOT_SIZE
string
prompt "image root size"
default 150M
help
will set PTXCONF_IMAGE_ROOT_EXT_SIZE
config IMAGE_HERO_SIZE
string
prompt "image hero size"
default 400M
help
will set PTXCONF_IMAGE_HERO_EXT_SIZE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment