Skip to content

Instantly share code, notes, and snippets.

@jhorstmann
Created January 8, 2012 22:15
Show Gist options
  • Save jhorstmann/1579903 to your computer and use it in GitHub Desktop.
Save jhorstmann/1579903 to your computer and use it in GitHub Desktop.
How to modify android-x86 asus_laptop image to add rtl8192se wireless lan driver

The "intellibook" netbook contains a rtl8192se pci network chip that is not currently included in the android-x86 builds. I could not get a complete self-build image to work so I decided to add the neccessary drivers to the existing release from 20120101. This has the added benefit that the installation contains the google apps, which are not included in the source download. The image can be downloaded from http://www.android-x86.org/releases/build-20120101 (android-x86-4.0-asus_laptop-20120101.iso).

Extract the iso image and the contained squashfs image and mount the contained filesystem image as a loopback device.

$ bsdtar -C android-image -xf android-x86-4.0-asus_laptop-20120101.iso
$ cd android-image
$ unsquashfs system.sfs
$ sudo mkdir /mnt/iso
$ sudo mount ./squashfs-root/system.img /mnt/iso  -o loop

In the android-x86 build the boot folder is in a separate location so we move it from the extracted image to repack it later.

$ mkdir -p ~/Temp/boot
$ mv android-image/isolinux ~/Temp/boot

In you android-x86 build environment edit device/asus/laptop/laptop_defconfig and apply the following patch:

diff --git a/laptop/laptop_defconfig b/laptop/laptop_defconfig
index befb89e..f8d4320 100644
--- a/laptop/laptop_defconfig
+++ b/laptop/laptop_defconfig
@@ -1242,10 +1242,12 @@ CONFIG_RT2X00_LIB_FIRMWARE=y
 CONFIG_RT2X00_LIB_CRYPTO=y
 CONFIG_RT2X00_LIB_LEDS=y
 # CONFIG_RT2X00_DEBUG is not set
-# CONFIG_RTL8192CE is not set
-# CONFIG_RTL8192SE is not set
-# CONFIG_RTL8192CU is not set
-# CONFIG_WL is not set
+CONFIG_RTL8192CE=m
+CONFIG_RTL8192SE=m
+CONFIG_RTL8192CU=m
+CONFIG_RTLWIFI=m
+CONFIG_RTL8192C_COMMON=m
+CONFIG_WL=m

Build the image

$ make -j8 iso_img TARGET_PRODUCT=asus_laptop

Copy the kernel modules and dependency information to the mounted filesystem image.

$ sudo cp -r out/target/product/laptop/system/lib/modules/3.0.8-android-x86-asus-laptop+/kernel/drivers/net/wireless/rtlwifi /mnt/iso/lib/modules/3.0.8-android-x86-asus-laptop+/kernel/drivers/net/wireless
$ sudo cp -r out/target/product/laptop/system/lib/modules/3.0.8-android-x86-asus-laptop+/modules.* /mnt/iso/lib/modules/3.0.8-android-x86-asus-laptop+

Copy the firmware from a local Ubuntu installation.

$ sudo cp -r /lib/firmware/rtlwifi /mnt/iso/lib/firmware

Unmount the filesystem image and rebuilt the iso.

$ sudo umount /mnt/iso/
$ mksquashfs squashfs-root/system.img system.sfs
$ cd ..
$ genisoimage -vJURT -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -input-charset utf-8 -V "Android-x86 LiveCD" -o android-image.iso ~/Temp/boot/ android-image/ramdisk.img android-image/initrd.img anndroid-image/initrd.img android-image/install.img android-image/system.sfs android-image/kernel 

Modify the image so it is also bootable from an USB stick.

$ isohybrid android-image.iso

Write the modified iso image to the USB stick connected to /dev/sdb.

$ sudo dd if=android-image.iso of=/dev/sdb
@wortel123
Copy link

Hi,

I have been trying to follow your guide but i can't get it to work. I don't know
where I can find the laptop_defconfig file and building the image also gives a problem (no target or something)
The two first steps work well.

Do you mind to upload your build please? (if possible a android 3.2 build) I have the same wifi.
Thanks in regard,

Wouter

@jhorstmann
Copy link
Author

The laptop_defconfig is contained in the android-x86 source download. See http://www.android-x86.org/getsourcecode, http://source.android.com/source/initializing.html or https://gist.github.com/1578001 for descriptions how to set up a build environment. The firmware files are now included in the checkout (http://git.android-x86.org/?p=device/common.git;a=commit;h=eea2990cab336d2f298e1d34513c1f67d6000fbd).

@ronclone
Copy link

My friend jhorstmann, im sorry to say my linux knowlege is pretty low. this image (android-x86-4.0-asus_laptop-20120101.iso) is working amazing in my r400, the only problem is connectivity. No Wifi not ethernet. i have the same pci network chip (rtl8192se), i would be really grateful if you somehow manage to send me or upload the system.sfs with the drivers already injected. Well i think the only thing i need is the system.sfs, right?

Edit: maybe a typo but your genisoimage has "android-image/initrd.img anndroid-image/initrd.img" it should be only the first one.

Edit 2: problem patching the laptop_defconfig file. Ended up doing it manually.

patching file laptop/laptop_defconfig
Hunk #1 FAILED at 1242
1 out of 1 hunk FAILED -- saving rejects to file laptop/laptop_defconfig.rej

Edit 3: Finally manage to build the image, got it working... thanks!! had to learn a lot about linux, complete noob. Will upload the kernel modules later though, it will make things soo much easier for everyone interested.

@maaw
Copy link

maaw commented Jun 10, 2013

I know this is a very old post. First of all, thank you for your detailed step-by-step guide. I own a Lenovo Yoga 13, that has the same (POS) WiFi adapter. Android x86 won't work because of UEFI, but Android-IA (Intel customized Android) does, and very nicely, though it has no support for this adapter. As my knowledge in this matter is very short, I couldn't figure how to "translate" this guide to Android-IA and Lenovo Yoga specifications. Could you tell me which steps should I change?
Thanks in advance!
EDIT: My bad, the Yoga has the 8723A adapter, but the steps should be the same.

@wescovich
Copy link

I got lost at this step. In you android-x86 build environment edit device/asus/laptop/laptop_defconfig and apply the following patch: I setup my build environment and i searched the folders for this and i find asus but no laptop folder and no deconfig. Plus i am trying to subsitute for the realtek rtl8723 for lenovo yoga. Any help in getting this build compiled will be met with a monetary reward.

@JMarques-TILD
Copy link

Thanks. Works for add an APK to system folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment