tftp: rootfs.cpio is zero size
See original GitHub issuefrom tutorial: HowTo-LCA2018-FPGA-Miniconf-VexRiscv-Renode
I am trying the section “Boot Linux via tftp”. This gist has the full log.
Overview:
$ export CPU=vexriscv CPU_VARIANT=linux PLATFORM=arty TARGET=net FIRMWARE=linux
$ source ./scripts/enter-env.sh
(LX P=arty C=vexriscv.linux F=linux) $
(LX P=arty C=vexriscv.linux F=linux) $ make gateware
(LX P=arty C=vexriscv.linux F=linux) $ ./scripts/build-linux.sh
Here is the part with tftp:
(LX P=arty C=vexriscv.linux F=linux) pdp7@x1:~/dev/litex-buildenv$ make tftpd_stop
# FIXME: This is dangerous...
(LX P=arty C=vexriscv.linux F=linux) pdp7@x1:~/dev/litex-buildenv$ make tftpd_start
mkdir -p build/tftpd/
Starting atftpd
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: Advanced Trivial FTP server started (0.7)
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: running in daemon mode on port 6069
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: bound to IP address 192.168.100.100 only
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: logging level: 6
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: directory: build/tftpd//
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: user: pdp7.pdp7
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: log file: /dev/stdout
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: not forcing to listen on local interfaces.
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: server timeout: Not used
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: tftp retry timeout: 5
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: maximum number of thread: 100
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: option timeout: enabled
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: option tzise: enabled
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: option blksize: enabled
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: option multicast: enabled
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: address range: 239.255.0.0-255
Feb 19 23:35:16 x1 atftpd[16880.139858938175552]: port range: 1758
(LX P=arty C=vexriscv.linux F=linux) pdp7@x1:~/dev/litex-buildenv$ make tftp
mkdir -p build/arty_net_vexriscv.linux/
time python -u ./make.py --platform=arty --target=net --cpu-type=vexriscv --iprange=192.168.100 -Ob toolchain_path /home/pdp7/dev/litex-buildenv/build/Xilinx/opt/Xilinx/ --cpu-variant=linux --cpu-variant=linux --no-compile-gateware \
2>&1 | tee -a /home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux//output.20200219-233522.log; (exit ${PIPESTATUS[0]})
[WARNING] Deprecated, please update : shadow_base replaced by IO regions.
make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[1]: Entering directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/libcompiler_rt'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/libcompiler_rt'
make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[1]: Entering directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/libbase'
CC exception.o
CC system.o
CC id.o
CC uart.o
CC time.o
CC spiflash.o
CC mdio.o
AR libbase.a
AR libbase-nofloat.a
make[1]: Leaving directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/libbase'
make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[1]: Entering directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/libnet'
CC microudp.o
AR libnet.a
make[1]: Leaving directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/libnet'
make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[1]: Entering directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/bios'
CC isr.o
CC sdram.o
CC main.o
CC boot.o
LD bios.elf
chmod -x bios.elf
OBJCOPY bios.bin
chmod -x bios.bin
python -m litex.soc.software.mkmscimg bios.bin --little
make[1]: Leaving directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/bios'
make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[1]: Entering directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/uip'
CC clock-arch.o
CC liteethmac-drv.o
AR libuip.a
make[1]: Leaving directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/uip'
make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[1]: Entering directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/firmware'
CC bist.o
CC ci.o
/home/pdp7/dev/litex-buildenv/firmware/ci.c: In function 'status_short_print':
/home/pdp7/dev/litex-buildenv/firmware/ci.c:368:15: warning: unused variable 'underflows' [-Wunused-variable]
unsigned int underflows;
^~~~~~~~~~
/home/pdp7/dev/litex-buildenv/firmware/ci.c: In function 'status_print':
/home/pdp7/dev/litex-buildenv/firmware/ci.c:467:15: warning: unused variable 'underflows' [-Wunused-variable]
unsigned int underflows;
^~~~~~~~~~
At top level:
/home/pdp7/dev/litex-buildenv/firmware/ci.c:1002:21: warning: 'log2' defined but not used [-Wunused-function]
static unsigned int log2(unsigned int v)
^~~~
CC config.o
CC encoder.o
CC etherbone.o
CC ethernet.o
CC fx2.o
CC hdmi_in0.o
CC hdmi_out0.o
CC hdmi_out1.o
CC heartbeat.o
CC isr.o
CC main.o
CC mdio.o
CC mmcm.o
/home/pdp7/dev/litex-buildenv/firmware/mmcm.c: In function 'mmcm_dump_all':
/home/pdp7/dev/litex-buildenv/firmware/mmcm.c:110:6: warning: unused variable 'i' [-Wunused-variable]
int i;
^
CC oled.o
CC opsis_eeprom.o
bash /home/pdp7/dev/litex-buildenv/firmware/version_data.sh
# Check the version files exist
[ -e /home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/include/../..//software/firmware/version_data.h ]
[ -e /home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/include/../..//software/firmware/version_data.c ]
CC pattern.o
CC pll.o
CC processor.o
/home/pdp7/dev/litex-buildenv/firmware/processor.c: In function 'fb_set_mode':
/home/pdp7/dev/litex-buildenv/firmware/processor.c:532:15: warning: unused variable 'hdmi_out1_enabled' [-Wunused-variable]
unsigned int hdmi_out1_enabled;
^~~~~~~~~~~~~~~~~
/home/pdp7/dev/litex-buildenv/firmware/processor.c:531:15: warning: unused variable 'hdmi_out0_enabled' [-Wunused-variable]
unsigned int hdmi_out0_enabled;
^~~~~~~~~~~~~~~~~
/home/pdp7/dev/litex-buildenv/firmware/processor.c: In function 'processor_service':
/home/pdp7/dev/litex-buildenv/firmware/processor.c:793:29: warning: unused variable 'm' [-Wunused-variable]
const struct video_timing *m = &video_modes[processor_mode];
^
At top level:
/home/pdp7/dev/litex-buildenv/firmware/processor.c:449:13: warning: 'fb_clkgen_write' defined but not used [-Wunused-function]
static void fb_clkgen_write(int m, int d)
^~~~~~~~~~~~~~~
CC reboot.o
CC stdio_wrap.o
CC tofe_eeprom.o
CC uptime.o
CC version.o
CC pcie.o
CC /home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/include/../..//software/firmware/hdmi_in1.o
LD firmware.elf
chmod -x firmware.elf
OBJCOPY firmware.bin
chmod -x firmware.bin
python -m litex.soc.software.mkmscimg -f --little firmware.bin -o firmware.fbi
make[1]: Leaving directory '/home/pdp7/dev/litex-buildenv/build/arty_net_vexriscv.linux/software/firmware'
real 0m5.673s
user 0m3.277s
sys 0m0.425s
rm -rf build/tftpd/
mkdir -p build/tftpd/
cp build/arty_net_vexriscv.linux//software/linux/firmware.bin build/tftpd//Image
cp build/arty_net_vexriscv.linux//software/linux/riscv32-rootfs.cpio build/tftpd//rootfs.cpio
cp build/arty_net_vexriscv.linux//software/linux/rv32.dtb build/tftpd/
cp build/arty_net_vexriscv.linux//emulator/emulator.bin build/tftpd/
The I run:
make gateware-load
make firmware-connect
meanwhile I get this error:
(LX P=arty C=vexriscv.linux F=linux) pdp7@x1:~/dev/litex-buildenv$ make gateware-load
openocd -f board/digilent_arty.cfg -c "init; pld load 0 build/arty_net_vexriscv.linux//gateware/top.bit; exit"
Open On-Chip Debugger 0.10.0+dev-01012-ged8fa09cf-dirty (2020-01-15-04:14)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
jtagspi_program
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: xc7.tap tap/device found: 0x0362d093 (mfg: 0x049 (Xilinx), part: 0x362d, ver: 0x0)
(LX P=arty C=vexriscv.linux F=linux) pdp7@x1:~/dev/litex-buildenv$ Feb 19 23:37:04 x1 atftpd[16880.139858938087168]: socket may listen on any address, including broadcast
Feb 19 23:37:04 x1 atftpd[16880.139858938087168]: Serving Image to 192.168.100.50:7642
Feb 19 23:37:10 x1 atftpd[16880.139858938087168]: Server thread exiting
Feb 19 23:37:10 x1 atftpd[16880.139858929694464]: socket may listen on any address, including broadcast
Feb 19 23:37:10 x1 atftpd[16880.139858929694464]: Serving rootfs.cpio to 192.168.100.50:7642
Feb 19 23:37:10 x1 atftpd[16880.139858929694464]: Server thread exiting
Feb 19 23:37:10 x1 atftpd[16880.139858929694464]: socket may listen on any address, including broadcast
Feb 19 23:37:10 x1 atftpd[16880.139858929694464]: Serving boot.bin to 192.168.100.50:7642
Feb 19 23:37:10 x1 atftpd[16880.139858929694464]: File build/tftpd//boot.bin not found
Feb 19 23:37:10 x1 atftpd[16880.139858929694464]: Server thread exiting
Issue Analytics
- State:
- Created 4 years ago
- Comments:10
Top Results From Across the Web
Building Xen Hypervisor with Petalinux 2019.1 - Xilinx Wiki
RootFS mounted on RAM (initrd). This method is required when using a Linux image which is initrd based and does not include a...
Read more >oversized secure-boot ramdisk silently truncated · Issue #375
It's working fine as long as the initrd is below 64MB. But if that's not the case, the initrd seems to get truncated...
Read more >Solved: LS2085ARDB How to boot upstream kernel
Solved: Hi, I've recently received a LS2085ardb board, but cannot seem to find the documentation on how to build a kernel.
Read more >Booting Linux with rootfs on SD Card
Build the project with the make command. Insert an SD card to the Linux host and create an ext3 partition on it with...
Read more >Using PetaLinux for NFS and TFTP boot
... Image, and system.dtb over TFTP and uses the rootfs.cpio.gz.u-boot as the root FS, instead of loading image.ub and using NFS as the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s a quite nice analysis of the problem - @pdp7 😃
It looks like some initial
wget
failed (network problem?) and it created an emptyriscv32-rootfs.cpio
file. From this moment on the (broken, empty) cached version was served by the tftp server.The trivial solution would be to not only check if the rootfs file exists, but also verify it’s not empty. I sense more problems though - what if the file is only partially downloaded (i.e., it’s not a proper rootfs image but it’s not empty)?
We should probably add some CRC checking to make sure that files downloaded with
wget
are correct.BTW: I also noticed a problem in
build-linux.sh
script in your log: https://gist.github.com/pdp7/287a0a5159d1877480aaaf6e513c23b1#file-litex-tftp-linux-txt-L3011. It’s not related to your issue, but should be fixed anyway.#347 added checksum verification of downloaded files, so this problem should not happen again.