++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
http://www.android-x86.org/getsourcecode
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

---------------------------------------------------------------------------
install repo
---------------------------------------------------------------------------
cp /opt/share-vm/fedora23server-share/repo /usr/bin/
scp /opt/share-vm/fedora23server-share/repo 10.109.253.80:/usr/bin/

---------------------------------------------------------------------------
The branches in Android-x86 tree
---------------------------------------------------------------------------
    nougat-x86
    Based on Android 7.0 release (Nougat).
    marshmallow-x86
    Based on Android 6.0 release (Marshmallow).
    lollipop-x86
    Based on Android 5.0 release (Lollipop).
    kitkat-x86
    Based on Android 4.4 release (KitKat).
    jb-x86
    Based on Android 4.3 release (Jelly Bean).
    ics-x86
    Based on Android 4.0 release (Ice Cream Sandwich).
    honeycomb-x86
    Based on Android 3.2 release (Honeycomb).
    gingerbread-x86
    Based on Android 2.3 release (Gingerbread).
    froyo-x86
    Based on Android 2.2 release (Froyo).
    eclair-x86
    Based on Android 2.1 release (Eclair).
    donut-x86
    Based on Android 1.6 release (Donut).
    cupcake-x86 (aka android-x86-v0.9)
    Based on Android 1.5 release (Cupcake).
---------------------------------------------------------------------------
Getting Android-x86 source code
---------------------------------------------------------------------------
http://www.android-x86.org/getsourcecode

[root@localhost android-x86-6.0-rc2]# pwd
/opt/android-x86/android-x86-6.0-rc2

[root@localhost android-x86-6.0-rc2]# 

repo init -u git://gitscm.sf.net/gitroot/android-x86/manifest -b marshmallow-x86
repo sync --no-tags --no-clone-bundle

--------------------------------------------
If you have issues to sync from the above URL, try the alternative one
--------------------------------------------
repo init -u http://git.code.sf.net/p/android-x86/sf-manifest -b marshmallow-x86
repo sync --no-tags --no-clone-bundle

repo init -u http://git.code.sf.net/p/android-x86/sf-manifest -b $branch
Where $branch could be nougat-x86 or marshmallow-x86. Older branches are not supported by this URL.
--------------------------------------------

Note: The Android-x86 repository is very big (about > 10GB). If you encounter problems of sync it, it's likely a network problem or our server is too busy. Repeatedly run 'repo sync' until it succeeds without any error. Do not bother us with any of the syncing problem.

--------------------------------------------
download OK
--------------------------------------------

[root@localhost android-x86]# du -hs android-x86-6.0-rc2

24G	android-x86-6.0-rc2

[root@localhost android-x86]# ls -a android-x86-6.0-rc2

.    art       build        device      hardware  libnativehelper  packages          .repo
..   bionic    dalvik       external    kernel    Makefile         platform_testing  sdk
abi  bootable  development  frameworks  libcore   ndk              prebuilts         system

[root@localhost android-x86]# 




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
compile
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@localhost ~]# cd /opt/android-x86/android-x86-6.0-rc2/
[root@localhost android-x86-6.0-rc2]# cat /etc/redhat-release
Fedora release 24 (Twenty Four)

[root@localhost ~]# uname -a
Linux localhost.localdomain 4.5.5-300.fc24.x86_64 #1 SMP Thu May 19 13:05:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:            62G        488M        268M        1.8M         62G         61G
Swap:            9G          4K          9G
[root@localhost ~]# 

[root@localhost ~]# cat /proc/cpuinfo
processor	: 31
vendor_id	: GenuineIntel
cpu family	: 6
model		: 62
model name	: Intel(R) Xeon(R) CPU E5-2640 v2 @ 2.00GHz
stepping	: 4
microcode	: 0x428
cpu MHz		: 1201.484
cache size	: 20480 KB
physical id	: 1
siblings	: 16
core id		: 7
cpu cores	: 8
apicid		: 47
initial apicid	: 47
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts
bugs		:
bogomips	: 4004.93
clflush size	: 64
cache_alignment	: 64
address sizes	: 46 bits physical, 48 bits virtual
power management:



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
need java-1.7.0-openjdk, not java-1.8.0-openjdk
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

