Skip to content

Commit b574414

Browse files
committed
Switch to GrapheneOS based on Android 11
1 parent 6c68120 commit b574414

15 files changed

+1348
-1200
lines changed

.gitignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aosp-build/.gitignore

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "aosp-build"]
2+
path = aosp-build
3+
url = https://github.com/hashbang/aosp-build.git

Makefile

Lines changed: 15 additions & 273 deletions
Original file line numberDiff line numberDiff line change
@@ -1,278 +1,20 @@
1-
## Argument Variables ##
1+
include aosp-build/Makefile
22

3-
CPUS := $(shell nproc)
4-
MEMORY := 10000
5-
DISK := 300000
6-
DEVICE := crosshatch
7-
BACKEND := local
8-
CHANNEL := beta
9-
BUILD := user
10-
FLAVOR := aosp
11-
IMAGE := hashbang/aosp-build:latest
12-
IMAGE_OPTIONS :=
13-
NAME := aosp-build-$(FLAVOR)-$(BACKEND)
14-
SHELL := /bin/bash
3+
NAME := hashbangos-$(FLAVOR)-$(BACKEND)
154

16-
-include $(PWD)/config/env/$(BACKEND).env
5+
contain-base-extend = \
6+
--volume $(PWD)/aosp-build/scripts:/opt/aosp-build/scripts \
7+
--volume $(PWD)/aosp-build/config:/opt/aosp-build/config \
8+
--volume $(PWD)/aosp-build/config/manifests:/home/build/config/manifests-aosp
179

18-
## Default Target ##
10+
.PHONY: HashbangOS-setup
11+
HashbangOS-setup:
12+
cd aosp-build/ && ln -sf ../build
1913

20-
.DEFAULT_GOAL := default
21-
.PHONY: default
22-
default: machine image fetch tools keys build release
14+
.PHONY: HashbangOS-release
15+
HashbangOS-review: HashbangOS-setup
16+
make -C aosp-build config ensure-git-status-clean
17+
make -C aosp-build manifest ensure-git-status-clean fetch
18+
make fetch review
2319

