Loading ramdisk to memory


I am using Beaglebone Black Rev. C. I have a ramdisk image provided by swupdate. Using uboot I load the ramdisk image to RAM, using,

load mmc 0:4 0x90000000 swupdate-ramdisk
bootz 0x82000000 0x90000000

Here is the output of the above command.

Loading init Ramdisk from Legacy Image at 0x90000000
Image Name: swupdate-image-…

Starting Kernel…

Then it loads the kernel. But I would like to access the environment in initrd and do some operation, like creating a file etc. How do I do that? I am not that well versed with ramdisk, so do not mind the ambiguity in my understanding(if any).

Thanks in advance for your help.

Sai Kiran.

you need to do file operations during the boot process? or after … your question is not quite clear. Where are you mounting this ramdisk?

do you know about /dev/shm? it is a ramdisk that gets created for you … here is an example from my system:

gomer@bbb42:~$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              220000       0    220000   0% /dev
tmpfs              49492    5468     44024  12% /run
/dev/mmcblk1p1   3647540 2865840    576696  84% /
tmpfs             247444       0    247444   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs             247444       0    247444   0% /sys/fs/cgroup
tmpfs              49488       0     49488   0% /run/user/1001
gomer@bbb42:~$ cat /etc/dogtag
BeagleBoard.org Debian Image 2018-10-07
gomer@bbb42:~$ uname -a
Linux bbb42 4.14.71-ti-r80 #1 SMP PREEMPT Fri Oct 5 23:50:11 UTC 2018 armv7l GNU/Linux
gomer@bbb42:~$ ls -l /dev/shm
total 0
gomer@bbb42:~$ echo foo > /dev/shm/foo
gomer@bbb42:~$ ls -l /dev/shm
total 4
-rw-r--r-- 1 gomer gomer 4 Sep 29 13:20 foo
gomer@bbb42:~$ cat /dev/shm/foo

I don’t know at what point during the boot process that /dev/shm gets created if that makes any difference… is it important to do the file operations during the boot process?


I want to do file ops, before the Linux is booted. swupdate in initrd, does some checks and boots. I would like to add some script in initrd. But the initrd file provided by swupdate is not mountable. So, I was thinking about adding the script once the u-boot loads initrd(before booting Linux).

I am not sure if this works…but would like to try. So, I was thinking about doing the file ops in initrd environment(as the system is booting).

I am not aware of /dev/shm. Will look into it. Thanks for the pointer.