java -version

[root@localhost gem5-stable]# ls /usr/lib/jvm/
java                                           java-openjdk       jre-1.8.0-openjdk-1.8.0.91-6.b14.fc23.x86_64
java-1.8.0                                     jre                jre-openjdk
java-1.8.0-openjdk                             jre-1.8.0
java-1.8.0-openjdk-1.8.0.91-6.b14.fc23.x86_64  jre-1.8.0-openjdk
[root@localhost gem5-stable]# 

============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
 
Your version is: openjdk version "1.8.0_91" OpenJDK Runtime Environment (build 1.8.0_91-b14) OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode).
The required version is: "1.7.x"
 
Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:171: *** stop

#### make failed to build some targets (28 seconds) ####

[root@localhost android-x86-6.0-rc2]# 
[root@localhost android-x86-6.0-rc2]# export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
[root@localhost android-x86-6.0-rc2]# export PATH=$JAVA_HOME/bin:$PATH
[root@localhost android-x86-6.0-rc2]# java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (fedora-2.5.4.2.fc20-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
[root@localhost android-x86-6.0-rc2]# 


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
install java-1.7.0-openjdk
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
http://koji.fedoraproject.org/koji/buildinfo?buildID=605625

download: http://pan.baidu.com/s/1hs0iVuk

dnf search openjdk
dnf install java-atk-wrapper
dnf install glibc.i686
dnf install libncurses.so.5


[root@localhost Desktop]# ls java-1.7.0-openjdk-*
java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-accessibility-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-debuginfo-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-demo-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-devel-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-src-1.7.0.75-2.5.4.2.fc20.x86_64.rpm

[root@localhost Desktop]# rpm -ivh --force --nodeps java-1.7.0-openjdk-*
[root@localhost Desktop]# java -version
[root@localhost Desktop]# ls /usr/lib/jvm/

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
export PATH=$JAVA_HOME/bin:$PATH

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


--------------------------------------------------
grub - set timeout=1
--------------------------------------------------
[root@localhost android-x86-6.0-rc2]# 

vim bootable/newinstaller/install/scripts/1-install

	echo -e "${GRUB_OPTIONS:-default=0\ntimeout=6\nsplashimage=/grub/android-x86.xpm.gz\n}root (hd0,$1)\n" > $menulst
--------------------------------------------------


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Android-x86 —— compile the source code —— VirtualBox
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
http://www.android-x86.org/getsourcecode

[root@localhost android-x86-6.0-rc2]# pwd
/opt/android-x86/android-x86-6.0-rc2

[root@localhost android-x86-6.0-rc2]# 

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
export PATH=$JAVA_HOME/bin:$PATH
. build/envsetup.sh
lunch android_x86_64-userdebug
m -j32 iso_img

// [root@localhost android-x86-6.0-rc2]# // lunch android_x86-userdebug



============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.1
TARGET_PRODUCT=android_x86_64
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_CPU_VARIANT=
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.6.4-301.fc24.x86_64-x86_64-with-fedora-24-Twenty_Four
HOST_BUILD_TYPE=release
BUILD_ID=MOB30M
OUT_DIR=out
============================================

[root@localhost android-x86-6.0-rc2]# m -j32 iso_img

Total translation table size: 6900
Total rockridge attributes bytes: 3312
Total directory bytes: 12288
Path table size(bytes): 88
Done with: The File(s)                             Block(s)    220429
Writing:   Ending Padblock                         Start Block 220473
Done with: Ending Padblock                         Block(s)    150
Max brk space used 23000
220623 extents written (430 MB)


out/target/product/x86_64/android_x86_64.iso is built successfully.


make: Leaving directory '/opt/android-x86/android-x86-6.0-rc2'

#### make completed successfully (01:28:59 (hh:mm:ss)) ####

[root@localhost android-x86-6.0-rc2]# 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@localhost android-x86-6.0-rc2]# ll -h out/target/product/x86_64/android_x86_64.iso

-rw-r--r--. 1 root root 431M 9月   8 15:46 out/target/product/x86_64/android_x86_64.iso

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//android-x86_64

scp 10.109.253.80:/opt/android-x86/android-x86-6.0-rc2/out/target/product/x86_64/android_x86_64.iso /opt/android-x86/tmp-iso-can-del/

