lowRISC / lowrisc-chip

The root repo for lowRISC project and FPGA demos.
http://www.lowrisc.org/
Other
596 stars 148 forks source link

When building the rootfile system, I want to put riscv-gnu-toolchain. #77

Open hylee17 opened 7 years ago

hylee17 commented 7 years ago

Hello.

I have successfully booted Linux on my FPGA.

After booting, there is no compiler in the root file system. So, I want to put the compiler in the root filesystem. When I added the compiler to the root file system, the size of the image file was 188 Mbytes. (Original size : 4Mbyte) Is it possible to boot this size too?

jrrk commented 7 years ago

You should not attempt to put into the boot image anything that is not necessary for booting,

because all of this stuff has to be loaded into RAM disk. User applications should be stored in the root

partition on the SD-card. This can be prepared on the host using fdisk and mkfs.ext2 as you normally

would. It will appear as /dev/mmcblk0p1 ,2 ,3 etc.

To check if the card is recognised in Linux you can do

cat /proc/partitions

A typical sequence would be

mknod dev/mmcblk0p2 b 179 2 # If not already done by make_root.sh

mount -t ext2 /dev/mmcblk0p2 /mnt # p1 contains the DOS filing system containing boot.bin

mount -t proc none /mnt/proc

mount -t sysfs none /mnt/sys

mount -t devtmpfs udev /mnt/dev

mkdir -p /mnt/dev/pts

mount -t devpts devpts /mnt/dev/pts mount -t tmpfs tmpfs /mnt/tmp

chroot /mnt # Switch to new root (but does not free ramdisk)

If you want to free the ramdisk then you need to use a slightly different boot sequence, where the init process is replaced by a temporary shell script. This process is documented in standard PC linux, it is not specific to lowRISC. You can practise the technique on a spare PC using grub configs or lilo if you want to familiarize yourself. Consult riscv-tools/initial_0000 in the ethernet-v0.5 branch for an example.

I recommend the poky-linux distribution for userland tools. Again an example configuration is present in the ethernet-v0.5 branch.

Running the compiler on the LowRISC is fairly slow, partly due to limitations of the SD-driver, and also the small cache and narrow DDR interface, and of course the slow clock rate of the FPGA due to the design style. Many of the issues are improved but not solved in the (incomplete) ethernet-v0.5 branch.

On 15/11/17 10:17, hylee17 wrote:

Hello.

I have successfully booted Linux on my FPGA.

After booting, there is no compiler in the root file system. So, I want to put the compiler in the root filesystem. When I added the compiler to the root file system, the size of the image file was 188 Mbytes. (Original size : 4Mbyte) Is it possible to boot this size too?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lowRISC/lowrisc-chip/issues/77, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgF1_ir_N-DPBjqn8ZXYrLd5cqYG9qZks5s2rpMgaJpZM4QesX4.