[General Questions and Answers] zoevas:
I am trying to cross-compile the Openvswitch for Galaxy Nexus.

Kernel version

I have downloaded and built successfully the omap kernel for Galaxy nexus following the instructions from AOSP official page. The kernel is located in my desktop in the folder /home/zoe/AOSP/omap. The kernel is 3.0.72 version.

I have downloaded the Android NDK r5b, so as to use the cross-compiler from toolchain arm-eabi-4.4.0. Though i tried many other versions of toolchain, none of them worked.

OpenVswitch version

I tried many versions. 1.7.0, 1.9.3, 2.0.0, but all of them give me the same error(openvswitch.ko undefined!) .

Initialize enviornment

First i run the following commands

export ANDROID_NDK_ROOT=/home/zoe/android-ndk-r5b
export ANDROID_KERNEL=/home/zoe/AOSP/omap

Then i set the PATH so as the cross-compiler can be found:

export PATH=$PATH:/home/zoe/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin

cd openvswitch-2.0.0

Then i generate the configure file:

./boot.sh

Then, i run configure:

./configure --host=arm-eabi CC=arm-eabi-gcc CPPFLAGS="-I$ANDROID_NDK_ROOT/platforms/android-8/arch-arm/usr/include/" CFLAGS="-nostdlib" LDFLAGS="-Wl,-rpath-link=$ANDROID_NDK_ROOT/platforms/android-8/arch-arm/usr/lib/ -L$ANDROID_NDK_ROOT/platforms/android-8/arch-arm/usr/lib/" LIBS="-lc " ovs_cv_use_linker_sections=no --with-l26=$ANDROID_KERNEL KARCH=arm --with-rundir=/data/local/var

Add the following line into Makefile.main:

change the

$(MAKE) -C $(KSRC) M=$(builddir) modules

to

$(MAKE) -C $(KSRC) M=$(builddir) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules

When i do ARCH=arm CROSS_COMPILE=arm-eabi- make in the openvswitch folder, at the Building modules stage 2 i get many errors and warnings saying that the openvswitch.ko is undefined:

Error message

Building modules, stage 2.
MODPOST 1 modules
WARNING: "register_netdevice" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kmem_cache_destroy" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kmalloc_caches" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__kmalloc" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_gso_segment" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "register_pernet_device" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_unlock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "del_timer" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "strlen" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "rcu_barrier" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "genl_unregister_family" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "autoremove_wake_function" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "ip_local_out" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "get_random_bytes" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "netdev_rx_handler_register" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "rtnl_lock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_copy_and_csum_dev" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "dst_release" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_lock_bh" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_clone" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "dev_get_by_name" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_find_next_bit_le" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "register_netdevice_notifier" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__alloc_percpu" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "inet_proto_csum_replace4" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "sock_create_kern" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "mutex_unlock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "call_rcu" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "crc32c" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kthread_create_on_node" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "jiffies" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "free_percpu" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "unregister_netdevice_notifier" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_trim" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "strcmp" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "netif_rx" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__pskb_pull_tail" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__init_waitqueue_head" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nr_cpu_ids" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nla_memcpy" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "wait_for_completion" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__memzero" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nlmsg_notify" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "memset" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "net_namespace_list" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_checksum" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "random32" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_unlock_irqrestore" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "jiffies_to_msecs" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "printk" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "ethtool_op_get_link" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kthread_stop" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "memcmp" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "unregister_pernet_device" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "ipv6_ext_hdr" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__skb_warn_lro_forwarding" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nla_find" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "free_netdev" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "strncpy" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nla_put" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_unlock_irq" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "strlcpy" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kmem_cache_free" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "warn_slowpath_null" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_push" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "mutex_lock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "dev_get_by_index_rcu" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__skb_get_rxhash" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "sk_free" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "netlink_unicast" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__rcu_read_unlock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "add_timer" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "genl_register_family_with_ops" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_pull" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "init_net" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "flex_array_get" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "ksize" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__do_div64" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "boot_tvec_bases" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "local_bh_disable" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__secpath_destroy" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kmem_cache_alloc" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__nla_reserve" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__alloc_skb" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "sk_release_kernel" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "netlink_broadcast" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_unlock_bh" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nla_parse" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "cpu_possible_mask" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "netdev_rx_handler_unregister" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_checksum_help" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "schedule" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kfree_skb" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_lock_irq" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "local_bh_enable" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "alloc_netdev_mqs" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "eth_type_trans" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__bug" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "wake_up_process" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "pskb_expand_head" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "ether_setup" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kmem_cache_alloc_trace" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_lock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__per_cpu_offset" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_raw_spin_lock_irqsave" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nf_conntrack_destroy" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_pull_rcsum" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kmem_cache_create" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "unregister_netdevice_queue" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "ip_route_output_flow" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "ktime_get_ts" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__wake_up" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "net_ratelimit" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "netlink_set_err" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "flex_array_free" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kthread_should_stop" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "dev_set_promiscuity" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kfree" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "memcpy" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "prepare_to_wait" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "kernel_bind" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "genl_register_mc_group" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "flex_array_alloc" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "finish_wait" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_set_bit" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "nla_reserve" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "complete" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_test_and_set_bit" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "memmove" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "csum_partial" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "consume_skb" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "dev_queue_xmit" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__rcu_read_lock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "_clear_bit" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_put" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "skb_copy_bits" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "inet_get_local_port_range" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "rtnl_unlock" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__ip_select_ident" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "__nla_put" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
WARNING: "flex_array_prealloc" [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.ko] undefined!
CC /home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.o
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:8: error: variable '__this_module' has initializer but incomplete type
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:9: error: unknown field 'name' specified in initializer
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:9: warning: excess elements in struct initializer
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:9: warning: (near initialization for '__this_module')
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:10: error: unknown field 'init' specified in initializer
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:10: warning: excess elements in struct initializer
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:10: warning: (near initialization for '__this_module')
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:14: error: unknown field 'arch' specified in initializer
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:14: error: 'MODULE_ARCH_INIT' undeclared here (not in a function)
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:14: warning: excess elements in struct initializer
/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.c:14: warning: (near initialization for '__this_module')
make[5]: *** [/home/zoe/openvswitch-2.0.0/datapath/linux/openvswitch.mod.o] Error 1
make[4]: *** [modules] Error 2
make[4]: Leaving directory `/home/zoe/AOSP/omap'
make[3]: *** [default] Error 2
make[3]: Leaving directory `/home/zoe/openvswitch-2.0.0/datapath/linux'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/zoe/openvswitch-2.0.0/datapath'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/zoe/openvswitch-2.0.0'
make: *** [all] Error 2

Question: I cannot find what is the problem. I guess that the version of kernel is the cause of this error message. The version of the kernel used is 3.0.72. My Galaxy Nexus has Android 4.3 API. If i flash linux kernel version 2.6, will the phone be bricked?