//android-x86

scp 10.109.253.80:/opt/android-x86/android-x86-6.0-rc2/out/target/product/x86/android_x86.iso /opt/android-x86/tmp-iso-can-del/

then, reinstall android-x86 in VirtualBox

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, all is OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


----------------------------------------------------------------------------------------------------
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
kernel/drivers/net/wireless/wl/build.mk:11: recipe for target 'kernel/drivers/net/wireless/wl/Makefile' failed
make: *** [kernel/drivers/net/wireless/wl/Makefile] Error 2
make: *** 正在等待未完成的任务....
make: *** wait: No child processes。 停止。

#### make failed to build some targets (01:52 (mm:ss)) ####
-------------------------------------------------------------------------
原因:该源码包在下载过程中被破坏.
换个地址下载(有可能在另一个地址下载也不行,可能他们都是同一个源地址,建议多换几个)
----------------------------------------------------------------------------------------------------





----------------------------------------------------------------------------------------------------
dhcpcd	// comment all dhcpcd    only done in device/generic/common/init.x86.rc (that is, init.android_x86_64.rc)
----------------------------------------------------------------------------------------------------

[root@localhost android-x86-6.0-rc2]# grep dhcpcd -R system/

system/core/libnetutils/dhcp_utils.c:/* Utilities for managing the dhcpcd DHCP client daemon */
// system/core/libcutils/fs_config.c:  { 00550, AID_DHCP, AID_SHELL, 0, "system/etc/dhcpcd/dhcpcd-run-hooks" },

[root@localhost android-x86-6.0-rc2]# grep dhcpcd -R device/

device/generic/common/init.x86.rc:service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL




--------------------------------------------------
vi system/core/rootdir/init.rc
--------------------------------------------------

    # reflect fwmark from incoming packets onto generated replies
    write /proc/sys/net/ipv4/fwmark_reflect 1
    write /proc/sys/net/ipv6/fwmark_reflect 1

    # set fwmark on accepted sockets
    write /proc/sys/net/ipv4/tcp_fwmark_accept 1

service netd /system/bin/netd
    class main
    socket netd stream 0660 root system
    socket dnsproxyd stream 0660 root inet
    socket mdns stream 0660 root system
    socket fwmarkd stream 0660 root inet

service mdnsd /system/bin/mdnsd
    class main
    user mdnsr
    group inet net_raw
    socket mdnsd stream 0660 mdnsr inet
    disabled
    oneshot

--------------------------------------------------


--------------------------------------------------
vi device/generic/common/init.x86.rc
--------------------------------------------------
#import /init.bluetooth.rc

#service btattach /system/bin/btattach -Pbcm
#    class main
#    disabled
#    oneshot

#on property:init.svc.bluetoothd=running
#    exec -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh hci

#on property:init.svc.bluetoothd=stopped
#    exec -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh hci

#service wpa_supplicant /system/bin/wpa_supplicant -c/data/misc/wifi/wpa_supplicant.conf \
#    -iwlan0 -Dnl80211 \
#    -O/data/misc/wifi/sockets \
#    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
    #   we will start as root and wpa_supplicant will switch to user wifi
    #   after setting up the capabilities required for WEXT
    #   user wifi
    #   group wifi inet keystore
#    class main
#    socket wpa_wlan0 dgram 660 wifi wifi
#    disabled

#service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
#    class main
#    disabled
#    oneshot

#service iprenew_wlan0 /system/bin/dhcpcd -n
#    class main
#    disabled
#    oneshot

service dhcpcd_eth0 /system/bin/dhcpcd -ABDKL
    class main
    disabled
    oneshot

service iprenew_eth0 /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

#on property:init.svc.wpa_supplicant=stopped
#    stop dhcpcd
--------------------------------------------------





++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
recompile modified Android
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@localhost android-x86-6.0-rc2]# pwd
/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/android-x86/android-x86-6.0-rc2
[root@localhost android-x86-6.0-rc2]# 

cp frameworks/base/services/java/com/android/server/SystemServer.java .
gedit SystemServer.java
#--------------------------------------------------------------------

// recompiled android-x86-6.0-rc2

// otherwise, can't forward packages
#--------------------------------------------------------------------

