免费注册 查看新帖 |

Chinaunix

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

[PATCH]:add boot -m option: set board machine ID [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-11-02 12:24 |只看该作者 |倒序浏览
From 47fdcd7d0f30de65018c9bd1f622d4a8a19405e9 Mon Sep 17 00:00:00 2001
From: denghaipeng <eremes.deng@google.com>
Date: Mon, 2 Nov 2009 11:48:56 +0800
Subject: [PATCH] add boot -m option: set board machine ID

---
app/boot/boot.c   |   15 ++++++++++++++-
filesys/sysconf.c |    1 +
include/sysconf.h |    1 +
3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/app/boot/boot.c b/app/boot/boot.c
index b4ff9d3..26f0c7b 100644
--- a/app/boot/boot.c
+++ b/app/boot/boot.c
@@ -114,6 +114,7 @@ static int BootUsage(void)
                "\t-n [nfs_server:/path/to/nfs/root]:  boot via NFS\n"
                "\t-l [kernel command line]:  boot via spcified CmdLine\n"
                "\t-r [ramdisk_image_name]:  boot with Ramdisk\n"
+                "\t-m <MachID>:  set board machine ID\n"
                "\t-v:  print the linux parameters and quit\n"
                "\nExamples:\n"
                "\t..."
@@ -583,6 +584,18 @@ int main(int argc, char *argv[])

                        break;

+                case 'm':
+                        if (i + 1 == argc || '-' == argv[i + 1][0])
+                        {
+                                printf("Invalid option: %s, current MachID = %u\n", argv, pKeParam->dwMachID);
+                                BootUsage();
+                                return -ENAVAIL;
+                        }
+
+                        GuStrToVal(argv[++i], &pKeParam->dwMachID);
+
+                        break;
+
                case 'c':
                        if (i + 1 == argc || '-' == argv[i + 1][0])
                        {
@@ -719,7 +732,7 @@ int main(int argc, char *argv[])

        IrqDisable(); // fixme

-        pfExecKernel(0, 0x350, ATAG_BASE);
+        pfExecKernel(0, pKeParam->dwMachID, ATAG_BASE);

L1:
        printf("\n");
diff --git a/filesys/sysconf.c b/filesys/sysconf.c
index b687ca5..f5a3bfd 100644
--- a/filesys/sysconf.c
+++ b/filesys/sysconf.c
@@ -228,6 +228,7 @@ int SysConfReset()
        strncpy(pKeParam->szNfsPath, CONF_NFS_ROOT, sizeof(pKeParam->szNfsPath));

        strncpy(pKeParam->szConDev, CONF_CONSOLE_NAME, sizeof(pKeParam->szConDev));
+        pKeParam->dwMachID = MACH_ID;

        SysConfCheckSum(NULL);

diff --git a/include/sysconf.h b/include/sysconf.h
index 9e0f89f..445a0da 100644
--- a/include/sysconf.h
+++ b/include/sysconf.h
@@ -40,6 +40,7 @@ struct LinuxParam
        char   szNfsPath[NFS_PATH_LEN];

        char   szConDev[CON_DEV_NAME_LEN + 1];
+        UINT32 dwMachID;

        char   szCmdLine[DEFAULT_KCMDLINE_LEN];
};
--
1.6.0.4

0001-add-boot-m-option-set-board-machine-ID.patch.tar.gz

1.17 KB, 下载次数: 39

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

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP