[Nexus 5 Android Development] fKm:
Okay, here is the tutorial for building this ROM:

Set up your build environment:

Use this tutorial to set up your building machine till point 8) and 9): https://xdaforums.com/chef-central/android/guide-how-to-setup-ubuntu-16-04-lts-t3363669

Under point 8) use this command:

repo init -u git://github.com/AospExtended/manifest.git -b 7.x

Under point 9) use this command:

repo sync -c --force-sync

You don't need the Java stuff under point 10)

Prepare the sources:

Create hammerhead.xml in /.repo/local_manifests (create the folder local_manifests if it doesn't exist) with this content:

<manifest>
<!-- Hammerhead Repo -->
<project path="device/lge/hammerhead" name="LineageOS/android_device_lge_hammerhead" remote="github" revision="cm-14.1"/>
<project path="kernel/lge/hammerhead" name="LineageOS/android_kernel_lge_hammerhead" remote="github" revision="cm-14.1"/>
<project path="vendor/lge" name="TheMuppets/proprietary_vendor_lge" remote="github" revision="cm-14.1"/>
</manifest>

Do a repo sync again with this command:

repo sync -c --force-sync

Replace the content of /device/lge/hammerhead/aosp_hammerhead.mk with this content. If you want to use magisk as root default method just replace supersu with magisk:

#
# Copyright 2013 The Android Open-Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
$(call inherit-product, device/lge/hammerhead/full_hammerhead.mk)
$(call inherit-product, vendor/aosp/common.mk)

PRODUCT_NAME := aosp_hammerhead

DEFAULT_ROOT_METHOD := supersu

Replace the content of /device/lge/hammerhead/full_hammerhead.mk with this content:

#
# Copyright 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Sample: This is where we'd set a backup provider if we had one
# $(call inherit-product, device/sample/products/backup_overlay.mk)

# Inherit from the common Open Source product configuration
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)

PRODUCT_NAME := full_hammerhead
PRODUCT_DEVICE := hammerhead
PRODUCT_BRAND := Android
PRODUCT_MODEL := Nexus 5
PRODUCT_MANUFACTURER := LGE
PRODUCT_RESTRICT_VENDOR_FILES := false

$(call inherit-product, device/lge/hammerhead/device.mk)
$(call inherit-product-if-exists, vendor/lge/hammerhead/hammerhead-vendor.mk)

Replace the content of /device/lge/hammerhead/overlay/frameworks/base/core/res/res/values with this content:

<!--