scp SystemServer.java 10.109.253.80:/opt/android-x86/android-x86-6.0-rc2/frameworks/base/services/java/com/android/server/SystemServer.java


/*
 * return to IBM-X3650-M4
 */

[root@localhost android-x86-6.0-rc2]# pwd

/opt/android-x86/android-x86-6.0-rc2

[root@localhost android-x86-6.0-rc2]# 

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
export PATH=$JAVA_HOME/bin:$PATH
. build/envsetup.sh
lunch android_x86_64-userdebug
m -j32 iso_img

[root@localhost android-x86-6.0-rc2]# ll -h /opt/android-x86/android-x86-6.0-rc2/out/target/product/x86_64/android_x86_64.iso

-rw-r--r--. 1 root root 431M 7月  14 22:21 /opt/android-x86/android-x86-6.0-rc2/out/target/product/x86_64/android_x86_64.iso



/*
 * return to PC
 */

[root@localhost 158a840e-63fa-4544-b0b8-dc0d40c79241]# pwd
/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241
[root@localhost 158a840e-63fa-4544-b0b8-dc0d40c79241]# 

scp 10.109.253.80:/opt/android-x86/android-x86-6.0-rc2/out/target/product/x86_64/android_x86_64.iso .

mv android_x86_64.iso android-x86_64-6.0-rc1.iso

/*
 * then to install android_x86_64.iso in VirtualBox
 */


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, all is OK OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modify some files - http://blog.csdn.net/ztguang/article/details/51921491  (NO USE) (NO USE) (NO USE)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// vi system/core/rootdir/init.rc  // sh /system/xbin/quagga/sbin/init_in_android-x86_64.sh

scp /opt/share-vm/fedora23server-share/seem_init.sh 10.109.253.80:/opt/android-x86/android-x86-6.0-rc2/device/generic/common/


vi device/generic/common/device.mk
    // after 31 line, add:
    $(if $(wildcard $(PRODUCT_DIR)seem_init.sh),$(PRODUCT_DIR),$(LOCAL_PATH)/)seem_init.sh:system/etc/seem_init.sh \

vi system/core/rootdir/init.rc
    // at the end of the file, add:
    service seem_init /system/etc/seem_init.sh
        class main
        user root
        group root
        oneshot

vi system/core/rootdir/init.rc
    // at 500 line, in section "on boot", add two lines:
    setprop net.tcp.default_init_rwnd 60	(already exist)
    chown root shell /system/etc/seem_init.sh
    chmod 0550 /system/etc/seem_init.sh

vi system/core/libcutils/fs_config.c
    // at 112 line, in section "on boot", add one line:
    { 00550, AID_ROOT,      AID_SHELL,     0, "system/etc/init.goldfish.sh" },	(already exist)
    { 00550, AID_ROOT,      AID_SHELL,     0, "system/etc/seem_init.sh" },

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

^^^^^^^^^^^^^^^^^^^^^^
[root@localhost android-x86-6.0-rc2]# grep enableForwarding -R system/

system/netd/server/TetherController.cpp:bool TetherController::enableForwarding(const char* requester) {
system/netd/server/CommandListener.cpp:            success = sTetherCtrl->enableForwarding(argv[2]);

^^^^^^^^^^^^^^^^^^^^^^
[root@localhost android-x86-6.0-rc2]# grep ipfwd -R frameworks/ |grep enable

frameworks/base/services/core/java/com/android/server/NetworkManagementService.java:            mConnector.execute("ipfwd", enable ? "enable" : "disable", "tethering");

^^^^^^^^^^^^^^^^^^^^^^
[root@localhost android-x86-6.0-rc2]# grep setIpForwardingEnabled -R frameworks/

frameworks/base/services/core/java/com/android/server/connectivity/Tethering.java:                    mNMService.setIpForwardingEnabled(true);




^^^^^^^^^^^^^^^^^^^^^^


^^^^^^^^^^^^^^^^^^^^^^


^^^^^^^^^^^^^^^^^^^^^^


^^^^^^^^^^^^^^^^^^^^^^



./kernel/kernel/sysctl_binary.c:	{CTL_INT,	NET_IPV4_FORWARD,			"ip_forward" },