Chinaunix

标题: [PATCH]:add boot -m option: set board machine ID [打印本页]

作者: denghaipeng    时间: 2009-11-02 12:24
标题: [PATCH]:add boot -m option: set board machine ID
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






欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2