1 # Build instructions for Microwatt
3 WIP integrate from <https://libre-soc.org/irclog/%23libre-soc.2022-01-26.log.html>
5 * install verilator: <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=verilator-install;hb=HEAD>
6 * install yosys <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=hdl-tools-yosys;hb=HEAD>
7 * install ghdl-yosys-plugin
9 After installing ghdl-yosys-plugin use schroot to switch environment
11 schroot -c bullseye_ghdl
12 git clone https://git.libre-soc.org/git/microwatt.git
13 git checkout -b verilator_trace
14 export FPGA_TARGET=verilator
15 make microwatt-verilator
17 Then run the resulting binary
19 time ./microwatt-verilator
21 If everything works correcly it will print out an light bulb in ascii art
22 with the message Microwatt, it works. On my ASUS KGPE D16 this takes
28 ## Building the kernel
29 On a POWER9 there is no need to install gcc-powerpc64le-linux-gnu,
30 you can omit CROSS_COMPILE and ARCH in this case
32 apt install gcc-powerpc64le-linux-gnu
33 apt install flex bison lz4
34 git clone -b microwatt-5.7 https://git.kernel.org/pub/scm/linux/kernel/git/joel/microwatt.git
36 wget https://ftp.libre-soc.org/microwatt-linux-5.7.patch
37 patch -p1 < microwatt-linux-5.7.patch
38 wget http://ftp.libre-soc.org/rootfs.cpio
39 CROSS_COMPILE="ccache powerpc64le-linux-gnu-" ARCH=powerpc make -j8 O=microwatt microwatt_defconfig
40 CROSS_COMPILE="ccache powerpc64le-linux-gnu-" ARCH=powerpc make -j8 O=microwatt
42 This will produce a file
43 microwatt/arch/powerpc/boot/dtbImage.microwatt
45 ## Building sdram_init.bin
46 This needs gcc-powerpc64le-linux-gnu if cross compilation is used.
49 cd litedram/gen-src/sdram_init/
52 ## Building microwatt-verilator using the libre-soc core
54 make microwatt_external_core
55 cp external_core_top.v /path/to/microwatt
57 export FPGA_TARGET=verilator
59 make microwatt-verilator
61 ## Running the simulation
62 cp microwatt/arch/powerpc/boot/dtbImage.microwatt
63 ./microwatt-verilator sdram_init.bin dtbImage.microwatt
67 * https://github.com/shenki/buildroot/commits/microwatt
68 * https://codeconstruct.com.au/docs/microwatt-orangecrab/