/*
** Copyright 2013, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!--
Whether a software navigation bar should be shown. NOTE: in the future this may be
autodetected from the Configuration.
-->
<bool name="config_showNavigationBar">true</bool>
<!--
Flag indicating whether the we should enable the automatic brightness in Settings.
Software implementation will be used if config_hardware_auto_brightness_available is not set
-->
<bool name="config_automatic_brightness_available">true</bool>
<!--
Array of light sensor LUX values to define our levels for auto backlight brightness support.
The N entries of this array define N 1 zones as follows:

Zone 0: 0 <= LUX < array[0]
Zone 1: array[0] <= LUX < array[1]
...
Zone N: array[N - 1] <= LUX < array[N]
Zone N + 1 array[N] <= LUX < infinity

Must be overridden in platform specific overlays
-->
<integer-array name="config_autoBrightnessLevels">
<item>1</item>
<item>4</item>
<item>40</item>
<item>350</item>
<item>600</item>
<item>1000</item>
<item>1600</item>
<item>3000</item>
<item>10000</item>
</integer-array>
<!--
Array of output values for LCD backlight corresponding to the LUX values
in the config_autoBrightnessLevels array. This array should have size one greater
than the size of the config_autoBrightnessLevels array.
This must be overridden in platform specific overlays
-->
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>13</item>
<!-- 0-1 -->
<item>26</item>
<!-- 1-4 -->
<item>73</item>
<!-- 4-40 -->
<item>88</item>
<!-- 40-350 -->
<item>130</item>
<!-- 350-600 -->
<item>167</item>
<!-- 600-1000 -->
<item>204</item>
<!-- 1000-1600 -->
<item>240</item>
<!-- 1600-3000 -->
<item>254</item>
<!-- 3000-10000 -->
<item>255</item>
<!-- 10000+ -->
</integer-array>
<!--
Array of output values for button backlight corresponding to the LUX values
in the config_autoBrightnessLevels array. This array should have size one greater
than the size of the config_autoBrightnessLevels array.
This must be overridden in platform specific overlays
-->
<integer-array name="config_autoBrightnessButtonBacklightValues">
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
</integer-array>
<!--
Minimum screen brightness allowed by the power manager.
-->
<integer name="config_screenBrightnessDim">1</integer>
<!--
Default screen brightness setting.
Must be in the range specified by minimum and maximum.
-->
<integer name="config_screenBrightnessSettingDefault">82</integer>
<!--
Minimum screen brightness setting allowed by the power manager.
The user is forbidden from setting the brightness below this level.
-->
<integer name="config_screenBrightnessSettingMinimum">1</integer>
<!--
If this is true, the screen will come on when you unplug usb/power/whatever.
-->
<bool name="config_unplugTurnsOnScreen">true</bool>
<!--
Boolean indicating if restoring network selection should be skipped
-->
<!-- The restoring is handled by modem if it is true -->
<bool translatable="false" name="skip_restoring_network_selection">true</bool>
<!--
Set to true to add links to Cell Broadcast app from Settings and MMS app.
-->
<bool name="config_cellBroadcastAppLinks">true</bool>
<!--
Shutdown if the battery temperature exceeds (this value * 0.1) Celsius.
-->
<integer name="config_shutdownBatteryTemperature">600</integer>
<!--
Default LED on time for notification LED in milliseconds.
-->
<integer name="config_defaultNotificationLedOn">1000</integer>
<!--
Is the notification LED intrusive?
Used to decide if there should be a disable option
-->
<bool name="config_intrusiveNotificationLed">true</bool>
<!--
Is the battery LED intrusive?
Used to decide if there should be a disable option
-->
<bool name="config_intrusiveBatteryLed">true</bool>
<!--
reference volume index for music stream to limit headphone volume and display warning
-->
<integer name="config_safe_media_volume_index">5</integer>
<!--
List of regexpressions describing the interface (if any) that represent tetherable
USB interfaces. If the device doesn't want to support tething over USB this should
be empty. An example would be "usb.*"
-->
<string-array translatable="false" name="config_tether_usb_regexs">
<item>"usb\\d"</item>
<item>"rndis\\d"</item>
</string-array>
<!--
List of regexpressions describing the interface (if any) that represent tetherable
Wifi interfaces. If the device doesn't want to support tethering over Wifi this
should be empty. An example would be "softap.*"
-->
<string-array translatable="false" name="config_tether_wifi_regexs">
<item>"wlan0"</item>
<item>"softap.*"</item>
</string-array>
<!--
List of regexpressions describing the interface (if any) that represent tetherable
bluetooth interfaces. If the device doesn't want to support tethering over bluetooth this
should be empty.
-->
<string-array translatable="false" name="config_tether_bluetooth_regexs">
<item>"bt-pan"</item>
</string-array>
<!--
Max number of scan filters supported by blutooth controller. 0 if the
device does not support hardware scan filters
-->
<integer translatable="false" name="config_bluetooth_max_scan_filters">1</integer>
<!--
Max number of advertisers supported by bluetooth controller. 0 if the
device does not support multiple advertisement
-->
<integer translatable="false" name="config_bluetooth_max_advertisers">4</integer>
<!--
Array of allowable ConnectivityManager network types for tethering
-->
<!--
Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
[0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH
-->
<integer-array translatable="false" name="config_tether_upstream_types">
<item>0</item>
<item>1</item>
<item>5</item>
<item>7</item>
</integer-array>
<!--
This string array should be overridden by the device to present a list of network
attributes. This is used by the connectivity manager to decide which networks can coexist
based on the hardware
-->
<!--
An Array of "[Connection name],[ConnectivityManager.TYPE_xxxx],
[associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet]
-->
<!--
the 5th element "resore-time" indicates the number of milliseconds to delay
before automatically restore the default connection. Set -1 if the connection
does not require auto-restore.
-->
<!--
the 6th element indicates boot-time dependency-met value.
-->
<string-array translatable="false" name="networkAttributes">
<item>"wifi,1,1,1,-1,true"</item>
<item>"mobile,0,0,0,-1,true"</item>
<item>"mobile_mms,2,0,2,60000,true"</item>
<item>"mobile_supl,3,0,2,60000,true"</item>
<item>"mobile_dun,4,0,2,60000,true"</item>
<item>"mobile_hipri,5,0,3,60000,true"</item>
<item>"mobile_fota,10,0,2,60000,true"</item>
<item>"mobile_ims,11,0,2,60000,true"</item>
<item>"mobile_cbs,12,0,2,60000,true"</item>
<item>"mobile_ia,14,0,2,-1,true"</item>
<item>"bluetooth,7,7,2,-1,true"</item>
<item>"ethernet,9,9,9,-1,true"</item>
<item>"mobile_emergency,15,0,2,-1,true</item>
</string-array>
<!--
This string array should be overridden by the device to present a list of radio
attributes. This is used by the connectivity manager to decide which networks can coexist
based on the hardware
-->
<!--
An Array of "[ConnectivityManager connectionType],
[# simultaneous connection types]"
-->
<string-array translatable="false" name="radioAttributes">
<item>"1,1"</item>
<item>"0,1"</item>
<item>"7,1"</item>
<item>"9,1"</item>
</string-array>
<!--
Whether WiFi display is supported by this device.
There are many prerequisites for this feature to work correctly.
Here are a few of them:
* The WiFi radio must support WiFi P2P.
* The WiFi radio must support concurrent connections to the WiFi display and
to an access point.
* The Audio Flinger audio_policy.conf file must specify a rule for the "r_submix"
remote submix module. This module is used to record and stream system
audio output to the WiFi display encoder in the media server.
* The remote submix module "audio.r_submix.default" must be installed on the device.
* The device must be provisioned with HDCP keys (for protected content).

-->
<bool name="config_enableWifiDisplay">true</bool>
<!--
Boolean indicating whether the wifi chipset has dual frequency band support
-->
<bool translatable="false" name="config_wifi_dual_band_support">true</bool>
<!--
Boolean indicating whether the wifi chipset has background scan support
-->
<bool translatable="false" name="config_wifi_background_scan_support">true</bool>
<!--
Setting this true forces the headset jack switches to use the/dev/input/event subsystem
rather than the uevent framework.
-->
<bool name="config_useDevInputEventForAudioJack">true</bool>
<!--
Indicate whether closing the lid causes the device to go to sleep and opening
it causes the device to wake up.
The default is false.
-->
<bool name="config_lidControlsSleep">true</bool>
<!--
Indicate whether to allow the device to suspend when the screen is off
due to the proximity sensor. This resource should only be set to true
if the sensor HAL correctly handles the proximity sensor as a wake-up source.
Otherwise, the device may fail to wake out of suspend reliably.
The default is false.
-->
<bool name="config_suspendWhenScreenOffDueToProximity">true</bool>
<!--
Vibrator pattern for feedback about a long screen/key press
-->
<integer-array name="config_longPressVibePattern">
<item>0</item>
<item>7</item>
<item>10</item>
</integer-array>
<!--
Vibrator pattern for feedback about touching a virtual key
-->
<integer-array name="config_virtualKeyVibePattern">
<item>0</item>
<item>5</item>
<item>10</item>
</integer-array>
<!--
Vibrator pattern for a very short but reliable vibration for soft keyboard tap
-->
<integer-array name="config_keyboardTapVibePattern">
<item>10</item>
</integer-array>
<!-- Wifi driver supports batched scan -->
<bool translatable="false" name="config_wifi_batched_scan_supported">true</bool>
<!-- MMS user agent string -->
<string name="config_mms_user_agent" translatable="false">Nexus5</string>
<!-- MMS user agent prolfile url -->
<string name="config_mms_user_agent_profile_url" translatable="false">http://gsm.lge.com/html/gsm/Nexus5-M3.xml</string>
<!-- Maximum number of supported users -->
<integer name="config_multiuserMaximumUsers">4</integer>
<!-- Whether Multiuser UI should be shown -->
<bool name="config_enableMultiUserUI">true</bool>
<!-- Is the device capable of hot swapping an UICC Card -->
<bool name="config_hotswapCapable">true</bool>
<!--
Configure mobile tcp buffer sizes in the form:
rat-name:rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
If no value is found for the rat-name in use, the system default will be applied.

-->
<string-array name="config_mobile_tcp_buffers">
<item>hsdpa:4094,87380,704512,4096,16384,110208</item>
<item>hspa:4094,87380,704512,4096,16384,110208</item>
<item>hsupa:4094,87380,704512,4096,16384,110208</item>
</string-array>
<!--
The RadioAccessFamilies supported by the device.
Empty is viewed as "all". Only used on devices which
don't support RIL_REQUEST_GET_RADIO_CAPABILITY
format is UMTS|LTE|...
-->
<string translatable="false" name="config_radio_access_family">GSM | WCDMA | LTE | CDMA | EVDO</string>
<!--
Flag indicating if device supports EAP SIM, AKA, AKA'
-->
<bool name="config_eap_sim_based_auth_supported">false</bool>
<!--
Hardware keys present on the device, stored as a bit field.
This integer should equal the sum of the corresponding value for each
of the following keys present:
1 - Home
2 - Back
4 - Menu
8 - Assistant (search)
16 - App switch
32 - Camera
64 - Volume rocker
For example, a device with Home, Back and Menu keys would set this
config to 7.
-->
<integer name="config_deviceHardwareKeys">64</integer>
<!--
Hardware keys present on the device with the ability to wake, stored as a bit field.
This integer should equal the sum of the corresponding value for each
of the following keys present:
1 - Home
2 - Back
4 - Menu
8 - Assistant (search)
16 - App switch
32 - Camera
64 - Volume rocker
For example, a device with Home, Back and Menu keys would set this
config to 7.
<integer name="config_deviceHardwareWakeKeys">64</integer>
-->
<!-- Doze mode -->
<string name="config_dozeComponent">
com.android.systemui/com.android.systemui.doze.DozeService
</string>
<integer name="config_screenBrightnessDoze">10</integer>
<bool name="config_dozeAfterScreenOff">true</bool>
<bool name="config_powerDecoupleInteractiveModeFromDisplay">true</bool>
</resources>

Start the build:

In the root of your AOSPExtended folder start your build environment with this command:

source build/envsetup.sh

Use this command to see what devices are availible to build:

lunch

Select aosp_hammerhed in the menu (usually it is under number 2.)

Start the build with this command:

mka aex

Now the build should start.