Code Monkey home page Code Monkey logo

kernel_wm8505's Introduction

(These are notes about the WM8505 kernel port, please see README.linux
for the original Linux kernel README.)

* This is based on kernel 2.6.29 sources released by VIA
  (http://lists.gpl-violations.org/pipermail/legal/2010-July/002204.html).

* You may also want to see http://gitorious.org/linux-on-via-vt8500
  which is a clean kernel implementation for VT8500/WM8505, written
  largely from scratch. However, at time of writing the clean kernel
  supports less WM8505 hardware than this kernel does.

* These sources currently come with one sourceless binary object file
  (for SD card support.)

* This kernel will not work on VT8500-based machines. WM8505 only.


******** PREREQUISITES ********

- A host running Linux to build from. You may be able to build from
  BSD/OSX as well, I don't know.

- An appropriate ARM cross-compiler toolchain. Make sure it has EABI support.

  Recommended/tested choices are Emdebian for Debian/Ubuntu hosts, or
  the Android NDK toolchain for other hosts (see below.) Problems have
  been reported using CodeSourcery.

- The mkimage tool installed on your host. On Debian/Ubuntu, the
  package to install is 'uboot-mkimage'


******** INSTALLING A TOOLCHAIN ********

**** Emdebian Option

  To install Emdebian on an Debian or Ubuntu host, follow the steps
    under "Get the Binaries" on emdebian wiki:
    http://wiki.debian.org/EmdebianToolchain#Getthebinaries (you don't
    need all those packages listed there to just compile a kernel, but
    they don't hurt.)

  Before building, you will need to set an environment variable for
  your cross-compiler:

    export CROSS_COMPILE=arm-linux-gnueabi-   

  (you can alternately supply this on the command-line to make, if you desire.)


**** Android NDK Option

   To install the Android NDK, first download from 
	http://developer.android.com/sdk/ndk/index.html

	Then untar it to your chosen install point and add the prebuilt 
   binary toolchain to your path. The steps will be something like:
	  cd /usr/local
	  sudo tar jxvf ~/Downloads/android-ndk-r5b-linux-x86.tar.bz2
     sudo chmod -R +rX android-ndk-r5b/
     export PATH="$PATH:`pwd`/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin"

   You will probably want to add the last line above to your .bashrc or
   similar, so the toolchain is always in your PATH

	You will also need to set the cross-compiler environment variable:
     
     export CROSS_COMPILE=arm-eabi-

   (you can alternately supply this on the command-line to make, if you desire.)



******** CONFIGURE YOUR FIRST KERNEL ********

After you have a toolchain, you can configure a WM8505 kernel with a
default config (defconfig) as follows:

For Eken M001 kernel suitable for Android:

   make eken_m001_android_defconfig ARCH=arm

For Eken M001 kernel more suitable for Debian:

   make eken_m001_debian_defconfig ARCH=arm

(Other WM8505 tablets/netbooks can probably use the M001 config as well.)


******** BUILD YOUR FIRST KERNEL ********

After you have a config, you can build a kernel:

  make via_obj uImage modules ARCH=arm

If compilation succeeds, the kernel image will be at arch/arm/uImage
(this file is equivalent to the uzImage.bin file used in common WM8505
boot environments, you can copy it over the top to change the kernel
which is installed/booted from SD.)

To install the built kernel modules somewhere, run:

  make modules_install ARCH=arm INSTALL_MOD_PATH=/some/staging/path


******** FURTHER CONFIGURATION **********

You can edit the current config with

  make menuconfig ARCH=arm

As well as the two recommended defconfigs, there are some older
configurations available under arch/arm/configs. These are not known
to work, and are mostly for comparison/information purposes only:

* arch/arm/configs/android_wm8505_config
* arch/arm/configs/wmt_defconfig

  These two came as-is with the source tarball.

* arch/arm/configs/wm8505_initial_config

  This file was the .config that came as-is the source tarball (different to the
  above two configs.)

* arch/arm/configs/eken_m001_factory_configuration
  
  This is a dump of /proc/config.gz on a factory Eken M001 kernel (different again.)


******** OTHER BUILDING NOTES ********

* The via_obj target is a custom VIA target to copy the mmc_atsmb.o
  file into the source tree before building. VIA/Wondermedia have not
  released this one source file.

* If you are building for Android, and you want to use some of the
  binary-only kernel modules that came with WM8505 Android by default
  (or vice-versa if you want to use a new module with an old kernel),
  then you need to force the kernel revision so they will load. This is
  a horrible hack, but even WM seem to do it in their Android releases.

  Do this by overriding the KERNELRELEASE make variable on the command line
  as KERNELRELEASE=2.6.29-00236-g4f8dbbb-dirty - ie:

  make uImage modules ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- KERNELRELEASE=2.6.29-00236-g4f8dbbb-dirty


**** u-boot scripts

U-boot boot scripts for SD card booting/installing are saved at the path
'script/scriptcmd' on SD card.

To read a scriptcmd:

  tail -c +72 scriptcmd

To write a scriptcmd:

	mkimage -A arm -O linux -T script -C none -a 1 -e 0 -n "script image" -d cmd scriptcmd

(Where 'cmd' is your source scriptcmd script.)


******* kernel arguments ******

Scriptcmd has a line for kernel args:

  setenv bootargs mem=112M root=/dev/mmcblk0p2 lcdid=1 console=ttyS0,115200n

Relevant args:

* mem=112M 
  is also mem=109M on non-Android boots. Suspect extra 3M is video memory?!?

* console=ttyS0,115200n 
  gives you kernel console on serial. If you're building for Debian or
  any other non-Android userland then you may want to remove this, and enable
  framebuffer console in configuration (this is enabled already in Debian 
  defconfig.)

* lcdid=1 enables VOUT to LCD on tablets. Some other machines
  (netbooks?) use VT1632 which is the default if lcdid is not set (in
  this case, you won't see any video on a tablet.)



****** WiFi Driver ******

This tree contains the rt2870sta kernel module, backported from kernel
2.6.35. I have had mixed success with this driver, you may also want
to try Ralink's OEM source release driver (especially on Android.) 

The WiFi driver that ships with WM8505 Android is a custom one with
vendor-specific patches to enable the GPIO and load the firmware. If
you go with a standard driver, you will need to perform these
functions yourself:

- Run these commands to turn on the Signal GPIO that powers the USB
  stick inside the Eken. We'll probably come up with something better
  eventually, but for now:

  echo out > /sys/class/gpio/gpio2/direction
  echo 1 > /sys/class/gpio/gpio2/value
  modprobe rt2870sta


- Install a firmware file. To get a firmware file in debian, you
  can install firmware-ralink from non-free. Alternatively, download
  the USB firmwares from http://www.ralink.com.tw/support.php?s=2

  The rt2870.bin firmware will do as long as it's recent.

  You can choose to load the firmware at runtime, or to compile it
  directly into the kernel. Choosing to compile it in is currently the
  path of least resistance for most userlands (look in menuconfig
  under (under Device Drivers -> Generic Driver Options -> Include
  in-kernel firmware blobs...)


  

kernel_wm8505's People

Contributors

adrianbunk avatar akpm00 avatar alan-cox avatar alanstern avatar bzolnier avatar cfd-36 avatar chrismason-xx avatar davem330 avatar dhowells avatar dwmw2 avatar gregkh avatar herbertx avatar hharrison avatar htejun avatar hverkuil avatar jmberg avatar kaber avatar lenb avatar mchehab avatar mkrufky avatar neilbrown avatar ozbenh avatar paulusmack avatar pmundt avatar ralfbaechle avatar rddunlap avatar sfrothwell avatar tiwai avatar torvalds avatar xemul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kernel_wm8505's Issues

Remove reference to arm_v5t_le- from Makefile

There's leftover from upstream vendor:

CROSS_COMPILE ?= arm_v5t_le-

arm_v5t_le- should be removed from there, leaving in pristine state. Otherwise, it produces confusing output:

 $ make via_obj
 make: arm_v5t_le-gcc: Command not found
 cp -Rf ./via_obj.arm_v5t-2629.01/* ./

Kernel no longer builds on Ubuntu 16.04

I am trying to build this kernel for a generic netbook I have, but I am running into problems. My environment is Ubuntu 16.04 with gcc-5-arm-linux-gnueabi. When I follow the instructions in the README and I execute the command make via_obj uImage modules ARCH=arm, I get this output:

cp -Rf ./via_obj.arm_v5t-2629.01/* ./
CHK include/linux/version.h
make[1]: 'include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CC kernel/bounds.s
GEN include/linux/bounds.h
CC arch/arm/kernel/asm-offsets.s
GEN include/asm/asm-offsets.h
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented [-Wcpp]
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented [-Wcpp]
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented [-Wcpp]
<stdin>:1325:2: warning: #warning syscall ppoll not implemented [-Wcpp]
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented [-Wcpp]
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
scripts/mod/modpost.c: In function ‘get_markers’:
scripts/mod/modpost.c:1542:4: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt);
^
scripts/mod/modpost.c: In function ‘add_marker’:
scripts/mod/modpost.c:1962:2: warning: ignoring return value of ‘asprintf’, declared with attribute
warn_unused_result [-Wunused-result]
asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt);
^
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
HOSTCC scripts/ihex2fw
scripts/ihex2fw.c: In function ‘output_records’:
scripts/ihex2fw.c:261:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(outfd, &p->addr, writelen);
^
scripts/ihex2fw.c:266:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(outfd, zeroes, 6);
^
HOSTCC scripts/kallsyms
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:74:4: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(str, 500, in);
^
HOSTCC scripts/conmakehash
HOSTCC scripts/bin2c
CC init/main.o
In file included from include/linux/mempolicy.h:62:0,
from init/main.c:51:
include/linux/pagemap.h: In function ‘fault_in_pages_readable’:
include/linux/pagemap.h:416:16: warning: variable ‘c’ set but not used [-Wunused-but-set-variable]
volatile char c;
^
init/main.c: In function ‘start_kernel’:
init/main.c:558:9: warning: format not a string literal and no format arguments [-Wformat-security]
printk(linux_banner);
^
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
CC init/do_mounts.o
In file included from include/linux/nfs_fs.h:45:0,
from init/do_mounts.c:18:
include/linux/pagemap.h: In function ‘fault_in_pages_readable’:
include/linux/pagemap.h:416:16: warning: variable ‘c’ set but not used [-Wunused-but-set-variable]
volatile char c;
^
CC init/do_mounts_rd.o
CC init/do_mounts_initrd.o
LD init/mounts.o
CC init/initramfs.o
init/initramfs.c: In function ‘populate_rootfs’:
init/initramfs.c:582:3: warning: format not a string literal and no format arguments [-Wformat-security]
panic(err);
^
CC init/calibrate.o
LD init/built-in.o
init/mounts.o: In functiontty_driver_kref_get': do_mounts_initrd.c:(.text+0x0): multiple definition of tty_driver_kref_get'
init/main.o:main.c:(.text+0x0): first defined here
scripts/Makefile.build:291: recipe for target 'init/built-in.o' failed
make[1]: *** [init/built-in.o] Error 1
Makefile:869: recipe for target 'init' failed
make: *** [init] Error 2

I'm pretty sure a lot of that is ignorable, such as -Wformat-security warnings, I don't know why I'm getting multiple definitions of the function tty_driver_kref_get. The only editing I have done to the source is adding in a modern compiler-gcc5.h to include/linux.

Any help is appreciated.

Setting KERNELRELEASE

After trying your latest build procedure (as per
https://github.com/projectgus/kernel_wm8505#readme), I tried to use a
newly compiled wmt_battery.ko in my netbook, but:

insmod /.driver/wmt_battery.ko

failed (because of an error message that I miss now).

It worked (and I could see my own debugging messages, with "dmesg")
only after I recompiled the module setting "KERNELRELEASE" at command
line. I.e.

make modules_install ARCH=arm INSTALL_MOD_PATH=./modules/staging
KERNELRELEASE=2.6.29-00236-g4f8dbbb-dirty

Indeed, "strings wmt_battery.ko | grep vermagic" didn't return the
content of KERNELRELEASE (as it should) if I used the "export
KERNELRELEASE=..." mode. I always used "export CROSS_COMPILE=arm-
eabi-" instead.

Get rid of vendor's ubin target

Verify that adhoc ubin and mainline uImage targets produce essentially the same kernel binary (by comparing commands and booting to kernels, if needed), and get rid of ubin target.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.