Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How could I boot my pi? #43

Open
aiyolo opened this issue Jun 19, 2018 · 24 comments
Open

How could I boot my pi? #43

aiyolo opened this issue Jun 19, 2018 · 24 comments

Comments

@aiyolo
Copy link

aiyolo commented Jun 19, 2018

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

@bl4ckout31
Copy link
Contributor

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

@aiyolo
Copy link
Author

aiyolo commented Jun 19, 2018

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

@bl4ckout31
Copy link
Contributor

bl4ckout31 commented Jun 19, 2018

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

@rs
Copy link
Contributor

rs commented Jun 19, 2018

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!

@s-matyukevich
Copy link
Owner

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.

@rs
Copy link
Contributor

rs commented Jun 19, 2018

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?

@s-matyukevich
Copy link
Owner

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

@xesco
Copy link
Contributor

xesco commented Jun 21, 2018

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.

@evopen
Copy link
Contributor

evopen commented Jun 21, 2018

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

@aiyolo
Copy link
Author

aiyolo commented Jun 22, 2018

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.

@s-matyukevich
Copy link
Owner

@aiyolo If you use the TTY to serial cable to power your Raspberry Pi you may lose some output - check this #2 issue for details.

@s-matyukevich
Copy link
Owner

I also added the explanation how to run the RPi OS using an empty CD card 6d548b7

@chethanomkar
Copy link

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

@andre-richter
Copy link

@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:

(Original kudos to @bztsrc)

@s-matyukevich
Copy link
Owner

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

@carise
Copy link

carise commented May 5, 2019

@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.

@s-matyukevich
Copy link
Owner

@carise check this #2 (comment)

@carise
Copy link

carise commented May 19, 2019

@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.

@omahane
Copy link

omahane commented Jun 28, 2020

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.

@nickes
Copy link

nickes commented Jun 29, 2020

@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.

@yangyueren
Copy link

yangyueren commented Dec 2, 2020

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

@hassene
Copy link

hassene commented Feb 13, 2021

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!

@rockytriton
Copy link

@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

@hassene
Copy link

hassene commented Feb 14, 2021

@rockytriton Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests