summaryrefslogtreecommitdiff
path: root/hal/firmware/kernel-firmware/Makefile
blob: 6ce2e03a449c6653248263283a6d471c0bc74bc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Firmware for the Linux Kernel: git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
#

url        = https://git.kernel.org/pub/scm/linux/kernel/git/firmware

repo_name  = linux-firmware

#
# List of tags to be extracted:
# ============================
#
#                                               hash | date
#            ----------------------------------------+--------
revisions  = f8462923ed8fc874f770b8c6dfad49d39b381f14:20210518
revisions += 8b07c1fb1d8de4259611a0cccaeda893d792cd91:20221012
revisions += f7c95a2f945e7ca5fd8f55c3ff3fe662bac24f65:20260519

git_repo   = .git_clone

pkgname    = kernel-firmware
suffix     = tar.xz

versions   = $(foreach tag, $(revisions), $(shell echo $(tag) | cut -f 2 -d ':'))
tarballs   = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
sha1s      = $(addsuffix .sha1sum, $(tarballs))

TARGETS = repository_clean

all: $(TARGETS)

.PHONY: downloads_clean repository_clean

$(git_repo):
	@echo -e "\n======= Clone $(repo_name).git repository =======\n"
	@rm -rf $(repo_name)
	@git clone $(url)/$(repo_name).git $(repo_name)
	@touch $@

$(tarballs): $(git_repo)
	@for revision in $(revisions) ; do \
	  hash=`echo $$revision | cut -f 1 -d ':'` ; \
	  date=`echo $$revision | cut -f 2 -d ':'` ; \
	  if [ ! -f $(pkgname)-$$date.$(suffix) ]; then \
	    echo -e "\n======= Creating '$(pkgname)-$$date.$(suffix)' snapshot =======" ; \
	    ( cd $(repo_name) && \
	      git archive --format=tar --prefix=$(pkgname)-$$date/ $$hash | \
	      xz >../$(pkgname)-$$date.$(suffix) ) ; \
	  fi ; \
	done

$(sha1s): %.$(suffix).sha1sum : %.$(suffix)
	@for tarball in $< ; do \
	  echo -e "\n======= Calculation the '$$tarball' sha1sum =======" ; \
	  sha1sum --binary $$tarball > $$tarball.sha1sum ; \
	done

repository_clean: $(sha1s)
	@echo -e "\n======= Remove cloned $(repo_name).git repository =======\n"
	@rm -rf $(git_repo) $(repo_name)

downloads_clean:
	@rm -rf $(tarballs) $(sha1s)
	@rm -rf $(git_repo) $(repo_name)