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/AndroidProducts.mk << 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
44PRODUCT_MAKEFILES := \$(LOCAL_DIR)/full_$2.mk
45
46COMMON_LUNCH_CHOICES := full_$2-userdebug
47EOF
48
49cat > device/$1/$2/full_$2.mk << EOF
50#
51# Copyright 2014 The Android Open-Source Project
52#
53# Licensed under the Apache License, Version 2.0 (the "License");
54# you may not use this file except in compliance with the License.
55# You may obtain a copy of the License at
56#
57#      http://www.apache.org/licenses/LICENSE-2.0
58#
59# Unless required by applicable law or agreed to in writing, software
60# distributed under the License is distributed on an "AS IS" BASIS,
61# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
62# See the License for the specific language governing permissions and
63# limitations under the License.
64#
65\$(call inherit-product, \$(SRC_TARGET_DIR)/product/full_base.mk)
66\$(call inherit-product, device/$1/$2/device.mk)
67
68PRODUCT_NAME := full_$2
69PRODUCT_DEVICE := $2
70PRODUCT_BRAND := Android
71PRODUCT_MODEL := $2
72PRODUCT_MANUFACTURER := $1
73EOF
74
75cat > device/$1/$2/device.mk << EOF
76#
77# Copyright 2014 The Android Open-Source Project
78#
79# Licensed under the Apache License, Version 2.0 (the "License");
80# you may not use this file except in compliance with the License.
81# You may obtain a copy of the License at
82#
83#      http://www.apache.org/licenses/LICENSE-2.0
84#
85# Unless required by applicable law or agreed to in writing, software
86# distributed under the License is distributed on an "AS IS" BASIS,
87# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
88# See the License for the specific language governing permissions and
89# limitations under the License.
90#
91
92ifeq (\$(TARGET_PREBUILT_KERNEL),)
93LOCAL_KERNEL := device/$1/$2-kernel/kernel
94else
95LOCAL_KERNEL := \$(TARGET_PREBUILT_KERNEL)
96endif
97
98PRODUCT_COPY_FILES := \\
99	\$(LOCAL_KERNEL):kernel
100
101\$(call inherit-product-if-exists, vendor/$1/$2/device-vendor.mk)
102EOF
103
104cat > device/$1/$2/BoardConfig.mk << EOF
105#
106# Copyright 2014 The Android Open-Source Project
107#
108# Licensed under the Apache License, Version 2.0 (the "License");
109# you may not use this file except in compliance with the License.
110# You may obtain a copy of the License at
111#
112#      http://www.apache.org/licenses/LICENSE-2.0
113#
114# Unless required by applicable law or agreed to in writing, software
115# distributed under the License is distributed on an "AS IS" BASIS,
116# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
117# See the License for the specific language governing permissions and
118# limitations under the License.
119#
120
121# Use the non-open-source parts, if they're present
122-include vendor/$1/$2/BoardConfigVendor.mk
123
124TARGET_ARCH := arm
125TARGET_ARCH_VARIANT := armv7-a-neon
126TARGET_CPU_ABI := armeabi-v7a
127TARGET_CPU_ABI2 := armeabi
128EOF
129
130touch device/$1/$2-kernel/kernel
131touch device/$1/$2-kernel/MODULE_LICENSE_GPL
132
133cat > vendor/$1/$2/device-vendor.mk << EOF
134#
135# Copyright 2014 The Android Open-Source Project
136#
137# Licensed under the Apache License, Version 2.0 (the "License");
138# you may not use this file except in compliance with the License.
139# You may obtain a copy of the License at
140#
141#      http://www.apache.org/licenses/LICENSE-2.0
142#
143# Unless required by applicable law or agreed to in writing, software
144# distributed under the License is distributed on an "AS IS" BASIS,
145# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
146# See the License for the specific language governing permissions and
147# limitations under the License.
148#
149EOF
150
151cat > vendor/$1/$2/BoardConfigVendor.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
169