免费注册 查看新帖 |

Chinaunix

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

[patch 1/2] customized machineID in configure [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-26 16:51 |只看该作者 |倒序浏览
在configure脚本中,添加了配置machineID的选项,用来在编译g-bios时配置默认的machineID。

signed-off-by TanChangxian:       <ChangXian.Tan@gmail.com>
signed-off-by ChengYuanQuan:   <YuanQuan.Cheng@gmail.com>
signed-off-by VoidJackJiang:         <VoidJack.Jiang@gmail.com>

-------------------------------------------------------------------------------------------------------------

[ 本帖最后由 voidjackjiang 于 2009-6-26 17:07 编辑 ]

configure_machineID_in_script.patch.tar

90 KB, 下载次数: 34

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

[patch 2/2] customized machineID in boot command

在boot命令中,增加“-i”选项来修改默认的machineID。


signed-off-by TanChangxian:      <ChangXian.Tan@gmail.com>
signed-off-by ChengYuanQuan:  <YuanQuan.Cheng@gmail.com>
signed-off-by VoidJackJiang:        <VoidJack.Jiang@gmail.com>

--------------------------------------------------


Index: app/boot/boot_linux.c
===================================================================
--- app/boot/boot_linux.c        (revision 421)
+++ app/boot/boot_linux.c        (working copy)
@@ -111,6 +111,7 @@
                 "\t-f [<part_num>]:  root=/dev/mtdblock<part_num>\n"
                 "\t-n [nfs_server:/path/to/nfs/root]:  boot vis NFS\n"
                 "\t-r [ramdisk_image_name]:  boot with Ramdisk\n"
+                "\t-i [machine_ID]: set the machine's ID\n"
                 "\t-v:  print the linux parameters and quit\n"
                 "\nExamples:\n"
                 "\t..."
@@ -397,6 +398,8 @@
{
         int i;
         struct Atag *pTag = pTagBase;
+        struct LinuxParam *pKeParam;
+        GuSysGetLinuxParam(&pKeParam);


         if (pTag->stHdr.ulTag != ATAG_CORE)
@@ -408,6 +411,8 @@
         i = 0;
         printf("\n");

+        printf("         ***Machine ID is %d ***\n",  pKeParam->nMachineID);
+
         while (1)
         {
                 printf("[ATAG %d] ", ++i);
@@ -577,6 +582,22 @@
                         BootUsage();
                         return 0;

+                case 'i':
+                        if (i + 1 == argc || '-' == argv[i + 1][0])
+                        {
+                                pKeParam->nMachineID = CONF_MACHINE_ID;
+                                
+                                break;
+                        }
+                        
+                        if (GuStrToVal(argv[++i], &(pKeParam->nMachineID)) < 0)
+                        {
+                                printf("Invalid option: %s", argv);
+                                return -EINVAL;
+                        }
+                        
+                        break;
+
                 default:
                         printf("Invalid option: \"%s\"!\n", pArg);
                         BootUsage();
@@ -653,7 +674,7 @@

         IrqDisable(); // fixme

-        pfExecKernel(0, 6666, ATAG_BASE);
+        pfExecKernel(0, pKeParam->nMachineID, ATAG_BASE);

L1:
         printf("Fail to boot linux!\n");
Index: include/sysconf.h
===================================================================
--- include/sysconf.h        (revision 421)
+++ include/sysconf.h        (working copy)
@@ -39,6 +39,8 @@
         char   szNfsPath[NFS_PATH_LEN];

         char   szConDev[CON_DEV_NAME_LEN + 1];
+
+        int    nMachineID;
};


[ 本帖最后由 voidjackjiang 于 2009-6-29 10:38 编辑 ]

configure_machineID_in_bootcommand.patch.tar

10 KB, 下载次数: 24

论坛徽章:
0
3 [报告]
发表于 2009-06-27 21:11 |只看该作者

[patch 2/2] customized machineID in boot command

在confreset命令中,添加了reset machineID的功能。


signed-off-by TanChangxian:      <ChangXian.Tan@gmail.com>
signed-off-by ChengYuanQuan:  <YuanQuan.Cheng@gmail.com>
signed-off-by VoidJackJiang:        <VoidJack.Jiang@gmail.com>


------------------------------------------------------------


Index: app/boot/boot_linux.c
===================================================================
--- app/boot/boot_linux.c        (revision 421)
+++ app/boot/boot_linux.c        (working copy)
@@ -111,6 +111,7 @@
                 "\t-f [<part_num>]:  root=/dev/mtdblock<part_num>\n"
                 "\t-n [nfs_server:/path/to/nfs/root]:  boot vis NFS\n"
                 "\t-r [ramdisk_image_name]:  boot with Ramdisk\n"
+                "\t-i [machine_ID]: set the machine's ID\n"
                 "\t-v:  print the linux parameters and quit\n"
                 "\nExamples:\n"
                 "\t..."
@@ -397,6 +398,8 @@
{
         int i;
         struct Atag *pTag = pTagBase;
+        struct LinuxParam *pKeParam;
+        GuSysGetLinuxParam(&pKeParam);


         if (pTag->stHdr.ulTag != ATAG_CORE)
@@ -408,6 +411,8 @@
         i = 0;
         printf("\n");

+        printf("         ***Machine ID is %d ***\n",  pKeParam->nMachineID);
+
         while (1)
         {
                 printf("[ATAG %d] ", ++i);
@@ -577,6 +582,22 @@
                         BootUsage();
                         return 0;

+                case 'i':
+                        if (i + 1 == argc || '-' == argv[i + 1][0])
+                        {
+                                pKeParam->nMachineID = CONF_MACHINE_ID;
+                                
+                                break;
+                        }
+                        
+                        if (GuStrToVal(argv[++i], &(pKeParam->nMachineID)) < 0)
+                        {
+                                printf("Invalid option: %s", argv);
+                                return -EINVAL;
+                        }
+                        
+                        break;
+
                 default:
                         printf("Invalid option: \"%s\"!\n", pArg);
                         BootUsage();
@@ -653,7 +674,7 @@

         IrqDisable(); // fixme

-        pfExecKernel(0, 6666, ATAG_BASE);
+        pfExecKernel(0, pKeParam->nMachineID, ATAG_BASE);

L1:
         printf("Fail to boot linux!\n");
Index: app/flash/sysconf.c
===================================================================
--- app/flash/sysconf.c        (revision 421)
+++ app/flash/sysconf.c        (working copy)
@@ -230,6 +230,8 @@

         strncpy(pKeParam->szConDev, CONF_CONSOLE_NAME, CON_DEV_NAME_LEN);

+        pKeParam->nMachineID = CONF_MACHINE_ID;
+
         SysConfCheckSum(NULL);

         if (NULL != ppSysConf)
Index: include/sysconf.h
===================================================================
--- include/sysconf.h        (revision 421)
+++ include/sysconf.h        (working copy)
@@ -39,6 +39,8 @@
         char   szNfsPath[NFS_PATH_LEN];

         char   szConDev[CON_DEV_NAME_LEN + 1];
+
+        int    nMachineID;
}


[ 本帖最后由 voidjackjiang 于 2009-6-29 10:38 编辑 ]

boot-i-sysconf.patch.0627.tar

10 KB, 下载次数: 24

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

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP