nixos-riscv/README.md

42 lines
1.1 KiB
Markdown
Raw Normal View History

2023-11-27 11:41:05 +01:00
# NixOS on RISC-V
2023-02-16 13:23:11 +01:00
2024-01-17 18:24:36 +01:00
To boot the system in QEMU, first enter the development shell:
2023-02-16 13:23:11 +01:00
2024-01-17 18:24:36 +01:00
```
$ nix develop
```
2023-02-16 13:23:11 +01:00
2024-01-17 18:24:36 +01:00
Then run the boot script:
```
$ ./boot.sh
```
In u-boot use the following to boot:
```
=> booti 0x84000000 - ${fdtcontroladdr}
```
2024-01-19 13:41:35 +01:00
## Use more than 1 CPU
2024-01-19 13:41:35 +01:00
With only 1 CPU some thigs are soo slow to work. For example, the ttyS0 device
doesn't arrive on time and the login fails. Or the SSH daemon doesn't start
until the third try. With -smp 32 seems to work ok.
## Compressed instructions
To see if a binary has compressed instructions or not, you can use objdump:
hut% nix shell -vL nixpkgs#pkgsCross.riscv64.bintools
hut% objdump -M no-aliases -D result/u-boot | grep 'c\.' | head -5
80200000: 822a c.mv tp,a0
80200002: 84ae c.mv s1,a1
80200018: 52c1 c.li t0,-16
8020001e: 0356 c.slli t1,0x15
80200024: 850a c.mv a0,sp
To dump a ROM without the ELF header:
hut% objdump -b binary -m riscv:rv64 -M no-aliases -D result/u-boot.bin