6262 @echo " boot # Boot the Blackhole RISC-V CPU"
6363 @echo " connect # Connect to console (requires a booted RISC-V)"
6464 @echo " ssh # SSH to machine (requires a booted RISC-V)"
65- @echo " boot_all # Boot all 4 L2CPUs on Blackhole Chip"
66- @echo " connect_all # Launch 4x4 Tmux grid and connect to each L2CPU"
6765 @echo " build_linux # Build the kernel"
6866 @echo " build_opensbi # Build opensbi"
6967 @echo " build_hosttool # Build tt-bh-linux"
7775 @echo " clean_downloads # Remove all downloaded files"
7876 @echo " install_all # Install all packages"
7977 @echo " install_kernel_pkgs # Install packages needed to build the kernel"
80- @echo " install_qemu # Install riscv qemu and dependencies"
8178 @echo " install_hosttool_pkgs # Install dependancies for compiling host tool"
79+ @echo " install_tool_pkgs # Install miscellaneous tool packages"
8280 @echo " install_tt_installer # Install (run) tt-installer for tt-kmd, tt-smi and luwen"
8381 @echo " clone_linux # Clone the Tenstorrent Linux kernel source tree"
8482 @echo " clone_opensbi # Clone the Tenstorrent opensbi source tree"
@@ -137,8 +135,8 @@ user-data.img: user-data.yaml _need_cloud_image_utils
137135
138136# Boot with cloud-init image attached
139137boot_cloud_init : _need_linux _need_opensbi _need_dtb _need_rootfs _need_hosttool _need_python _need_luwen _need_ttkmd _need_pylibfdt user-data.img
140- $(PYTHON ) boot.py --boot --l2cpu $(L2CPU ) --opensbi_bin fw_jump.bin --opensbi_dst 0x400030000000 --rootfs_dst 0x4000e5000000 --kernel_bin Image --kernel_dst 0x400030200000 --dtb_bin blackhole-card.dtb --dtb_dst 0x400030100000
141- ./console/tt-bh-linux --l2cpu $(L2CPU ) --disk $(DISK_IMAGE ) --cloud-init user-data.img
138+ $(PYTHON ) boot.py --boot --ttdevice $( TTDEVICE ) -- l2cpu $(L2CPU ) --opensbi_bin fw_jump.bin --opensbi_dst 0x400030000000 --rootfs_dst 0x4000e5000000 --kernel_bin Image --kernel_dst 0x400030200000 --dtb_bin blackhole-card.dtb --dtb_dst 0x400030100000
139+ ./console/tt-bh-linux --ttdevice $( TTDEVICE ) -- l2cpu $(L2CPU ) --disk $(DISK_IMAGE ) --cloud-init user-data.img
142140
143141# ################################
144142# Recipes that build things
@@ -186,7 +184,7 @@ build_opensbi: _need_riscv64_toolchain _need_gcc _need_python _need_opensbi_tree
186184 ln -f opensbi/build/platform/generic/firmware/fw_jump.bin fw_jump.bin
187185
188186# Build tt-bh-linux
189- build_hosttool : _need_gcc _need_libvdevslirp
187+ build_hosttool : _need_gcc _need_libvdeslirp
190188 $(MAKE ) -C console -j $(nproc ) $(quiet_make )
191189
192190# Generate a SSH key and add it to the image
@@ -199,7 +197,7 @@ build_ssh_key: _need_e2tools
199197build_all : build_linux build_opensbi build_hosttool
200198 @echo " Build complete! Now run 'make boot' to run Linux"
201199
202- build_dtb_all :
200+ build_dtb_all : _need_dtc
203201 dtc misc/blackhole-p100-2.dts > blackhole-p100-2.dtb
204202 dtc misc/blackhole-p100-3.dts > blackhole-p100-3.dtb
205203
@@ -243,7 +241,7 @@ clean_downloads:
243241# Recipes that install packages
244242
245243# Install all packages
246- install_all : apt_update install_kernel_pkgs install_hosttool_pkgs
244+ install_all : apt_update install_kernel_pkgs install_hosttool_pkgs install_tool_pkgs
247245 @echo " Install complete! Now run 'make build_all' to build Linux, OpenSBI and the host tool"
248246
249247sudo := sudo
@@ -261,13 +259,13 @@ apt_update:
261259install_kernel_pkgs :
262260 $(call install,build-essential libncurses-dev gawk flex bison openssl libssl-dev libelf-dev libudev-dev libpci-dev libiberty-dev autoconf git make bc gcc-riscv64-linux-gnu binutils-multiarch ccache device-tree-compiler)
263261
264- # Install riscv qemu and dependencies
265- install_qemu :
266- $(call install,qemu-system-misc qemu-utils qemu-system-common qemu-system-data qemu-efi-riscv64 )
262+ # Install basic tools (wget, unzip, python3, dtc, e2tools)
263+ install_tool_pkgs :
264+ $(call install,wget unzip python3 device-tree-compiler e2tools qemu-utils )
267265
268266# Install libraries for compiling the host tool and modifying disk images
269267install_hosttool_pkgs :
270- $(call install,libvdeslirp-dev libslirp-dev xz-utils unzip e2tools tmux cloud-image-utils)
268+ $(call install,libvdeslirp-dev libslirp-dev unzip e2tools tmux cloud-image-utils)
271269
272270install_tt_installer : _need_tt_installer
273271 TT_MODE_NON_INTERACTIVE=0 TT_SKIP_INSTALL_HUGEPAGES=0 TT_SKIP_UPDATE_FIRMWARE=0 TT_SKIP_INSTALL_PODMAN=0 TT_SKIP_INSTALL_METALLIUM_CONTAINER=0 TT_REBOOT_OPTION=2 ./tt-installer-v1.1.0.sh
@@ -300,35 +298,35 @@ clone_all: clone_linux clone_opensbi
300298# Recipes that download things
301299
302300define wget
303- wget -O $(1 ) .tmp $(2 )
301+ wget -nv - O $(1 ) .tmp $(2 ) ; \
304302 mv -f $(1 ) .tmp $(1 )
305303endef
306304
307305# Download Debian Trixie riscv64 rootfs
308- download_rootfs : _need_wget _need_unxz
306+ download_rootfs : _need_wget _need_unzip _need_qemu_img
309307 @$(SHELL_VERBOSE ) \
310308 set -eo pipefail; \
311309 if [ -f $( DISK_IMAGE) ]; then \
312310 echo " $( DISK_IMAGE) already exists, skipping download." ; \
313311 exit 0; \
314312 fi ; \
315313 set -x ; \
316- $(call wget,tt-bh-disk-image.zip,https://github.com/tenstorrent/tt-bh-linux/releases/download/v0.10/tt-bh-disk-image.zip)
317- unzip tt-bh-disk-image.zip
318- rm tt-bh-disk-image.zip
319- mv debian-riscv64.img rootfs.ext4
320- qemu-img resize rootfs.ext4 10G
321- e2fsck -fy rootfs.ext4
314+ $(call wget,tt-bh-disk-image.zip,https://github.com/tenstorrent/tt-bh-linux/releases/download/v0.10/tt-bh-disk-image.zip) ; \
315+ unzip -o tt-bh-disk-image.zip ; \
316+ rm tt-bh-disk-image.zip ; \
317+ mv debian-riscv64.img rootfs.ext4 ; \
318+ qemu-img resize rootfs.ext4 10G ; \
319+ e2fsck -fy rootfs.ext4 ; \
322320 resize2fs rootfs.ext4
323321
324322# Download prebuilt Linux, opensbi and dtb
325323download_prebuilt : _need_wget _need_unzip
326324 # TODO: Test this once repo is public
327325 $(call wget,tt-bh-linux.zip,https://github.com/tenstorrent/tt-bh-linux/releases/download/v0.10/tt-bh-linux.zip)
328- unzip tt-bh-linux.zip
326+ unzip -o tt-bh-linux.zip
329327 rm tt-bh-linux.zip
330328
331- download_tt_installer :
329+ download_tt_installer : _need_wget
332330 $(call wget,tt-installer-v1.1.0.sh,https://github.com/tenstorrent/tt-installer/releases/download/v1.1.0/install.sh)
333331 chmod u+x tt-installer-v1.1.0.sh
334332
@@ -354,13 +352,13 @@ _need_dtb_all:
354352 $(call _need_file,blackhole-p100-3.dtb,build,build_dtb_all)
355353
356354_need_rootfs :
357- $(call _need_file,$(DISK_IMAGE ) ,build ,download_rootfs)
355+ $(call _need_file,$(DISK_IMAGE ) ,download ,download_rootfs)
358356
359357_need_hosttool :
360358 $(call _need_file,console/tt-bh-linux,build,build_hosttool)
361359
362360_need_ttkmd :
363- $(call _need_file,/dev/tenstorrent/0,install,install_ttkmd )
361+ $(call _need_file,/dev/tenstorrent/0,install,install_tt_installer )
364362
365363# The spelling is deliberate as _need_file will add -ing
366364_need_linux_tree :
@@ -388,10 +386,7 @@ _need_python:
388386 $(call _need_prog,python3,install,install_tool_pkgs)
389387
390388_need_riscv64_toolchain :
391- $(call _need_prog,riscv64-linux-gnu-gcc,install,install_toolchain_pkgs)
392-
393- _need_unxz :
394- $(call _need_prog,unxz,install,install_tool_pkgs)
389+ $(call _need_prog,riscv64-linux-gnu-gcc,install,install_kernel_pkgs)
395390
396391_need_wget :
397392 $(call _need_prog,wget,install,install_tool_pkgs)
@@ -403,16 +398,19 @@ _need_e2tools:
403398 $(call _need_prog,e2cp,install,install_tool_pkgs)
404399
405400_need_ssh_key :
406- $(call _need_file,user,build_ssh_key)
401+ $(call _need_file,user,build, build_ssh_key)
407402
408403_need_tt_installer :
409404 $(call _need_file,tt-installer-v1.1.0.sh,download,download_tt_installer)
410405
411406_need_tmux :
412407 $(call _need_prog,tmux,install,install_hosttool_pkgs)
413408
414- _need_libvdevslirp :
415- $(call _need_file,/usr/include/slirp/libvdeslirp.h,install_hosttool_pkgs)
409+ _need_libvdeslirp :
410+ $(call _need_file,/usr/include/slirp/libvdeslirp.h,install,install_hosttool_pkgs)
411+
412+ _need_qemu_img :
413+ $(call _need_prog,qemu-img,install,install_tool_pkgs)
416414
417415# _need_file: Check if a file exists, and if not, run the target to create it
418416# args: file action-name target
@@ -454,11 +452,14 @@ endef
454452
455453.PHONY : apt_update \
456454 boot \
457- boot_all \
455+ boot_cloud_init \
456+ boot_initramfs \
458457 build_all \
458+ build_dtb_all \
459459 build_hosttool \
460460 build_linux \
461461 build_opensbi \
462+ build_ssh_key \
462463 clean \
463464 clean_all \
464465 clean_clones \
@@ -471,7 +472,6 @@ endef
471472 clone_linux \
472473 clone_opensbi \
473474 connect \
474- connect_all \
475475 download_all \
476476 download_prebuilt \
477477 download_rootfs \
@@ -480,15 +480,18 @@ endef
480480 install_all \
481481 install_hosttool_pkgs \
482482 install_kernel_pkgs \
483- install_qemu \
484483 install_tool_pkgs \
485484 install_tt_installer \
486485 install_pylibfdt \
486+ ssh \
487487 _need_cloud_image_utils \
488488 _need_dtb \
489+ _need_dtb_all \
489490 _need_dtc \
491+ _need_e2tools \
490492 _need_gcc \
491493 _need_git \
494+ _need_hosttool \
492495 _need_pylibfdt \
493496 _need_linux \
494497 _need_linux_tree \
@@ -498,8 +501,12 @@ endef
498501 _need_python \
499502 _need_riscv64_toolchain \
500503 _need_rootfs \
504+ _need_ssh_key \
501505 _need_tt_installer \
502506 _need_tmux \
503- _need_unxz \
507+ _need_ttkmd \
504508 _need_unzip \
505- _need_libvdevslirp
509+ _need_wget \
510+ _need_libvdeslirp \
511+ _need_qemu_img
512+
0 commit comments