xref: /OK3568_Linux_fs/buildroot/board/raspberrypi/readme.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunRaspberry Pi
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunIntro
4*4882a593Smuzhiyun=====
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThese instructions apply to all models of the Raspberry Pi:
7*4882a593Smuzhiyun  - the original models A and B,
8*4882a593Smuzhiyun  - the "enhanced" models A+ and B+,
9*4882a593Smuzhiyun  - the model B2 (aka Raspberry Pi 2)
10*4882a593Smuzhiyun  - the model B3 (aka Raspberry Pi 3).
11*4882a593Smuzhiyun  - the model B4 (aka Raspberry Pi 4).
12*4882a593Smuzhiyun  - the model CM4 (aka Raspberry Pi Compute Module 4 and IO Board).
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunHow to build it
15*4882a593Smuzhiyun===============
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunConfigure Buildroot
18*4882a593Smuzhiyun-------------------
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunThere are two RaspberryPi defconfig files in Buildroot, one for each
21*4882a593Smuzhiyunmajor variant, which you should base your work on:
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunFor models A, B, A+ or B+:
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun  $ make raspberrypi_defconfig
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunFor model Zero (model A+ in smaller form factor):
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun  $ make raspberrypi0_defconfig
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunFor model 2 B:
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun  $ make raspberrypi2_defconfig
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunFor model 3 B and B+:
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun  $ make raspberrypi3_defconfig
38*4882a593Smuzhiyun
39*4882a593Smuzhiyunor for model 3 B and B+ (64 bit):
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun  $ make raspberrypi3_64_defconfig
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunFor model 4 B:
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun  $ make raspberrypi4_defconfig
46*4882a593Smuzhiyun
47*4882a593Smuzhiyunor for model 4 B (64 bit):
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun  $ make raspberrypi4_64_defconfig
50*4882a593Smuzhiyun
51*4882a593SmuzhiyunFor model CM4 (on IO Board):
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun  $ make raspberrypicm4io_defconfig
54*4882a593Smuzhiyun
55*4882a593Smuzhiyunor for CM4 (on IO Board - 64 bit):
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun  $ make raspberrypicm4io_64_defconfig
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunBuild the rootfs
60*4882a593Smuzhiyun----------------
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunNote: you will need to have access to the network, since Buildroot will
63*4882a593Smuzhiyundownload the packages' sources.
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunYou may now build your rootfs with:
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun  $ make
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun(This may take a while, consider getting yourself a coffee ;-) )
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunResult of the build
72*4882a593Smuzhiyun-------------------
73*4882a593Smuzhiyun
74*4882a593SmuzhiyunAfter building, you should obtain this tree:
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun    output/images/
77*4882a593Smuzhiyun    +-- bcm2708-rpi-b.dtb           [1]
78*4882a593Smuzhiyun    +-- bcm2708-rpi-b-plus.dtb      [1]
79*4882a593Smuzhiyun    +-- bcm2709-rpi-2-b.dtb         [1]
80*4882a593Smuzhiyun    +-- bcm2710-rpi-3-b.dtb         [1]
81*4882a593Smuzhiyun    +-- bcm2710-rpi-3-b-plus.dtb    [1]
82*4882a593Smuzhiyun    +-- bcm2711-rpi-4-b.dtb         [1]
83*4882a593Smuzhiyun    +-- bcm2711-rpi-cm4.dtb         [1]
84*4882a593Smuzhiyun    +-- boot.vfat
85*4882a593Smuzhiyun    +-- rootfs.ext4
86*4882a593Smuzhiyun    +-- rpi-firmware/
87*4882a593Smuzhiyun    |   +-- bootcode.bin
88*4882a593Smuzhiyun    |   +-- cmdline.txt
89*4882a593Smuzhiyun    |   +-- config.txt
90*4882a593Smuzhiyun    |   +-- fixup.dat               [1]
91*4882a593Smuzhiyun    |   +-- fixup4.dat              [1]
92*4882a593Smuzhiyun    |   +-- start.elf               [1]
93*4882a593Smuzhiyun    |   +-- start4.elf              [1]
94*4882a593Smuzhiyun    |   `-- overlays/               [2]
95*4882a593Smuzhiyun    +-- sdcard.img
96*4882a593Smuzhiyun    +-- Image                       [1]
97*4882a593Smuzhiyun    `-- zImage                      [1]
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun[1] Not all of them will be present, depending on the RaspberryPi
100*4882a593Smuzhiyun    model you are using.
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun[2] Only for the Raspberry Pi 3/4 Models (overlay miniuart-bt is needed
103*4882a593Smuzhiyun    to enable the RPi3 serial console otherwise occupied by the bluetooth
104*4882a593Smuzhiyun    chip). Alternative would be to disable the serial console in cmdline.txt
105*4882a593Smuzhiyun    and /etc/inittab.
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunHow to write the SD card
108*4882a593Smuzhiyun========================
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunOnce the build process is finished you will have an image called "sdcard.img"
111*4882a593Smuzhiyunin the output/images/ directory.
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunCopy the bootable "sdcard.img" onto an SD card with "dd":
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun  $ sudo dd if=output/images/sdcard.img of=/dev/sdX
116*4882a593Smuzhiyun
117*4882a593SmuzhiyunInsert the SDcard into your Raspberry Pi, and power it up. Your new system
118*4882a593Smuzhiyunshould come up now and start two consoles: one on the serial port on
119*4882a593Smuzhiyunthe P1 header, one on the HDMI output where you can login using a USB
120*4882a593Smuzhiyunkeyboard.
121*4882a593Smuzhiyun
122*4882a593SmuzhiyunHow to write to CM4 eMMC memory
123*4882a593Smuzhiyun===============================
124*4882a593Smuzhiyun
125*4882a593SmuzhiyunFor CM4 modules without eMMC memory see above for booting from SD card,
126*4882a593Smuzhiyunfor CM4 moduels with eMMC memory proceed as following:
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun- fit jumper on IO Board header J2 to disable eMMC boot
129*4882a593Smuzhiyun- connect IO Board micro USB port (J11 USB slave) to your host linux system
130*4882a593Smuzhiyun- power up CM4/IO Board (lsusb command should show a '0a5c:2711 Broadcom Corp.
131*4882a593Smuzhiyun  BCM2711 Boot' device)
132*4882a593Smuzhiyun- run 'sudo ./host/bin/rpiboot', output should look like the following:
133*4882a593Smuzhiyun    Waiting for BCM2835/6/7/2711...
134*4882a593Smuzhiyun    Loading embedded: bootcode4.bin
135*4882a593Smuzhiyun    Sending bootcode.bin
136*4882a593Smuzhiyun    Successful read 4 bytes
137*4882a593Smuzhiyun    Waiting for BCM2835/6/7/2711...
138*4882a593Smuzhiyun    Loading embedded: bootcode4.bin
139*4882a593Smuzhiyun    Second stage boot server
140*4882a593Smuzhiyun    Loading embedded: start4.elf
141*4882a593Smuzhiyun    File read: start4.elf
142*4882a593Smuzhiyun    Second stage boot server done
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun- a USB mass storage device should show up (the CM4 eMMC memory), proceed
145*4882a593Smuzhiyun  as described above to copy sdcard.img to it
146*4882a593Smuzhiyun- power down CM4/IO Board
147*4882a593Smuzhiyun- remove jumper on IO Board header J2 to re-enable eMMC boot
148*4882a593Smuzhiyun- power up CM4/IO Board
149