Alistair Delva has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/54184 )

 (

2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
 )Change subject: arch-arm: Add support for initrd/initramfs
......................................................................

arch-arm: Add support for initrd/initramfs

Add initrd_filename and initrd_addr parameters to specify that an
initrd/initramfs should be loaded into memory from a file, just like the
DTB blob. The user must specify the initrd file, and they can specify
the initrd load address as well. However, in practice, it's expected
that the dev/machine backend will derive the initrd load address from
the dtb load address, which is how a bootloader would typically do it.

Change-Id: I6378927c2984b7ccdd1471486dd7803500ef5883
Signed-off-by: Alistair Delva <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54184
Reviewed-by: Richard Cooper <[email protected]>
Reviewed-by: Giacomo Travaglini <[email protected]>
Maintainer: Giacomo Travaglini <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/arm/linux/fs_workload.cc
M src/arch/arm/ArmFsWorkload.py
2 files changed, 42 insertions(+), 2 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  Richard Cooper: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/arm/ArmFsWorkload.py b/src/arch/arm/ArmFsWorkload.py
index 974600b..43bbd16 100644
--- a/src/arch/arm/ArmFsWorkload.py
+++ b/src/arch/arm/ArmFsWorkload.py
@@ -58,6 +58,9 @@
     dtb_filename = Param.String("",
         "File that contains the Device Tree Blob. Don't use DTB if empty.")
     dtb_addr = Param.Addr(0, "DTB or ATAGS address")
+    initrd_filename = Param.String("",
+ "File that contains the initial ramdisk. Don't use initrd if empty.")
+    initrd_addr = Param.Addr(0, "initrd/initramfs address")
     cpu_release_addr = Param.Addr(0, "cpu-release-addr property")

     machine_type = Param.ArmMachineType('DTOnly',
diff --git a/src/arch/arm/linux/fs_workload.cc b/src/arch/arm/linux/fs_workload.cc
index d512067..e724eb1 100644
--- a/src/arch/arm/linux/fs_workload.cc
+++ b/src/arch/arm/linux/fs_workload.cc
@@ -91,6 +91,21 @@
     bool dtb_file_specified = params().dtb_filename != "";

     if (kernel_has_fdt_support && dtb_file_specified) {
+        bool initrd_file_specified = params().initrd_filename != "";
+        size_t initrd_len = 0;
+
+        if (initrd_file_specified) {
+            inform("Loading initrd file: %s at address %#x\n",
+                    params().initrd_filename, params().initrd_addr);
+
+            loader::ImageFileDataPtr initrd_file_data(
+                new loader::ImageFileData(params().initrd_filename));
+            system->physProxy.writeBlob(params().initrd_addr,
+                                        initrd_file_data->data(),
+                                        initrd_file_data->len());
+            initrd_len = initrd_file_data->len();
+        }
+
         // Kernel supports flattened device tree and dtb file specified.
         // Using Device Tree Blob to describe system configuration.
inform("Loading DTB file: %s at address %#x\n", params().dtb_filename,
@@ -98,8 +113,8 @@

         auto *dtb_file = new loader::DtbFile(params().dtb_filename);

-        if (!dtb_file->addBootCmdLine(
-                    commandLine.c_str(), commandLine.size())) {
+        if (!dtb_file->addBootData(commandLine.c_str(), commandLine.size(),
+                                   params().initrd_addr, initrd_len)) {
             warn("couldn't append bootargs to DTB file: %s\n",
                  params().dtb_filename);
         }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/54184
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I6378927c2984b7ccdd1471486dd7803500ef5883
Gerrit-Change-Number: 54184
Gerrit-PatchSet: 5
Gerrit-Owner: Alistair Delva <[email protected]>
Gerrit-Reviewer: Alistair Delva <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Richard Cooper <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Peng Zhao <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to