[patch 1/2] customized machineID in configure
在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 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在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 编辑 ]
在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 编辑 ]