1#!/usr/bin/env bash
2
3# Copyright 2014 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17if test "$1" = "" -o "$2" = ""
18then
19  echo "Need a manufacturer name and a device name"
20  exit 1
21fi
22
23mkdir -p device/$1/$2
24mkdir -p device/$1/$2-kernel
25mkdir -p vendor/$1/$2
26
27cat > device/$1/$2/vendorsetup.sh << EOF
28#
29# Copyright 2014 The Android Open Source Project
30#
31# Licensed under the Apache License, Version 2.0 (the "License");
32# you may not use this file except in compliance with the License.
33# You may obtain a copy of the License at
34#
35#      http://www.apache.org/licenses/LICENSE-2.0
36#
37# Unless required by applicable law or agreed to in writing, software
38# distributed under the License is distributed on an "AS IS" BASIS,
39# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40# See the License for the specific language governing permissions and
41# limitations under the License.
42#
43
44add_lunch_combo full_$2-userdebug
45EOF
46
47cat > device/$1/$2/AndroidProducts.mk << EOF
48#
49# Copyright 2014 The Android Open-Source Project
50#
51# Licensed under the Apache License, Version 2.0 (the "License");
52# you may not use this file except in compliance with the License.
53# You may obtain a copy of the License at
54#
55#      http://www.apache.org/licenses/LICENSE-2.0
56#
57# Unless required by applicable law or agreed to in writing, software
58# distributed under the License is distributed on an "AS IS" BASIS,
59# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60# See the License for the specific language governing permissions and
61# limitations under the License.
62#
63
64PRODUCT_MAKEFILES := \$(LOCAL_DIR)/full_$2.mk
65EOF
66
67cat > device/$1/$2/full_$2.mk << EOF
68#
69# Copyright 2014 The Android Open-Source Project
70#
71# Licensed under the Apache License, Version 2.0 (the "License");
72# you may not use this file except in compliance with the License.
73# You may obtain a copy of the License at
74#
75#      http://www.apache.org/licenses/LICENSE-2.0
76#
77# Unless required by applicable law or agreed to in writing, software
78# distributed under the License is distributed on an "AS IS" BASIS,
79# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80# See the License for the specific language governing permissions and
81# limitations under the License.
82#
83\$(call inherit-product, \$(SRC_TARGET_DIR)/product/full_base.mk)
84\$(call inherit-product, device/$1/$2/device.mk)
85
86PRODUCT_NAME := full_$2
87PRODUCT_DEVICE := $2
88PRODUCT_BRAND := Android
89PRODUCT_MODEL := $2
90PRODUCT_MANUFACTURER := $1
91EOF
92
93cat > device/$1/$2/device.mk << EOF
94#
95# Copyright 2014 The Android Open-Source Project
96#
97# Licensed under the Apache License, Version 2.0 (the "License");
98# you may not use this file except in compliance with the License.
99# You may obtain a copy of the License at
100#
101#      http://www.apache.org/licenses/LICENSE-2.0
102#
103# Unless required by applicable law or agreed to in writing, software
104# distributed under the License is distributed on an "AS IS" BASIS,
105# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106# See the License for the specific language governing permissions and
107# limitations under the License.
108#
109
110ifeq (\$(TARGET_PREBUILT_KERNEL),)
111LOCAL_KERNEL := device/$1/$2-kernel/kernel
112else
113LOCAL_KERNEL := \$(TARGET_PREBUILT_KERNEL)
114endif
115
116PRODUCT_COPY_FILES := \\
117	\$(LOCAL_KERNEL):kernel
118
119\$(call inherit-product-if-exists, vendor/$1/$2/device-vendor.mk)
120EOF
121
122cat > device/$1/$2/BoardConfig.mk << EOF
123#
124# Copyright 2014 The Android Open-Source Project
125#
126# Licensed under the Apache License, Version 2.0 (the "License");
127# you may not use this file except in compliance with the License.
128# You may obtain a copy of the License at
129#
130#      http://www.apache.org/licenses/LICENSE-2.0
131#
132# Unless required by applicable law or agreed to in writing, software
133# distributed under the License is distributed on an "AS IS" BASIS,
134# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135# See the License for the specific language governing permissions and
136# limitations under the License.
137#
138
139# Use the non-open-source parts, if they're present
140-include vendor/$1/$2/BoardConfigVendor.mk
141
142TARGET_ARCH := arm
143TARGET_ARCH_VARIANT := armv7-a-neon
144TARGET_CPU_ABI := armeabi-v7a
145TARGET_CPU_ABI2 := armeabi
146EOF
147
148touch device/$1/$2-kernel/kernel
149touch device/$1/$2-kernel/MODULE_LICENSE_GPL
150
151cat > vendor/$1/$2/device-vendor.mk << EOF
152#
153# Copyright 2014 The Android Open-Source Project
154#
155# Licensed under the Apache License, Version 2.0 (the "License");
156# you may not use this file except in compliance with the License.
157# You may obtain a copy of the License at
158#
159#      http://www.apache.org/licenses/LICENSE-2.0
160#
161# Unless required by applicable law or agreed to in writing, software
162# distributed under the License is distributed on an "AS IS" BASIS,
163# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164# See the License for the specific language governing permissions and
165# limitations under the License.
166#
167EOF
168
169cat > vendor/$1/$2/BoardConfigVendor.mk << EOF
170#
171# Copyright 2014 The Android Open-Source Project
172#
173# Licensed under the Apache License, Version 2.0 (the "License");
174# you may not use this file except in compliance with the License.
175# You may obtain a copy of the License at
176#
177#      http://www.apache.org/licenses/LICENSE-2.0
178#
179# Unless required by applicable law or agreed to in writing, software
180# distributed under the License is distributed on an "AS IS" BASIS,
181# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
182# See the License for the specific language governing permissions and
183# limitations under the License.
184#
185EOF
186
187