Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8291923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:17:50+00:00 2026-06-08T13:17:50+00:00

I am trying to create a simple kernel module. I am trying to print

  • 0

I am trying to create a simple kernel module.
I am trying to print messages to dmesg but i keep getting

insmod: init_module ‘hello.ko’ failed (Exec format error) in android

after :
dmesg:
unknown relocation: 27

#include <linux/module.h>
#include <linux/kdb.h>
int init_module(void)
{
    printk(KERN_ALERT "Hello world!\n");
    return 1;
}

void cleanup_module(void)
{
    printk(KERN_INFO "Goodbye world 1.\n");
}
MODULE_AUTHOR("Robert P. J. Day");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_VERSION("2:1.0") ;
MODULE_DESCRIPTION("You have to start somewhere.");

The make file

    obj-m +=hello.o


KERNELDIR ?= ~/android/kernel/common
#KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
CROSS_COMPILE=~/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-

ARCH=arm
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules

clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
rm *.symvers

does anyone know why? And how to get it working?

I found after doing a readelf that when it is compiled the relocation section is pointing to the wrong directions.

Offset     Info    Type            Sym.Value  Sym. Name
00000008  0000171b R_ARM_PLT32       00000000   printk

When in fact it should be:

Offset     Info    Type            Sym.Value  Sym. Name
00000008  0000171c R_ARM_CALL       00000000   printk

Can someone guess/know how this might be?
Thanks @Chris Stratton for helping me this far.


I found after doing a readelf that when it is compiled the relocation section is pointing to the wrong directions.

Offset     Info    Type            Sym.Value  Sym. Name
00000008  0000171b R_ARM_PLT32       00000000   printk

When in fact it should be:

Offset     Info    Type            Sym.Value  Sym. Name
00000008  0000171c R_ARM_CALL       00000000   printk

Can someone guess/know how this might be? Thanks @Chris Stratton for helping me this far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T13:17:52+00:00Added an answer on June 8, 2026 at 1:17 pm

    It turns out I had to use

    make CFLAGS_MODULE=-fno-pic
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to create a simple pan and zoom app using silverlight 4, but
Im trying to create a simple input box with form validation, but im not
I'm trying to create simple urlMapping, but it doesn't work. It goes into constructor,
I am trying to create a simple JQuery Div Slider, but it doesn't seem
I'm trying create a simple audio stream server like a concept proof, but I'm
I'm trying to create simple Ajax call, but after clicking the link I get
Im trying to create a simple high/low app but the application crashes when I
im trying to create a simple SQL INSERT otherwise UPDATE statement but to be
I'm trying to create simple script that subscribes a user to a company calendar.
I'm studying webrat and cucumber and trying to create simple example. Here is my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.