sycuricon / riscv-spike-sdk

Run Linux on RISC-V Spike Simulator
MIT License
45 stars 18 forks source link

Have to rebuild entire project to place file in rootfs #28

Open tomhepworth opened 11 months ago

tomhepworth commented 11 months ago

Hi, I think the documentation might be slightly wrong, or something isn't working as intended.

I want to put a file into the filesystem at /root/test.txt so I do

mv test.txt rootfs/buildroot_initramfs_sysroot/root/test.txt

but then touch buildroot && make does not rebuild anything. I must do make clean and then rebuild everything for the file to appear. Is there a better way?

Phantom1003 commented 11 months ago

Sorry, our readme is a little bit out of date. The directory of the roofs has been moved to the top directory, glad to see you have found it.

The Makefile restricts you from placing your file only in the root directory, which is rootfs/buildroot_initramfs_sysroot. This is necessary for the Makefile to detect any changes in the file contents and trigger a rebuild of the kernel. However, if you still prefer to place the file in a custom directory, you can rebuild the kernel image using the following command: rm build/linux/vmlinux; make.

tomhepworth commented 11 months ago

Thank you for the response :)

The Makefile restricts you from placing your file only in the root directory, which is rootfs/buildroot_initramfs_sysroot.

Do you mean that I should only be putting files in rootfs/buildroot_initramfs_sysroot or that I should be putting them somewhere else?

My goal was to install a .profile file to run some scripts on startup.

wsong83 commented 11 months ago

I have just tried to do the similar in recent days. What I found is, I can easily add/remove files to the ramfs by:

cp file.txt rootfs/buildroot_initramfs_sysroot/any-place-you-like
touch rootfs/buildroot_initramfs_sysroot
make sim

This would automatically rebuild the image. Of course, you can do make bbl or make vmlinux as well, depending on what you need.

naithanianshul commented 2 months ago

There is an error I'm encountering while copying more than one folder into rootfs/buildroot_initramfs_sysroot/

[    1.094990] Kernel panic - not syncing: write error
[    1.095275] CPU: 0 PID: 11 Comm: kworker/u2:0 Not tainted 6.6.2-ga06ca85b22f6 #2
[    1.095710] Hardware name: ucbbar,spike-bare (DT)
[    1.095985] Workqueue: events_unbound async_run_entry_fn
[    1.096300] Call Trace:
[    1.096445] [<ffffffff80005826>] dump_backtrace+0x1c/0x24
[    1.096765] [<ffffffff80418fe2>] show_stack+0x2c/0x38
[    1.097065] [<ffffffff80422634>] dump_stack_lvl+0x3c/0x54
[    1.097390] [<ffffffff80422660>] dump_stack+0x14/0x1c
[    1.097695] [<ffffffff804191de>] panic+0xec/0x264
[    1.097975] [<ffffffff80602bda>] do_populate_rootfs+0x46/0xbe
[    1.098315] [<ffffffff80031852>] async_run_entry_fn+0x1e/0x96
[    1.098655] [<ffffffff80025882>] process_one_work+0x14a/0x23a
[    1.098995] [<ffffffff80026730>] worker_thread+0x310/0x448
[    1.099320] [<ffffffff8002db90>] kthread+0x94/0xa8
[    1.099605] [<ffffffff80003172>] ret_from_fork+0xa/0x1c
[    1.099915] ---[ end Kernel panic - not syncing: write error ]---

What I intend to do is build an linux image with my benchmarks and edit rootfs/buildroot_initramfs_sysroot/etc/inittab to run my benchmarks after linux boot.

JorgeSantos18 commented 3 weeks ago

@naithanianshul Did you find any solution?

There is an error I'm encountering while copying more than one folder into rootfs/buildroot_initramfs_sysroot/

Phantom1003 commented 2 weeks ago

@JorgeSantos18 @naithanianshul Could you please provide more detailed context regarding the log? Thanks.