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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:16:48+00:00 2026-06-03T14:16:48+00:00

I have an application developed to run on multiple platforms where the boot disk

  • 0

I have an application developed to run on multiple platforms where the boot disk is either ‘/dev/nftla1’ or ‘dev/hdc1’. The Grub bootloader has this information.

But once the kernel takes over & the application starts running, it becomes irrelevant. But, in my application which is mainly in ‘C’, I would like to know the source of boot because the way the files are accessed is different on these platforms.

My question is: Is there a system command or any tricks that you know that could help with what I am trying to achieve?

  • 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-03T14:16:50+00:00Added an answer on June 3, 2026 at 2:16 pm

    You can pass kernel boot options from grub and then check them.

    cat /proc/cmdline
    BOOT_IMAGE=/boot/vmlinuz-2.6.32-33-generic root=UUID=3c231d1a-b6cb-4526-95fe-eb8984c7a91a ro quiet splash
    

    More info.

    UPDATE:
    You can use this C code to parse /proc/cmdline:

    #include <stdio.h>                                                                                                                                            
    #include <stdlib.h>                                                                                                                                           
    #include <string.h>                                                                                                                                           
    
    int parse_option(const char *line, const char *option, char *value, size_t size)                                                                              
    {                                                                                                                                                             
        const char *p0, *p1;                                                                                                                                      
        int len;                                                                                                                                                  
    
        p0 = strstr(line, option);                                                                                                                                
        if (!p0)                                                                                                                                                  
            return 0;                                                                                                                                             
        p0 += strlen(option);                                                                                                                                     
        p1  = strchr(p0, ' ');                                                                                                                                    
        if (!p1)                                                                                                                                                  
           p1 = p0 + strlen(p0);                                                                                                                                  
        len = p1 - p0;                                                                                                                                            
        if (len > size - 1)                                                                                                                                       
            len = size - 1;                                                                                                                                       
        memcpy(value, p0, len);                                                                                                                                   
        value[len] = '\0';                                                                                                                                        
        return len;                                                                                                                                               
    }
    
    void get_cmdline_option(const char *option, char *value, size_t size)                                                                                         
    {                                                                                                                                                             
        FILE  *fp;                                                                                                                                                
        char  *line = NULL;                                                                                                                                       
        size_t len = 0;                                                                                                                                           
        size_t read;                                                                                                                                              
    
        if (!size)                                                                                                                                                
            return;                                                                                                                                               
        *value = '\0';                                                                                                                                            
        fp = fopen("/proc/cmdline", "r");                                                                                                                         
        if (fp == NULL)                                                                                                                                           
             return;                                                                                                                                              
        while ((read = getline(&line, &len, fp)) != -1) {                                                                                                         
            printf("%s", line);                                                                                                                                   
            if (parse_option(line, option, value, size))                                                                                                          
                break;                                                                                                                                            
        }                                                                                                                                                         
        fclose(fp);                                                                                                                                           
        if (line)                                                                                                                                                 
            free(line);
        return;                                                                                                                                                   
    }                                                                                                                                                             
    
    int main(int argc, char **argv)                                                                                                                               
    {                                                                                                                                                             
        char root[128];                                                                                                                                           
        get_cmdline_option("root=", root, sizeof(root));                                                                                                          
        printf("root='%s'\n", root);                                                                                                                              
        return 0;                                                                                                                                                 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed the Hello World Android application using Eclipse. I can run the
I have to develop an application using C#.net that has to be run once
I have a web application developed with Spring 2.5. The application has numerous controllers,
I have an application developed to run on a particular cellphone running windows mobile.
I have a application developed in AIR /AS 3.0.. i want to run the
I have developed an android application and run it on an HVGA emulator. It's
i have developed an application that will basically run on all versions of the
I have an application developed in iOS 4.3 and XCode 4. What are the
I have an application(Developed using Adobe AIR) in which i have opened a port
I have an application developed in C++ in Visual Studio 2003 (Windows Forms application).

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.