forked from ayufan-rock64/linux-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
163 lines (128 loc) · 5.3 KB
/
Makefile
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
export RELEASE_NAME ?= 0.1~dev
export RELEASE ?= 1
export BOOT_TOOLS_BRANCH ?= master
KERNEL_LOCALVERSION ?= -rockchip-ayufan-$(RELEASE)
KERNEL_MAKE ?= make -C kernel \
LOCALVERSION=$(KERNEL_LOCALVERSION) \
KDEB_PKGVERSION=$(RELEASE_NAME) \
ARCH=arm64 \
CROSS_COMPILE="ccache aarch64-linux-gnu-"
KERNEL_RELEASE ?= $(shell $(KERNEL_MAKE) -s kernelversion)$(KERNEL_LOCALVERSION)
KERNEL_PACKAGE ?= linux-image-$(KERNEL_RELEASE)_$(RELEASE_NAME)_arm64.deb
KERNEL_HEADERS_PACKAGES ?= linux-headers-$(KERNEL_RELEASE)_$(RELEASE_NAME)_arm64.deb
PACKAGES := linux-rock64-package-$(RELEASE_NAME)_all.deb $(KERNEL_PACKAGE) $(KERNEL_HEADERS_PACKAGES)
IMAGE_SUFFIX := $(RELEASE_NAME)-$(RELEASE)
all: linux-rock64
info:
echo version: $(KERNEL_VERSION)
echo release: $(KERNEL_RELEASE)
linux-rock64-$(RELEASE_NAME)_arm64.deb: $(PACKAGES)
fpm -s empty -t deb -n linux-rock64 -v $(RELEASE_NAME) \
-p $@ \
--deb-priority optional --category admin \
--depends "linux-rock64-package (= $(RELEASE_NAME))" \
--depends "linux-image-$(KERNEL_RELEASE) (= $(RELEASE_NAME))" \
--depends "linux-headers-$(KERNEL_RELEASE) (= $(RELEASE_NAME))" \
--force \
--url https://gitlab.com/ayufan-rock64/linux-build \
--description "Rock64 Linux virtual package: depends on kernel and compatibility package" \
-m "Kamil Trzciński <[email protected]>" \
--license "MIT" \
--vendor "Kamil Trzciński" \
-a arm64
linux-rock64-package-$(RELEASE_NAME)_all.deb: package
chmod -R go-w $<
fpm -s dir -t deb -n linux-rock64-package -v $(RELEASE_NAME) \
-p $@ \
--deb-priority optional --category admin \
--force \
--depends figlet \
--depends cron \
--depends gdisk \
--depends parted \
--deb-compression bzip2 \
--deb-field "Multi-Arch: foreign" \
--after-install package/scripts/postinst.deb \
--before-remove package/scripts/prerm.deb \
--url https://gitlab.com/ayufan-rock64/linux-build \
--description "Rock64 Linux support package" \
--config-files /boot/efi/extlinux/ \
-m "Kamil Trzciński <[email protected]>" \
--license "MIT" \
--vendor "Kamil Trzciński" \
-a all \
package/root/=/
%.tar.xz: %.tar
pxz -f -3 $<
%.img.xz: %.img
pxz -f -3 $<
BUILD_SYSTEMS := artful zesty xenial jessie stretch
BUILD_VARIANTS := minimal mate i3 openmediavault
BUILD_ARCHS := armhf arm64
BUILD_MODELS := rock64
%-system.img: $(PACKAGES) linux-rock64-$(RELEASE_NAME)_arm64.deb
sudo bash rootfs/build-system-image.sh \
"$(shell readlink -f $@)" \
"$(shell readlink -f $(subst -system.img,-boot.img,$@))" \
"$(filter $(BUILD_SYSTEMS), $(subst -, ,$@))" \
"$(filter $(BUILD_VARIANTS), $(subst -, ,$@))" \
"$(filter $(BUILD_ARCHS), $(subst -, ,$@))" \
"$(filter $(BUILD_MODELS), $(subst -, ,$@))" \
$^
out/u-boot/uboot.img: u-boot/configs/rock64-rk3328_defconfig
build/mk-uboot.sh rk3328-rock64
%.img: %-system.img out/u-boot/uboot.img
build/mk-image.sh -c rk3328 -t system -r "$<" -b "$(subst -system.img,-boot.img,$<)" -o "[email protected]"
mv "[email protected]" "$@"
$(KERNEL_PACKAGE): kernel/arch/arm64/configs/rockchip_linux_defconfig
echo -n > kernel/.scmversion
$(KERNEL_MAKE) rockchip_linux_defconfig
$(KERNEL_MAKE) bindeb-pkg -j$(shell nproc)
$(KERNEL_HEADERS_PACKAGES): $(KERNEL_PACKAGE)
.PHONY: kernelpkg
kernelpkg: $(KERNEL_PACKAGE) $(KERNEL_HEADERS_PACKAGES)
.PHONY: kernel
kernel: kernelpkg
.PHONY: u-boot
u-boot: out/u-boot/uboot.img
.PHONY: linux-package
linux-package: linux-rock64-package-$(RELEASE_NAME)_all.deb
.PHONY: linux-virtual
linux-virtual: linux-rock64-$(RELEASE_NAME)_arm64.deb
.PHONY: xenial-minimal-rock64
xenial-minimal-rock64: xenial-minimal-rock64-$(IMAGE_SUFFIX)-armhf.img.xz xenial-minimal-rock64-$(IMAGE_SUFFIX)-arm64.img.xz
.PHONY: xenial-mate-rock64
xenial-mate-rock64: xenial-mate-rock64-$(IMAGE_SUFFIX)-armhf.img.xz xenial-mate-rock64-$(IMAGE_SUFFIX)-arm64.img.xz
.PHONY: xenial-i3-rock64
xenial-i3-rock64: xenial-i3-rock64-$(IMAGE_SUFFIX)-armhf.img.xz xenial-i3-rock64-$(IMAGE_SUFFIX)-arm64.img.xz
.PHONY: jessie-minimal-rock64
jessie-minimal-rock64: jessie-minimal-rock64-$(IMAGE_SUFFIX)-arm64.img.xz
.PHONY: jessie-openmediavault-rock64
jessie-openmediavault-rock64: jessie-openmediavault-rock64-$(IMAGE_SUFFIX)-armhf.img.xz
.PHONY: stretch-minimal-rock64
stretch-minimal-rock64: stretch-minimal-rock64-$(IMAGE_SUFFIX)-arm64.img.xz
.PHONY: xenial-rock64
xenial-rock64: xenial-minimal-rock64 xenial-mate-rock64 xenial-i3-rock64
.PHONY: stretch-rock64
stretch-rock64: stretch-minimal-rock64
.PHONY: jessie-rock64
jessie-rock64: jessie-minimal-rock64 jessie-openmediavault-rock64
.PHONY: linux-rock64
linux-rock64: xenial-rock64 stretch-rock64 jessie-rock64 linux-virtual
.PHONY: pull-trees
pull-trees:
git subtree pull --prefix build https://github.com/rockchip-linux/build debian
git subtree pull --prefix build https://github.com/rock64-linux/build debian
.PHONY: kernel-menuconfig
kernel-menuconfig:
$(KERNEL_MAKE) rockchip_linux_defconfig
$(KERNEL_MAKE) menuconfig
$(KERNEL_MAKE) savedefconfig
cp kernel/defconfig kernel/arch/arm64/configs/rockchip_linux_defconfig
REMOTE_HOST ?= rock64.home
kernel-build:
$(KERNEL_MAKE) Image modules -j$(shell nproc)
$(KERNEL_MAKE) modules_install INSTALL_MOD_PATH=$(shell pwd)/tmp/linux_modules
kernel-update:
rsync --partial -rv kernel/arch/arm64/boot/Image root@$(REMOTE_HOST):$(REMOTE_DIR)/boot/efi/Image
rsync --partial -av tmp/linux_modules/lib/ root@$(REMOTE_HOST):$(REMOTE_DIR)/lib