raspberry-pi-os icon indicating copy to clipboard operation
raspberry-pi-os copied to clipboard

How could I boot my pi?

Open aiyolo opened this issue 7 years ago • 24 comments

I've built the lesson01 project and got these files, but I don't know how to do next. _dde-file-manager_20180619162216 _dde-file-manager_20180619162227

aiyolo avatar Jun 19 '18 08:06 aiyolo

You need to copy kernel7.img into the root of the boot partition of your SD card.

bl4ckout31 avatar Jun 19 '18 10:06 bl4ckout31

is it means that I should prepare a sd card with a os, not an empty sd card

aiyolo avatar Jun 19 '18 11:06 aiyolo

Installing Raspbian as stated in the Prerequisites is the prefered way as you can test your USB to TTL connection as well.

Formatting with the right layout should work too if you don't want to install Raspbian. It usually looks like this:

  • MBR partition table
  • "boot" partition: 50 MB, fat32, LBA flag
  • "rootfs" partition: remaining space, ext4

bl4ckout31 avatar Jun 19 '18 11:06 bl4ckout31

I have a problem with lesson 1 too.

I'm testing on a Raspberry 3 model B with the adafruit serial cable as advised in the Prerequisites. I confirmed the setup is working with a Raspbian install. I built (with Docker on a mac) and copied the kernel7.img and src/config.txt files at the root of the boot partition (after emptying it) and then booted the Raspberry with it.

I can not see the "Hello world!" message but it does echo the characters I'm sending. I tried changing what is echoed and even removing the echo to make sure the code I see is running with no success. What's funny is that the echo is working even if I boot the raspberry with no SD card at all, so my guess is that echoing is something done by default within the firmware, which is confusing as it gives the impression that the compiled kernel is partially working.

I don't know how to debug the boot process of a Raspberry Pi. It would be interesting to give some clues about how to debug problems during boot in case the compiled kernel does not work.

BTW, I'd like to thank @s-matyukevich for this initiative, it is truly awesome!

rs avatar Jun 19 '18 20:06 rs

Sure thing @rs, you are welcome.
You have to keep all files that were installed on the boot partition by the Raspbian. By emptying the folder you are removing some files like bootcode,bin and start.elf required by the firmware to correctly work. Unfortunately, I am not aware of any good way of debugging the kernel at the time when UART is still not available - I was struggling with that by myself. It would be nice if somebody can share such a technique - I will definitely mention it in the tutorial.

s-matyukevich avatar Jun 19 '18 20:06 s-matyukevich

Thank you for you reply. I emptied the partition because I like to understand all variables. Seems like those files are playing an important role. Would be interesting to mention them in the lesson and give a brief description of their respective role. I don’t know if future lessons are explaining how to generate these, if not, would that make sense?

rs avatar Jun 19 '18 22:06 rs

Sure, it makes sense. I will add this information to the tutorial.

s-matyukevich avatar Jun 19 '18 23:06 s-matyukevich

I agree. It would make sense to have two installation processes. One using a pre-existingraspbian and another with a pre-formatted sd card and the minimum files required to boot.

xesco avatar Jun 21 '18 16:06 xesco

Yep. One can download required firmware file from official repo of raspberryRaspberry pi. Use bleeding edge bootcode.bin start.elf and fixup.dat etc.

evopen avatar Jun 21 '18 17:06 evopen

Thanks for your enthusiastic reply! Today I received my CH340 USB-TTL serial cable that after my test works well in both windows 10 and deepin 15.6 platform. I follow your instructions : (1) flash my empty SD card with a raspbian os (2) delete the contents in original config.txt and add the three lines described in lesson01 (3)replace the original kenel7.img with the new one. Finally I succeed to see the following output: _deepin-terminal_20180622162537 There is one thing a little bit strange, I plug in the cable to connect my pi, but it won't output anything, under the interface of minicom(I use this to connect my pi, as shown in the above), I re-plug in the cable, in this way, the output appears. I wrote this in case that anyone comes into the same trouble with me.

aiyolo avatar Jun 22 '18 09:06 aiyolo

@aiyolo If you use the TTY to serial cable to power your Raspberry Pi you may lose some output - check this https://github.com/s-matyukevich/raspberry-pi-os/issues/2 issue for details.

s-matyukevich avatar Jul 02 '18 21:07 s-matyukevich

I also added the explanation how to run the RPi OS using an empty CD card https://github.com/s-matyukevich/raspberry-pi-os/commit/6d548b7f4a04ff2df7fdb90baad517868094a7d9

s-matyukevich avatar Jul 02 '18 21:07 s-matyukevich

In the lesson01 src directory the build.sh is not running. i got error while running this. is something like this, ./build.sh: line 3: docker: command not found and i tried for build.bat here also got some error, ./build.bat: line 1: docker: command not found

chethanomkar avatar Jan 02 '19 16:01 chethanomkar

@chethanomkar You need to install Docker.

@s-matyukevich: Maybe the raspbootin way of loading kernels might be interesting for this project as well. It works great. References here:

  • https://github.com/rust-embedded/rust-raspi3-tutorial/tree/master/06_raspbootin64
  • https://github.com/rust-embedded/rust-raspi3-tutorial/blob/master/README.md#Prerequisites

(Original kudos to @bztsrc)

andre-richter avatar Jan 02 '19 16:01 andre-richter

Thanks @andre-richter That's really cool, I like chain loading approach. Will try to experiment with it.

s-matyukevich avatar Jan 02 '19 18:01 s-matyukevich

@rs, did you ever resolve the issue about not seeing "Hello world"? I am also having the same issue where I don't see "Hello world", but I see my key input echoed back.

I was able to interact with the raspberry pi using the USB-to-TTL serial cable prior to replacing the kernel7.img. Also, I just copied over the new kernel8.img and the config.txt, removed the kernel7.img, didn't change anything else.

carise avatar May 05 '19 06:05 carise

@carise check this https://github.com/s-matyukevich/raspberry-pi-os/issues/2#issuecomment-397993408

s-matyukevich avatar May 06 '19 20:05 s-matyukevich

@s-matyukevich Thanks! That worked for me. For some reason, I thought I had to do the quick-plug+run screen only if I was trying to power the rpi with the serial cable. Oops.

carise avatar May 19 '19 07:05 carise

I only seem to be able to successfully run this command screen /dev/cu.usbserial after I unplug and replug in the USB of my USB to Serial adapter on my Mac to the Pi. And this is with the Raspberry Pi kernel still, I have to hit "Enter" for the log-in to show. I still haven't gotten the "Hello World" to work.

omahane avatar Jun 28 '20 22:06 omahane

@omahane I think you got something wrong. screen is used to view the serial communication. Therefore you need to provide the port and the baudrate e.g. screen /dev/ttyUSB0 115200. Your computer will listen for any communication coming from your raspberry pi and if you followed the guide correctly a 'Hello World' message should appear. I tested it yesterday and it worked.

nickes avatar Jun 29 '20 05:06 nickes

I have the same problem with Mac and ch340G chip usb2ttl. When I use screen /dev/cu.wchusbserial14130 115200 to connect to the original Pi OS, everything goes well. I can login and do everything. image

But after I remove the kernel*.img in the boot and place the kernel8.img, as well as modify the config.txt to kernel_old=1 disable_commandline_tags=1 enable_uart=1, I fail to see the hello world. image

image

image image

yangyueren avatar Dec 02 '20 13:12 yangyueren

I have a problem with lesson1. When I set "kernel_old" option to 1 in the config.txt file, it doesn't work for me. But when I don't set the "kernel_old" option ( I don't add it at all in the config.txt), it work ( I receive the "Hello World").

Can anyone help me to figure out why it doesn't work when I set the "kernel_old" option to 1? Thank you in advance!

hassene avatar Feb 13 '21 18:02 hassene

@hassene The kernel_old option only works with older versions of the raspian OS firmware to start with, newer versions work differently and won't work completely with this tutorial. I do have a set of videos that walk through using this tutorial with more modern raspberry pi firmware and with raspberry pi 4 as well. https://www.youtube.com/watch?v=pd9AVmcRc6U&list=PLVxiWMqQvhg9FCteL7I0aohj1_YiUx1x8

rockytriton avatar Feb 13 '21 20:02 rockytriton

@rockytriton Thanks!

hassene avatar Feb 14 '21 10:02 hassene