From: Paul Walmsley <paul.walmsley@sifive.com> To: linux-riscv@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: khilman@baylibre.com Subject: Testing the recent RISC-V DT patchsets Date: Mon, 22 Apr 2019 17:17:43 -0700 (PDT) [thread overview] Message-ID: <alpine.DEB.2.21.9999.1904221705170.18377@viisi.sifive.com> (raw) I've heard from two separate people who have had trouble getting started with BBL & open-source FSBL test flows with arbitrary DT files on the Freedom Unleashed board. The following instructions should help get people started. The core issue, aside from general unfamiliarity, is that multiple parts of the pre-kernel software stack try to parse and/or modify the kernel DT. We wish to avoid this as much as possible. Testing with U-boot and OpenSBI is currently left as an exercise for the reader, for a similar reason and because those ports are still quite new. The following instructions are provided with no warranty whatsoever, and assume knowledge of the shell and Linux. If implemented carelessly, may trash your filesystems or do other horrible things. - Paul These instructions assume that bare metal and Linux RV64 cross-toolchains are installed. If not, consider using crosstool-ng with the "riscv64-unknown-elf" and "riscv64-unknown-linux-gnu" experimental sample configurations. You will need both. 1. Put the location of the temporary build tree into the BASE environment variable, and set up some initial directories: export BASE=~/riscv-test; mkdir -p ${BASE}/work 2. Partition a microSD card with (at least) two GPT partitions. Here is a sample sfdisk dump: label: gpt label-id: 074689DB-0440-411C-91DB-440DFE5BA0B6 device: /dev/sda unit: sectors first-lba: 34 last-lba: 62333918 /dev/sda1 : start= 2048, size= 2048, type=5B193300-FC78-40CD-8002-E86C45580B47, uuid=DEAD9378-45FF-44FB-B2E3-F3FEA45ADC9E, name="fsbl" /dev/sda2 : start= 4096, size= 65536, type=2E54B353-1271-4842-806F-E436D6AF6985, uuid=1B48DE68-8004-444D-BA47-AAA8DBEBFA60, name="bbl" /dev/sda3 : start= 69632, size= 62264287, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=D672F1FC-3E45-4CC1-835A-E6384A26C395, name="rootfs" 3. Download the open-source FSBL: cd ${BASE} git clone https://github.com/sifive/freedom-u540-c000-bootloader 4. Build the open-source FSBL: cd freedom-u540-c000-bootloader CROSSCOMPILE=/opt/rv64gc-mmu-elf/bin/riscv64-unknown-elf- make 5. Write the open-source FSBL to the first partition of the SD card with something like: sudo dd if=fsbl.bin of=/dev/SD-CARD-DEVICE1 conv=nocreat 6. Copy an initramfs sysroot into ${BASE}/work/buildroot_initramfs_sysroot. A reasonable one to start with is the sysroot built by freedom-u-sdk, in work/buildroot_initramfs_sysroot. 7. Set the CROSS_COMPILE environment variable to point to your cross-compiler, in the Linux kernel form: export CROSS_COMPILE=/opt/rv64gc-mmu-linux-8.2.0/bin/riscv64-unknown-linux-gnu- 8. Put something like this into a script and run it: if [ ! -d ${BASE} ]; then echo Base build directory must be set in the BASE environment variable fi if [ ! -x ${CROSS_COMPILE}gcc ]; then echo Path to cross-compiler must be set in the CROSS_COMPILE environment variable fi export ARCH=riscv export OBJCOPY=${CROSS_COMPILE}objcopy export CC=${CROSS_COMPILE}gcc CORES=$(getconf _NPROCESSORS_ONLN) # # cd ${BASE} git clone -b dev/paulw/reduce-dt-load-v1 https://github.com/sifive/riscv-pk git clone -b dev/paulw/dts-v5.1-rc6-experimental https://github.com/sifive/riscv-linux cd riscv-linux make -j${CORES} defconfig dtbs vmlinux ${CROSS_COMPILE}strip -o ${BASE}/work/vmlinux-stripped ${BASE}/riscv-linux/vmlinux rm -rf ${BASE}/work/riscv-pk mkdir -p ${BASE}/work/riscv-pk cd ${BASE}/work/riscv-pk ln -sf ${BASE}/riscv-linux/arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dtb ${BASE}/riscv-pk/linux.dtb ${BASE}/riscv-pk/configure \ --host=riscv64-unknown-linux-gnu \ --enable-print-device-tree --with-payload=../vmlinux-stripped CFLAGS="-mabi=lp64d -march=rv64imafdc" make $OBJCOPY -S -O binary --change-addresses -0x80000000 bbl ../bbl.bin 9. Write ${BASE}/work/bbl.bin to the second partition of your microSD card with something like: sudo dd if=${BASE}/work/bbl.bin of=/dev/SD-CARD-DEVICE2 bs=64k conv=nocreat 10. Boot the microSD card on your Unleashed board.
WARNING: multiple messages have this Message-ID (diff)
From: Paul Walmsley <paul.walmsley@sifive.com> To: linux-riscv@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: khilman@baylibre.com Subject: Testing the recent RISC-V DT patchsets Date: Mon, 22 Apr 2019 17:17:43 -0700 (PDT) [thread overview] Message-ID: <alpine.DEB.2.21.9999.1904221705170.18377@viisi.sifive.com> (raw) I've heard from two separate people who have had trouble getting started with BBL & open-source FSBL test flows with arbitrary DT files on the Freedom Unleashed board. The following instructions should help get people started. The core issue, aside from general unfamiliarity, is that multiple parts of the pre-kernel software stack try to parse and/or modify the kernel DT. We wish to avoid this as much as possible. Testing with U-boot and OpenSBI is currently left as an exercise for the reader, for a similar reason and because those ports are still quite new. The following instructions are provided with no warranty whatsoever, and assume knowledge of the shell and Linux. If implemented carelessly, may trash your filesystems or do other horrible things. - Paul These instructions assume that bare metal and Linux RV64 cross-toolchains are installed. If not, consider using crosstool-ng with the "riscv64-unknown-elf" and "riscv64-unknown-linux-gnu" experimental sample configurations. You will need both. 1. Put the location of the temporary build tree into the BASE environment variable, and set up some initial directories: export BASE=~/riscv-test; mkdir -p ${BASE}/work 2. Partition a microSD card with (at least) two GPT partitions. Here is a sample sfdisk dump: label: gpt label-id: 074689DB-0440-411C-91DB-440DFE5BA0B6 device: /dev/sda unit: sectors first-lba: 34 last-lba: 62333918 /dev/sda1 : start= 2048, size= 2048, type=5B193300-FC78-40CD-8002-E86C45580B47, uuid=DEAD9378-45FF-44FB-B2E3-F3FEA45ADC9E, name="fsbl" /dev/sda2 : start= 4096, size= 65536, type=2E54B353-1271-4842-806F-E436D6AF6985, uuid=1B48DE68-8004-444D-BA47-AAA8DBEBFA60, name="bbl" /dev/sda3 : start= 69632, size= 62264287, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=D672F1FC-3E45-4CC1-835A-E6384A26C395, name="rootfs" 3. Download the open-source FSBL: cd ${BASE} git clone https://github.com/sifive/freedom-u540-c000-bootloader 4. Build the open-source FSBL: cd freedom-u540-c000-bootloader CROSSCOMPILE=/opt/rv64gc-mmu-elf/bin/riscv64-unknown-elf- make 5. Write the open-source FSBL to the first partition of the SD card with something like: sudo dd if=fsbl.bin of=/dev/SD-CARD-DEVICE1 conv=nocreat 6. Copy an initramfs sysroot into ${BASE}/work/buildroot_initramfs_sysroot. A reasonable one to start with is the sysroot built by freedom-u-sdk, in work/buildroot_initramfs_sysroot. 7. Set the CROSS_COMPILE environment variable to point to your cross-compiler, in the Linux kernel form: export CROSS_COMPILE=/opt/rv64gc-mmu-linux-8.2.0/bin/riscv64-unknown-linux-gnu- 8. Put something like this into a script and run it: if [ ! -d ${BASE} ]; then echo Base build directory must be set in the BASE environment variable fi if [ ! -x ${CROSS_COMPILE}gcc ]; then echo Path to cross-compiler must be set in the CROSS_COMPILE environment variable fi export ARCH=riscv export OBJCOPY=${CROSS_COMPILE}objcopy export CC=${CROSS_COMPILE}gcc CORES=$(getconf _NPROCESSORS_ONLN) # # cd ${BASE} git clone -b dev/paulw/reduce-dt-load-v1 https://github.com/sifive/riscv-pk git clone -b dev/paulw/dts-v5.1-rc6-experimental https://github.com/sifive/riscv-linux cd riscv-linux make -j${CORES} defconfig dtbs vmlinux ${CROSS_COMPILE}strip -o ${BASE}/work/vmlinux-stripped ${BASE}/riscv-linux/vmlinux rm -rf ${BASE}/work/riscv-pk mkdir -p ${BASE}/work/riscv-pk cd ${BASE}/work/riscv-pk ln -sf ${BASE}/riscv-linux/arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dtb ${BASE}/riscv-pk/linux.dtb ${BASE}/riscv-pk/configure \ --host=riscv64-unknown-linux-gnu \ --enable-print-device-tree --with-payload=../vmlinux-stripped CFLAGS="-mabi=lp64d -march=rv64imafdc" make $OBJCOPY -S -O binary --change-addresses -0x80000000 bbl ../bbl.bin 9. Write ${BASE}/work/bbl.bin to the second partition of your microSD card with something like: sudo dd if=${BASE}/work/bbl.bin of=/dev/SD-CARD-DEVICE2 bs=64k conv=nocreat 10. Boot the microSD card on your Unleashed board. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2019-04-23 0:17 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-23 0:17 Paul Walmsley [this message] 2019-04-23 0:17 ` Testing the recent RISC-V DT patchsets Paul Walmsley 2019-05-28 8:32 ` Paul Walmsley 2019-05-28 8:32 ` Paul Walmsley 2019-05-28 15:10 ` Loys Ollivier 2019-05-28 15:10 ` Loys Ollivier 2019-05-28 15:35 ` Karsten Merker 2019-05-28 15:35 ` Karsten Merker 2019-05-29 7:50 ` Atish Patra 2019-05-29 7:50 ` Atish Patra 2019-05-29 10:04 ` Loys Ollivier 2019-05-29 10:04 ` Loys Ollivier 2019-05-29 17:09 ` Atish Patra 2019-05-29 17:09 ` Atish Patra 2019-05-29 17:25 ` Troy Benjegerdes 2019-05-29 17:25 ` Troy Benjegerdes 2019-06-03 9:49 ` Loys Ollivier 2019-06-03 9:49 ` Loys Ollivier 2019-06-03 15:40 ` Troy Benjegerdes 2019-06-03 15:40 ` Troy Benjegerdes 2019-06-03 20:17 ` Troy Benjegerdes 2019-06-03 20:17 ` Troy Benjegerdes 2019-06-04 6:12 ` Anup Patel 2019-06-04 6:12 ` Anup Patel 2019-05-29 9:41 ` Loys Ollivier 2019-05-29 9:41 ` Loys Ollivier 2019-05-28 19:38 ` Atish Patra 2019-05-28 19:38 ` Atish Patra
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=alpine.DEB.2.21.9999.1904221705170.18377@viisi.sifive.com \ --to=paul.walmsley@sifive.com \ --cc=khilman@baylibre.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=linux-serial@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.