lkml.org 
[lkml]   [2008]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectKernel Installer
    Hello everyone , :

    i have been writing a kernel installer which may make the kernel
    installation process a lot more easier for noobs , (don ask me why
    noobs would like to compile a kernel) , but atleast till they learn
    to do it the good way !

    i have written some code which is below , well i am stuck at one thing , ...
    once the .config file is set , is there any method to compute the
    exact no of files that are going to be compiled ??
    lack of this knowledge is clearly visible in the use of a "while(1)"
    in the code below :




    #include <stdio.h>


    int main(int argc, char * argv[]) {

    char buf[100],syscommand[100];
    FILE *fp;
    int i=0,j=0,k=0,l=0;
    int checking_done=0;
    strcpy(buf,"\0");

    fflush(stdout);

    strcpy(syscommand,"make -C ");
    if(argc==2){
    strcat(syscommand,argv[1]);
    }
    else{

    printf("The program accepts the kernel source \n directory as
    the single argument.\n Please provide necessary arguments\n");
    return ;
    }



    printf("\n\n\t\t\t\t\t\t Kernel Installer V1.0\n\n ");


    fp= popen(syscommand,"r");
    do{

    fscanf(fp,"%s",buf);

    if(checking_done!=1){

    if(strcmp(buf,"CHK")==0){
    fscanf(fp,"%s",buf);
    printf("\rChecking file : %-30s\t\n",buf);


    }
    if(strcmp(buf,"CALL")==0){
    fscanf(fp,"%s",buf);

    printf("\rCalling script : %s\t\n",buf);

    }
    }

    if(strcmp(buf,"LD")==0){
    fscanf(fp,"%s",buf);


    printf("\rLinking File : %s\t",buf);
    l++;
    checking_done=1;

    }

    if(strcmp(buf,"CC")==0){
    fscanf(fp,"%s",buf);
    if(strcmp(buf,"[M]")==0){
    fscanf(fp,"%s",buf);
    printf("\rCompiling module (%-4d files, %-4d
    modules compiled): %-60s\t",i,l,buf);
    l++;
    }
    else
    printf("\rCompiling (%-4d files, %-4d
    modules compiled) : %-60s\t",i,l,buf);
    i++;

    switch(i%4){
    case 0:
    printf(" | ");
    break;
    case 1:
    printf(" / ");
    break;
    case 2:
    printf(" - ");
    break;
    case 3:
    printf(" \\ ");
    break;
    }
    for(k=0;k<j;k++)
    printf("=");
    printf(">");

    if((i%100)==0 && i!=0){
    j++;
    }

    checking_done=1;

    }
    fflush(stdout);
    }while(1);
    pclose(fp);

    return 0;

    }

    there is some more work that i remain to add, like being able to start
    from the kernel source , that is just provide the path to the archive
    and it does everything else and so on ,
    but for now i am stuck here !

    Thanks
    Satish

    --
    http://satish.playdrupal.com


    \
     
     \ /
      Last update: 2008-08-03 22:53    [W:0.025 / U:2.124 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site