2020-10-20 22:26:28 +01:00
|
|
|
# Makefile for FunKey-OS
|
|
|
|
#
|
|
|
|
# Copyright (C) 2020 by Michel Stempin <michel.stempin@funkey-project.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
|
|
|
BRMAKE = buildroot/utils/brmake -C buildroot
|
|
|
|
BR = make -C buildroot
|
|
|
|
|
2020-10-21 22:20:17 +01:00
|
|
|
# Strip quotes and then whitespaces
|
|
|
|
qstrip = $(strip $(subst ",,$(1)))
|
|
|
|
#"))
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-21 22:20:17 +01:00
|
|
|
# MESSAGE Macro -- display a message in bold type
|
|
|
|
MESSAGE = echo "$(shell date +%Y-%m-%dT%H:%M:%S) $(TERM_BOLD)\#\#\# $(call qstrip,$(1))$(TERM_RESET)"
|
|
|
|
TERM_BOLD := $(shell tput smso 2>/dev/null)
|
|
|
|
TERM_RESET := $(shell tput rmso 2>/dev/null)
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-23 13:16:48 +01:00
|
|
|
.PHONY: fun source image update defconfig clean distclean
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-21 22:20:17 +01:00
|
|
|
.IGNORE: _Makefile_
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-23 13:16:48 +01:00
|
|
|
all: update
|
2020-10-21 22:20:17 +01:00
|
|
|
@:
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-22 07:12:03 +01:00
|
|
|
_Makefile_:
|
|
|
|
@:
|
|
|
|
|
|
|
|
%/Makefile:
|
2020-10-21 22:20:17 +01:00
|
|
|
@:
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-23 13:16:48 +01:00
|
|
|
buildroot: buildroot/README
|
|
|
|
@:
|
|
|
|
|
2020-10-21 22:20:17 +01:00
|
|
|
buildroot/README:
|
|
|
|
@$(call MESSAGE,"Getting buildroot")
|
2020-10-21 22:35:52 +01:00
|
|
|
@git submodule init
|
|
|
|
@git submodule update
|
2020-10-21 22:20:17 +01:00
|
|
|
|
2020-10-23 13:16:48 +01:00
|
|
|
fun: buildroot Recovery/output/.config FunKey/output/.config
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(call MESSAGE,"Making fun")
|
|
|
|
@$(call MESSAGE,"Making fun in Recovery")
|
|
|
|
@$(BRMAKE) BR2_EXTERNAL=../Recovery O=../Recovery/output
|
|
|
|
@$(call MESSAGE,"Making fun in FunKey")
|
|
|
|
@$(BRMAKE) BR2_EXTERNAL=../FunKey O=../FunKey/output
|
|
|
|
|
|
|
|
FunKey/%: FunKey/output/.config
|
|
|
|
@$(call MESSAGE,"Making $(notdir $@) in $(subst /,,$(dir $@))")
|
|
|
|
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $(notdir $@)
|
|
|
|
|
|
|
|
Recovery/%: Recovery/output/.config
|
|
|
|
@$(call MESSAGE,"Making $(notdir $@) in $(subst /,,$(dir $@))")
|
|
|
|
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output $(notdir $@)
|
|
|
|
|
2020-10-22 07:12:03 +01:00
|
|
|
#%: FunKey/output/.config
|
|
|
|
# @$(call MESSAGE,"Making $@ in FunKey")
|
|
|
|
# @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $@
|
2020-10-20 22:26:28 +01:00
|
|
|
|
|
|
|
source:
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(call MESSAGE,"Getting sources")
|
|
|
|
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output source
|
|
|
|
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output source
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-23 13:16:48 +01:00
|
|
|
image: fun
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(call MESSAGE,"Creating disk image")
|
2020-10-23 13:16:48 +01:00
|
|
|
@rm -rf root tmp
|
2020-10-21 22:35:52 +01:00
|
|
|
@mkdir -p root tmp
|
|
|
|
@./Recovery/output/host/bin/genimage --loglevel 0 --inputpath .
|
|
|
|
@rm -rf root tmp
|
2020-10-20 22:26:28 +01:00
|
|
|
|
2020-10-23 07:46:33 +01:00
|
|
|
update: fun
|
|
|
|
@$(call MESSAGE,"Creating update file")
|
|
|
|
@rm -rf tmp
|
|
|
|
@mkdir -p tmp
|
|
|
|
@cp FunKey/board/funkey/sw-description tmp/
|
|
|
|
@tar -C FunKey/output/images -zcf tmp/rootfs.ext2.tar.gz rootfs.ext2
|
|
|
|
@cd tmp && \
|
|
|
|
echo sw-description rootfs.ext2.tar.gz | \
|
|
|
|
tr " " "\n" | \
|
|
|
|
cpio -o -H crc --quiet > ../images/FunKey-$(shell cat FunKey/board/funkey/rootfs-overlay/etc/sw-versions | cut -f 2).swu
|
|
|
|
@rm -rf tmp
|
|
|
|
|
2020-10-21 22:20:17 +01:00
|
|
|
defconfig:
|
|
|
|
@$(call MESSAGE,"Updating default configs")
|
|
|
|
@$(call MESSAGE,"Updating default configs in Recovery")
|
|
|
|
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
|
|
|
|
@$(call MESSAGE,"Updating default configs in FunKey")
|
|
|
|
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
|
|
|
|
|
2020-10-20 22:26:28 +01:00
|
|
|
clean:
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(call MESSAGE,"Clean everything")
|
|
|
|
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output distclean
|
|
|
|
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output distclean
|
2020-10-20 22:26:28 +01:00
|
|
|
|
|
|
|
distclean: clean
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(call MESSAGE,"Really clean everything")
|
2020-10-21 22:35:52 +01:00
|
|
|
@rm -rf download images
|
2020-10-20 22:26:28 +01:00
|
|
|
|
|
|
|
FunKey/output/.config:
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(call MESSAGE,"Configure FunKey")
|
2020-10-21 22:35:52 +01:00
|
|
|
@mkdir -p FunKey/board/funkey/patches
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output funkey_defconfig
|
2020-10-20 22:26:28 +01:00
|
|
|
|
|
|
|
Recovery/output/.config:
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(call MESSAGE,"Configure Recovery")
|
2020-10-21 22:35:52 +01:00
|
|
|
@mkdir -p Recovery/board/funkey/patches
|
2020-10-21 22:20:17 +01:00
|
|
|
@$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output recovery_defconfig
|