24-
25-
## Primary Targets ##
26-
27-
.PHONY: fetch
28-
fetch: submodule-update machine image
29-
$(contain) fetch
30-
31-
.PHONY: keys
32-
keys:
33-
$(contain) keys
34-
35-
.PHONY: build
36-
build:
37-
$(contain) build
38-
39-
.PHONY: release
40-
release:
41-
$(contain) release
42-
43-
.PHONY: publish
44-
publish:
45-
$(contain) publish
46-
47-
.PHONY: clean
48-
clean:
49-
$(contain) clean
50-
51-
.PHONY: mrproper
52-
mrproper: storage-delete machine-delete
53-
rm -rf build
54-
55-
56-
## Secondary Targets ##
57-
58-
.PHONY: image
59-
image:
60-
$(docker) build \
61-
--tag $(IMAGE) \
62-
--file $(PWD)/config/container/Dockerfile \
63-
$(IMAGE_OPTIONS) \
64-
$(PWD)
65-
66-
config/container/Dockerfile.minimal: config/container/Dockerfile config/container/render_template
67-
./config/container/render_template "$<" | grep -v '^#\s*$$' > "$@"
68-
69-
.PHONY: image-minimal
70-
image-minimal: config/container/Dockerfile.minimal
71-
$(docker) build \
72-
--tag $(IMAGE) \
73-
--file "$(PWD)/$<" \
74-
$(IMAGE_OPTIONS) \
75-
$(PWD)
76-
77-
.PHONY: tools
78-
tools:
79-
mkdir -p config/keys build/base release build/external
80-
$(contain) tools
81-
82-
.PHONY: vendor
83-
vendor:
84-
$(contain) build-vendor
85-
86-
.PHONY: chromium
87-
chromium:
88-
$(contain) build-chromium
89-
90-
.PHONY: kernel
91-
kernel:
92-
$(contain) build-kernel
93-
94-
95-
## Development ##
96-
97-
.PHONY: latest
98-
latest: config submodule-latest fetch
99-
100-
.PHONY: manifest
101-
manifest: config
102-
$(contain) bash -c "source <(environment) && manifest"
103-
104-
.PHONY: config
105-
config:
106-
$(contain) bash -c "source <(environment) && config"
107-
108-
.PHONY: test-repro
109-
test-repro:
110-
$(contain) test-repro
111-
112-
.PHONY: test
113-
test: test-repro
114-
115-
.PHONY: patches
116-
patches:
117-
@$(contain) bash -c "cd base; repo diff --absolute"
118-
119-
.PHONY: shell
120-
shell:
121-
$(docker) inspect "$(NAME)" \
122-
&& $(docker) exec --interactive --tty "$(NAME)" shell \
123-
|| $(contain) shell
124-
125-
.PHONY: monitor
126-
monitor:
127-
$(docker) inspect "$(NAME)" \
128-
&& $(docker) exec --interactive --tty "$(NAME)" htop
129-
130-
.PHONY: install
131-
install: tools
132-
@scripts/flash
133-
134-
135-
## Source Management ##
136-
137-
.PHONY: submodule-update
138-
submodule-update:
139-
git submodule update --init --recursive
140-
141-
.PHONY: submodule-latest
142-
submodule-latest:
143-
git submodule foreach 'git checkout master && git pull'
144-
145-
## Storage Bootstrapping ##
146-
147-
# TODO: detect if plugin is already installed or not
148-
# TODO: Hash lock rexray with sha256 digest to prevent tag clobbering
149-
.PHONY: storage-digitalocean
150-
storage-digitalocean:
151-
$(docker) volume ls | grep $(NAME) \
152-
||( $(docker) plugin install \
153-
--grant-all-permissions \
154-
rexray/dobs:0.11.4 \
155-
DOBS_REGION=$(DIGITALOCEAN_REGION) \
156-
DOBS_TOKEN=$(DIGITALOCEAN_TOKEN) \
157-
; $(docker) volume create \
158-
--driver rexray/dobs:0.11.4 \
159-
--opt=size=$$(( $(DISK) / 1000 )) \
160-
--name=$(NAME) \
161-
)
162-
163-
.PHONY: storage-local
164-
storage-local:
165-
$(docker) volume ls | grep $(NAME) \
166-
|| $(docker) volume create \
167-
--driver local \
168-
--opt type=none \
169-
--opt o=bind \
170-
--opt device=$(PWD)/build \
171-
$(NAME)
172-
173-
.PHONY: storage-delete
174-
storage-delete:
175-
$(docker) volume rm -f $(NAME) || :
176-
177-
178-
## VM Management ##
179-
180-
.PHONY: machine-start
181-
machine-start: machine-install machine-create machine-date
182-
$(docker_machine) status $(NAME) \
183-
|| $(docker_machine) start $(NAME)
184-
185-
.PHONY: machine-sync
186-
machine-sync:
187-
$(docker_machine) scp -r -d config/ $(NAME):$(PWD)/config/
188-
189-
.PHONY: machine-shell
190-
machine-shell:
191-
$(docker_machine) ssh $(NAME)
192-
193-
.PHONY: machine-stop
194-
machine-stop:
195-
$(docker_machine) stop $(NAME)
196-
197-
.PHONY: machine-delete
198-
machine-delete:
199-
$(docker_machine) rm -f -y $(NAME)
200-
201-
.PHONY: machine-date
202-
machine-date:
203-
$(docker_machine) ssh $(NAME) \
204-
"sudo date -s @$(shell date +%s)"
205-
206-
.PHONY: machine-create
207-
machine-create: machine-install
208-
$(docker_machine) status $(NAME) \
209-
||( $(docker_machine) create \
210-
--driver $(BACKEND) \
211-
$(docker_machine_create_flags) \
212-
$(NAME) \
213-
)
214-
215-
.PHONY: machine-install
216-
machine-install:
217-
# wget docker-machine & hash check here
218-
219-
220-
## VM Bootstrapping ##
221-
222-
ifeq ($(BACKEND),local)
223-
224-
executables = docker
225-
docker = docker
226-
machine:
227-
storage_flags = --volume $(PWD)/build/:/home/build/build/
228-
229-
else ifeq ($(BACKEND),virtualbox)
230-
231-
executables = docker-machine ssh virtualbox
232-
docker = $(docker_machine) ssh $(NAME) -t docker
233-
machine: machine-start storage-local
234-
storage_flags = --volume $(NAME):/home/build/build/
235-
docker_machine_create_flags = \
236-
--virtualbox-share-folder="$(PWD):$(PWD)" \
237-
--virtualbox-disk-size="$(DISK)" \
238-
--virtualbox-memory="$(MEMORY)" \
239-
--virtualbox-cpu-count="$(CPUS)"
240-
241-
else ifeq ($(BACKEND),digitalocean)
242-
243-
executables = docker-machine ssh
244-
docker = $(docker_machine) ssh $(NAME) -t docker
245-
machine: machine-start storage-digitalocean machine-sync
246-
storage_flags = --volume $(NAME):/home/build/build/
247-
docker_machine_create_flags = \
248-
--digitalocean-access-token=$(DIGITALOCEAN_TOKEN) \
249-
--digitalocean-region=$(DIGITALOCEAN_REGION) \
250-
--digitalocean-image=$(DIGITALOCEAN_IMAGE) \
251-
--digitalocean-size=$(DIGITALOCEAN_SIZE)
252-
253-
endif
254-
255-
userid = $(shell id -u)
256-
groupid = $(shell id -g)
257-
docker_machine = docker-machine --storage-path "${PWD}/build/machine"
258-
contain := \
259-
$(docker) run \
260-
--rm \
261-
--tty \
262-
--interactive \
263-
--name "$(NAME)" \
264-
--hostname "$(NAME)" \
265-
--user $(userid):$(groupid) \
266-
--env DEVICE=$(DEVICE) \
267-
--security-opt seccomp=unconfined \
268-
--volume $(PWD)/config:/home/build/config \
269-
--volume $(PWD)/release:/home/build/release \
270-
--volume $(PWD)/scripts:/home/build/scripts \
271-
$(storage_flags) \
272-
$(IMAGE)
273-
274-
275-
## Required Binary Check ##
276-
277-
check_executables := $(foreach exec,$(executables),\$(if \
278-
$(shell which $(exec)),some string,$(error "No $(exec) in PATH")))
20+
HashbangOS-build: clean fetch build release

0 commit comments

Comments
 (0)