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 9062127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:39:32+00:00 2026-06-16T15:39:32+00:00

hi there i’m trying to compile my new kernel from kernel version 2.4.20. Moreover,

  • 0

hi there i’m trying to compile my new kernel from kernel version 2.4.20. Moreover, i have a header file which includes the definitions of structures (one for to define node used by a linked list and a list structure) and two function prototypes which are defined in my new systemcall file sample.c . However, when i define a list globally and try to make an allocation in sched.c in function sched_init() my new kernel version doesnt open. it stucks before get started. here you can see my header file and system call file.

/* project_header.h */

#ifndef __LINUX_PROJECT_HEADER_H

#define __LINUX_PROJECT_HEADER_H

#include <linux/linkage.h>
#include <linux/vmalloc.h>

#endif

typedef struct node{

        struct node* next;
    struct node* prev;
        long project_pid;
    long project_ticket_number;

}PROJECT_NODE;

typedef struct{

        PROJECT_NODE* head;
        PROJECT_NODE* tail;
        int list_size;

}PROJECT_LIST;

PROJECT_LIST* project_init_list(void);
void project_add_node(PROJECT_LIST*, long);

this is my system call sample which i implemented. As you can see i had to define functions in here and prototypes are in the project_header.h which is called by two system_call files which are fork.c and sched.c

/* sample.c */

#include <linux/sample.h>
#include <linux/project_header.h>

long int maximum_ticket_number=0;
extern PROJECT_LIST* project_list;

PROJECT_LIST* project_init_list(void){

    PROJECT_LIST* list = vmalloc(sizeof(*list));

        list->list_size=0;
        list->head = NULL;
        list->tail = NULL;

    return list;
}

void project_add_node(PROJECT_LIST* list, long id){

     PROJECT_NODE* pnew;

     pnew = vmalloc(sizeof(*pnew));

     pnew->project_pid=id;

    maximum_ticket_number++;
    pnew->project_ticket_number=maximum_ticket_number;

    if(list->list_size==0){ // Assume list is empty

                   list->head = pnew;
                   list->tail = pnew;

                   list->list_size++;
    }
    else {

         list->tail->next = pnew;
         pnew->prev = list->tail;
         list->tail = pnew;

         list->list_size++;
         }

}

asmlinkage void sys_sample(void){ //System call does print the inital list size

        printk("LIST->SIZE = %d\n", project_list->list_size);

    return;
}

and this is the part which added into sched.c

/* sched.c */
.
.

#include <linux/project_header.h>
#include <linux/sample.h>

PROJECT_LIST* project_list; // Create a list globally

extern PROJECT_LIST* project_init_list(void); // Provide to call project_init_list function which returns a list properly

.
.

void __init sched_init(void){

.
.
project_list = vmalloc(sizeof(*project_list)); //Allocate space and initialize the variables of main list
.
.

and this is a snapshot of my current situation before kernel get started

enter image description here

i ‘m sure that the problem is in sched_init() function but i can’t find it. i will be very appreciated if you can help and thanks anyway.

  • 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-16T15:39:34+00:00Added an answer on June 16, 2026 at 3:39 pm

    This isn’t REALLY an answer, because this isn’t a question that can be answered with the information given. But it’s “guidance on how to find out why the kernel doesn’t start,and a bit about how the kernel starts”.

    printk() is the corresponding kernel function to printf() outside of the kernel. Add that at points you think you are getting to, and places where you think it can fail, e.g. if you have “myptr = vmalloc(…);”, then

    Obviously, if you are so early that the kernel proper hasn’t started and that printk may not be available, then you will need to be using out’s to the serial port will be the way to debug –

      mov $0x3fc, dx
      mov $65, al
      out al, dx
    

    will print an ‘A’ (ascii code 65) to the serial port. Don’t hammer more than about 16 characters out at once, they will only come out at 9600 bps or some such.

    By the way, the only part of the kernel where you aren’t in protected mode is for a few dozen instructions or so.

    However, the virtual memory handling doesn’t start immediately, and in fact, you may find that it doesn’t work until AFTER THE SCHEDULING and the “kswapper” process has started – meaning that you can’t use vmalloc in the scheduler – I’m not certain, as this is not a part of the Linux kernel I know that well – but it may be worth looking at kmalloc instead, which is a lower level kernel functionality. Just beware that they aren’t exact replacements, so you need to look at the parameters and what they mean, and how to translate. I don’t think I’ve ever used vmalloc() in the kernel – are you sure that’s the right function to use?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a directed graph having a single designated node called root from which
There are two intents on the receiver side which are called from the same
There's a Rails 3.2.3 web application which doesn't use any database. But in spite
I am trying to understand how to use SyndicationItem to display feed which is
I have just tried to save a simple *.rtf file with some websites and
There are are 150 000 records in my comments table and about 1000 new
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
There are 3 different ways to get data out of a BLOB column from
There are 3 methods as f1, f2 and f3. I want to return from

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.