Linux readme updates

This commit is contained in:
Jordan Carlin 2024-07-24 01:09:12 -07:00
parent a9cd457536
commit 4b86f85904
No known key found for this signature in database
2 changed files with 18 additions and 27 deletions

View File

@ -33,7 +33,7 @@ all: check_write_permissions clean download Image disassemble install dumptvs
check_write_permissions:
@mkdir -p $(RISCV)/.test || \
(echo "ERROR: Cannot write to '$(RISCV)'." \
"Make sure you have write permissions (you may need to run as sudo).'" \
"Make sure you have write permissions (you may need to run as sudo).'" >&2 \
&& exit 1)
@rm -r $(RISCV)/.test
@ -60,7 +60,7 @@ $(IMAGES):
$(RISCV):
@ echo "ERROR: No $(RISCV) directory. Make sure you have installed the Wally Toolchain."
@ echo "this can be done with <WALLY>/bin/wally-tool-chain-install.sh"
@ echo "and sourced setup.sh"
# Disassembly rules ---------------------------------------------------
@ -93,7 +93,6 @@ $(IMAGES)/busybox:
# Generating new Buildroot directories --------------------------------
# This directive should be run as: make install BUILDROOT=path/to/buildroot
download: $(BUILDROOT)/package/fpga-axi-sdc $(WALLYBOARD)
cp $(WALLYBOARD)/main.config $(BUILDROOT)/.config

View File

@ -9,31 +9,25 @@
## Setting up Buildroot <a name="buildroot"></a>
In order to generate the Linux and boot stage binaries compatible with Wally, Buildroot is used for cross-compilation. To set up a Buildroot directory, configuration files for Buildroot, Linux, and Busybox must be copied into the correct locations inside the main Buildroot directory. This can be done automatically using the Makefile inside Wally's Linux subdirectory (this one). To install and patch a fresh Buildroot directory, type:
In order to generate the Linux and boot stage binaries compatible with Wally, Buildroot is used for cross-compilation.
$ make install BUILDROOT=path/to/buildroot
To set up a Buildroot directory, configuration files for Buildroot, Linux, and Busybox must be copied into the correct locations inside the main Buildroot directory. Buildroot and device tree binaries must be generated as well. This can all be done automatically using the Makefile inside Wally's Linux subdirectory (this one). To install a new buildroot directory, build the Buildroot binaries, generate the device tree binaries, generate test-vectors for simulation, and install the buildroot package needed to build the SD card driver for Linux, run:
You can override the `BUILDROOT` variable to place buildroot where you want it. By default it will be placed at `/opt/riscv/buildroot`. In addition to copying the configuration files, it will install the buildroot package needed to build the SD card driver for Linux.
To install a new buildroot directory, build the binaries, and generate the device tree binaries in one command, use:
$ make BUILDROOT=path/to/buildroot
Or simply use the default buildroot location in `/opt/riscv`:
$ make
Note that the `$RISCV` variable cannot be set prior to building in buildroot or the build will fail. It is best to run `source ./setup.sh` to alter your `$PATH` and set the `$RISCV` variable after buildroot has succesfully built the binaries. If you're new to buildroot, you can find the binaries in `<BUILDROOT>/output/images`.
This installs to the `$RISCV` directory.
Optionally, you can override the `BUILDROOT` variable to use a different buildroot source directory.
$ make install BUILDROOT=path/to/buildroot
## Generating Device Tree Binaries <a name="devicetree"></a>
The device tree files for the various FPGA's Wally supports, as well as QEMU's device tree for the virt machine, are located in the `./devicetree` subdirectory. These device tree files are necessary for the boot process. In order to build the device tree binaries (.dtb) from the device tree sources (.dts), we can build all of them at once using:
The device tree files for the various FPGA's Wally supports, as well as QEMU's device tree for the virt machine, are located in the `./devicetree` subdirectory. These device tree files are necessary for the boot process.
$ make generate BUILDROOT=path/to/buildroot
Or for the default buildroot location:
$ make generate
They are built automatically using the main `make` command. To build the device tree binaries (.dtb) from the device tree sources (.dts) separately, we can build all of them at once using:
$ make generate #optionally override BUILDROOT
The .dts files will end up in the `<BUILDROOT>/output/images` folder of your chosen buildroot directory.
@ -41,21 +35,19 @@ The .dts files will end up in the `<BUILDROOT>/output/images` folder of your cho
By using the `riscv64-unknown-elf-objdump` utility, we can disassemble the binaries in `<BUILDROOT>/output/images` so that we can explore the resulting machine code instructions and see what assembly or C code the instructions came from, along with the corresponding addresses. This is useful during debugging in order to trace how code is being executed.
To create the disassembled binaries, run:
The disassembled binaries are built automatically using the main `make` command. To create the disassembled binaries separately, run:
$ make disassemble BUILDROOT=path/to/buildroot
$ make disassemble #optionally override BUILDROOT
You'll find the resulting disassembled files in `<BUILDROOT>/output/images/disassembly`.
## Creating a Bootable SD Card <a name="sdcard"></a>
To flash a bootable sd card for Wally's bootloader, use the `flash-sd.sh` script located in `<WALLY>/linux/sdcard`. The script allows you to specify which buildroot directory you would like to use and to specify the device tree. By default it is set up for the default location of buildroot in `/opt/riscv` and uses the vcu108 device tree. To use the script with your own buildroot directory and device tree, type:
To flash a bootable sd card for Wally's bootloader, use the `flash-sd.sh` script located in `<WALLY>/linux/sdcard`. The script allows you to specify which buildroot directory you would like to use and to specify the device tree. By default it is set up for the default location of buildroot in `$RISCV` and uses the vcu108 device tree. To use the script with your own buildroot directory and device tree, type:
$ cd sdcard
$ ./flash-sd.sh -b <path/to/buildroot> -d <device tree name> <DEVICE>
for example
for example
$ ./flash-sd.sh -b ~/repos/buildroot -d wally-vcu118.dtb /dev/sdb