免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2475 | 回复: 4
打印 上一主题 下一主题

[PATCH] boot_linux.c: show all parametel for kernol booting [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-26 12:39 |只看该作者 |倒序浏览
"boot [-v]"  show sysconf  by function ShowSysConf();

signed-off-by: Rouchel Yan <rouchel.yan@gmail.com>
signed-off-by: Dongwei King <dongwei.king@gmail.com>
signed-off-by: Benner Zhou <benner.zhou@gmail.com>
_________________________________________________________________
diff -Nr g-bios/app/boot/boot_linux.c g-bios-new/app/boot/boot_linux.c
452a453,486
>
>
> static void ShowSysConf()
> {
>   struct NetConf    *pNetConf;
>   struct LinuxParam *pKeParam;
>   char IpV4Tmp[8];
>
>   printf("Machine Id:     %4d\n", MACH_ID);
>
>   IpV4Tmp[7] = '\0';
>   GuSysGetNetConf(&pNetConf);
>   GuSysGetLinuxParam(&pKeParam);
>   printf("******  SYS CONF  ******\n");
>
>   printf("RootDev:      %d\n", pKeParam->nRootDev);
>
>   GuIpToStr(IpV4Tmp, pNetConf->dwTftpSvrIP);
>   printf("TftpServerIp: %s\n", IpV4Tmp);
>   GuIpToStr(IpV4Tmp, pNetConf->dwLocalIP);
>   printf("LocalIp:      %s\n", IpV4Tmp);
>
>   GuIpToStr(IpV4Tmp, pKeParam->szNfsSvr);
>   printf("NFS Sever:      %s", IpV4Tmp);
>   printf(":%s\n", pKeParam->szNfsPath);
>
>   printf("ImgKernelName:  %s\n", pKeParam->szImgKernel);
>   printf("ImgRmdiskName:  %s\n", *pKeParam->szImgRd == 0? "No RmDisk Image!": pKeParam);
>
>   printf("condev :        %s\n", pKeParam->szConDev);
>   printf("****************************\n");
> }
>
>
455c489
<   int   i, ret;
---
>   int   i, ret, vflag = 0;
572a607
>       case 'V':
573a609
>           ShowSysConf();
604a641
>   
647d683
<
Binary files g-bios/.configure.swp and g-bios-new/.configure.swp differ
Binary files g-bios/Untitled Project.IAB and g-bios-new/Untitled Project.IAB differ
Binary files g-bios/Untitled Project.IAD and g-bios-new/Untitled Project.IAD differ
Binary files g-bios/Untitled Project.IMB and g-bios-new/Untitled Project.IMB differ
Binary files g-bios/Untitled Project.IMD and g-bios-new/Untitled Project.IMD differ
Binary files g-bios/Untitled Project.PFI and g-bios-new/Untitled Project.PFI differ
Binary files g-bios/Untitled Project.PO and g-bios-new/Untitled Project.PO differ
Binary files g-bios/Untitled Project.PR and g-bios-new/Untitled Project.PR differ
Binary files g-bios/Untitled Project.PRI and g-bios-new/Untitled Project.PRI differ
Binary files g-bios/Untitled Project.PS and g-bios-new/Untitled Project.PS differ
diff -Nr g-bios/Untitled Project.SearchResults g-bios-new/Untitled Project.SearchResults
0a1,2
> ---- prinft Matches (1 in 1 files) ----^M
> Boot_linux.c (app\boot):          prinft("mem:\n \^M
Binary files g-bios/Untitled Project.WK3 and g-bios-new/Untitled Project.WK3 differ

[ 本帖最后由 rouchel 于 2009-6-26 16:38 编辑 ]

boot-v-sysconf.patch.tar

10 KB, 下载次数: 14

论坛徽章:
0
2 [报告]
发表于 2009-06-26 13:28 |只看该作者
1. patch格式不对,请重新生成patch
2. 函数的本意是只显示本次启动时使用的内核参数,而patch中未能做到这一点,有些不必要的信息也打印出来了,如nRootDev

论坛徽章:
0
3 [报告]
发表于 2009-06-26 14:17 |只看该作者

patch form was changed

Only patch form has been changed, please check it! Thanks!

------------------------------------------------------------------------------------------------
Index: app/boot/boot_linux.c
===================================================================
--- app/boot/boot_linux.c   (revision 420)
+++ app/boot/boot_linux.c   (working copy)
@@ -450,6 +450,40 @@
    return 0;
}

+
+
+static void ShowSysConf()
+{
+   struct NetConf    *pNetConf;
+   struct LinuxParam *pKeParam;
+   char IpV4Tmp[8];
+
+   printf("Machine Id:     %4d\n", MACH_ID);
+
+   IpV4Tmp[7] = '\0';
+   GuSysGetNetConf(&pNetConf);
+   GuSysGetLinuxParam(&pKeParam);
+   printf("******  SYS CONF  ******\n");
+
+   printf("RootDev:      %d\n", pKeParam->nRootDev);
+
+   GuIpToStr(IpV4Tmp, pNetConf->dwTftpSvrIP);
+   printf("TftpServerIp: %s\n", IpV4Tmp);
+   GuIpToStr(IpV4Tmp, pNetConf->dwLocalIP);
+   printf("LocalIp:      %s\n", IpV4Tmp);
+
+   GuIpToStr(IpV4Tmp, pKeParam->szNfsSvr);
+   printf("NFS Sever:      %s", IpV4Tmp);
+   printf(":%s\n", pKeParam->szNfsPath);
+
+   printf("ImgKernelName:  %s\n", pKeParam->szImgKernel);
+   printf("ImgRmdiskName:  %s\n", *pKeParam->szImgRd == 0? "No RmDisk Image!": pKeParam);
+
+   printf("condev :        %s\n", pKeParam->szConDev);
+   printf("****************************\n");
+}
+
+
static int main(int argc, char *argv[])
{
    int   i, ret;
@@ -570,7 +604,9 @@
            break;

        case 'v':
+       case 'V':
            isShowArg = TRUE;
+           ShowSysConf();
            break;

        case 'h':
@@ -602,6 +638,7 @@
    {
        ret = PartLoadImage(PT_OS_LINUX, &pImgKernel);
    }
+   

    // TODO: check the kernel image

@@ -644,7 +681,6 @@

    EndSetupTag(pTag);

-
    if (isShowArg)
    {
        ShowBootArgs((void *)ATAG_BASE);
Index: boot/nand.c
===================================================================

论坛徽章:
0
4 [报告]
发表于 2009-06-26 14:38 |只看该作者

Please Review ! Thanks!

The "nrootdev"  option has been fixed!  If some lines  need to be fixed  or has anything wrong, please send  a massage to tell me, thanks!

______________________________________________
+   printf("ImgKernelName:  %s\n", pKeParam->szImgKernel);
+   printf("ImgRmdiskName:  %s\n", *pKeParam->szImgRd == 0? "No RmDisk Image!": pKeParam);
+
+   printf("condev :        %s\n", pKeParam->szConDev);
+   printf("****************************\n");
+}
+
+
static int main(int argc, char *argv[])
{
    int   i, ret;
@@ -570,7 +602,9 @@
            break;

        case 'v':
+       case 'V':
            isShowArg = TRUE;
+           ShowSysConf();
            break;

        case 'h':
@@ -602,6 +636,7 @@
    {   
        ret = PartLoadImage(PT_OS_LINUX, &pImgKernel);
    }   
+   

    // TODO: check the kernel image

@@ -644,7 +679,6 @@

    EndSetupTag(pTag);

-
    if (isShowArg)
    {   
        ShowBootArgs((void *)ATAG_BASE);
Index: boot/nand.c
===================================================================
--- boot/nand.c (revision 421)
+++ boot/nand.c (working copy)
@@ -75,7 +75,7 @@
}


-int IsPower2(UINT32 n)
+static int IsPower2(UINT32 n)
{
    return (n & (n - 1)) == 0;
}

[ 本帖最后由 rouchel 于 2009-6-26 14:39 编辑 ]

boot-v-sysconf.patch.tar

10 KB, 下载次数: 19

论坛徽章:
0
5 [报告]
发表于 2009-06-26 16:24 |只看该作者

The last time changes ! review please!

The problem was fixed, please review again! Thanks~!

________________________________________
Index: app/boot/boot_linux.c
===================================================================
--- app/boot/boot_linux.c   (revision 421)
+++ app/boot/boot_linux.c   (working copy)
@@ -408,6 +408,8 @@
    i = 0;
    printf("\n");

+   printf("Machine Id: %d\n", MACH_ID);
+
    while (1)
    {   
        printf("[ATAG %d] ", ++i);
@@ -416,6 +418,13 @@
        {   
        case ATAG_CORE:
            printf("****** ATAG Begin ******\n");
+           printf("************core************\n\
+               \rFlags:    %d\n\
+               \rPagesize: 0x%8x\n\
+               \rRootdev:  %d\n",
+               pTag->stCore.ulFlags,
+               pTag->stCore.nPageSize,
+               pTag->stCore.ulRootDev);
            break;

        case ATAG_CMDLINE:
@@ -429,18 +438,92 @@
                );  
            break;

+       case ATAG_VIDEOTEXT:
+           printf("************Videotext************\n\
+               \rX:  %3d  Y: %3d\n\
+               \rvideopage:   %d\n\
+               \rvideomode:   %d\n\
+               \rvideocols:   %d\n\
+               \rvideoegabx:  %d\n\
+               \rvideoelines: %d\n\
+               \rvideoisvga:  %d\n\
+               \rvideopoints: %d\n",
+               pTag->stVideoText.bX,
+               pTag->stVideoText.bY,
+               pTag->stVideoText.usVideoPage,
+               pTag->stVideoText.bVideoMode,
+               pTag->stVideoText.bVideoCols,
+               pTag->stVideoText.usVideoEgaBx,
+               pTag->stVideoText.bVideoLines,
+               pTag->stVideoText.bVideoIsVGA,
+               pTag->stVideoText.usVideoPoints);
+           break;
+
+       case ATAG_RAMDISK:
+           printf("************ramdisk************\n\
+               \rFlags:     %d\n\
+               \rSize:      %d\n\
+               \rStart:     0x%8x\n",
+               pTag->stRamDisk.dwFlags,
+               pTag->stRamDisk.nSize,
+               pTag->stRamDisk.nStart);
+           break;
+
+       case ATAG_INITRD:
        case ATAG_INITRD2:
+           printf("************initrd************\n");
            printf("Initrd: [0x%08x - 0x%08x]\n",
                pTag->stInitRd.ulStart, pTag->stInitRd.ulStart + pTag->stInitRd.nSize
                );
            break;

+       case ATAG_SERIAL:
+           printf("************serial************\n\
+               \rLow:     %d\n\
+               \rHigh:      %d\n",
+               pTag->stSerialNr.ulLow,
+               pTag->stSerialNr.ulHigh);
+           break;
+
+       case ATAG_REVISION:
+           printf("************revison************\n");
+           printf("revsion:\nRevsion:    %d\n", pTag->stRevision);
+           break;
+
+       case ATAG_VIDEOLFB:
+           printf("************videolfb************\n\
+               \rbWidth:     %d\n\
+               \rbHigh:      %d\n\
+               \rDepth:      %d\n\
+               \rLineLengt:  %d\n\
+               \rBaseAddr:   0x%8x\n\
+               \rsize:       %d\n\
+               \rRedsize:    %d\tRedPos:    %d\n\
+               \rGreensize:  %d\tGrePos:    %d\n\
+               \rBluesize:   %d\tBluPos:    %d\n\
+               \rRsvdSize:   %d\n\
+               \rRsvdPos:    %d\n",
+               pTag->stVideoLfb.usLfbWidth,
+               pTag->stVideoLfb.usLfbHeight,
+               pTag->stVideoLfb.usLfbDepth,
+               pTag->stVideoLfb.usLfbLineLength,
+               pTag->stVideoLfb.ulLfbBase,
+               pTag->stVideoLfb.nLfbSize,
+               pTag->stVideoLfb.bRedSize,
+               pTag->stVideoLfb.bRedPos,
+               pTag->stVideoLfb.bGreenSize,
+               pTag->stVideoLfb.bGreenPos,);
+           break;
+
        case ATAG_NONE:
            printf("******  ATAG End  ******\n");
            return 0;

-       default: // fixme
-           printf("tag = 0x%08x\n", pTag->stHdr.ulTag);
+       default:
            break;
        }

boot_show_param.patch.tar

10 KB, 下载次数: 12

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP