-
Notifications
You must be signed in to change notification settings - Fork 0
/
README-Renesas
190 lines (137 loc) · 7.04 KB
/
README-Renesas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
Renesas EMMA EV2 bootloader
If you want to known more about the boot sequence for this platform, you can refer the following document:
R19UH0036EJ0600_1chip.pdf
-> Appendix C: Boot loader in ROM
- - - -
This u-boot can be compiled with different configurations, for the Renesas EMMA platforms. E.g.
emev_emmc_config
emev_sd_config
...
EM/EV ROM boot code exist in 0xFFFF_0000, and it use internal SRAM 0xF000_0000. This ROM boot code will load "mini-boot" to SRAM and jump to 0xF000_0000. For SD boot mode, mini-boot is "sdboot.bin" in the SD card root directory. For eMMC boot, miniboot is the first 8K bytes in mmcblk0p1. Mini-boot will then load the remaining part:
For an SD boot:
Load rest of u-boot (uboot-sd.bin to DDR#0x4100_8000)
Load kernel image (uImage to DDR#0x4000_7fc0)
Load ram disk (cramfs to DDR#0x4600_0000), this is optional due to compile option
For an eMMC boot:
Load rest of u-boot (mmcblk0p1#0x0000_2000-0x0004_0000 to DDR#0x4100_8000)
Load kernel image (mmcblk0p2 to DDR#0x4000_7fc0)
Then jump to u-boot
Source code of mini-boot can be found inside board/emxx/emev.
File names for the SD-type boot are hardcoded in board/emxx/emev/mini-boot/mmc/mmc.c (line 668):
static const unsigned char match_name[3][8] = {
{0x75, 0x62, 0x6F, 0x6F, 0x74, 0x2D, 0x73, 0x64}, /* uboot-sd */
{0x75, 0x49, 0x6D, 0x61, 0x67, 0x65, 0x20, 0x20}, /* uImage */
{0x63, 0x72, 0x61, 0x6D, 0x66, 0x73, 0x20, 0x20}, /* cramfs */
};
static const unsigned char MATCH_NAME[3][8] = {
{0x55, 0x42, 0x4F, 0x4F, 0x54, 0x2D, 0x53, 0x44}, /* UBOOT-SD */
{0x55, 0x49, 0x4D, 0x41, 0x47, 0x45, 0x20, 0x20}, /* UIMAGE */
{0x43, 0x52, 0x41, 0x4D, 0x46, 0x53, 0x20, 0x20}, /* CRAMFS */
};
There will be different boot arguments from u-boot, whose definitions can be found in include/configs/emev.h. E.g
...
#if defined(CONFIG_EMXX_EMMCBOOT) || defined(CONFIG_EMXX_ESDBOOT)
#define CONFIG_EXT3_ROOT "/dev/mmcblk0p3" /* emmc-boot or esd-boot */
#elif defined(CONFIG_EMXX_SDTEST)
#define CONFIG_EXT3_ROOT "/dev/mmcblk1p3" /* test-sd boot */
#elif CONFIG_EMEV_EMMC_1Piece
#define CONFIG_EXT3_ROOT "/dev/mmcblk1p3" /* sd-boot (emmc 1 device) */
#else
#define CONFIG_EXT3_ROOT "/dev/mmcblk2p3" /* sd-boot (emmc 2 device) */
#endif
...
#if defined(CONFIG_EMXX_MMCBOOT) || defined(CONFIG_EMXX_SDTEST)
#define CONFIG_BOOTCOMMAND "run ext3cmd"
#else
#define CONFIG_BOOTCOMMAND "run cramfscmd"
#endif
...
Hence, for different build configurations:
emev_emmc_config -> starts "ext3cmd" with root fs set to /dev/mmcblk0p3 (the internal eMMC NAND, partition 3)
emev_sd_config -> starts "cramfscmd" with root fs set to /dev/mmcblk1p3 (the external SD-card Flash, partition 3)
emev_sdtest_config -> starts "ext3cmd" with root fs set to /dev/mmcblk1p3 (the external SD-card Flash, partition 3)
- - - - -
Build Examples
export CROSS_COMPILE=arm-linux-eabi- (or whatever build toolchain used)
cd u-boot
1) for eMMC boot
make distclean
make emev_emmc_config
make
...
ls -lrt
...
-rw-r--r-- 1 ffxx68 ffxx68 131172 2012-09-21 08:39 u-boot-emmc.bin
2) for simple SD boot
make distclean
make emev_sd_config
make
...
ls -lrt
...
-rw-r--r-- 1 ffxx68 ffxx68 122712 2012-09-21 08:41 uboot-sd.bin
-rwxr-xr-x 1 ffxx68 ffxx68 8477 2012-09-21 08:41 sdboot.bin
3) for SD "line system", including the 'cramfs' File System, e.g. for firmware updates
make distclean
make emev_sd_line_config
Add EMEV SD BOOT Option
Add LINE SYSTEM Option
make
...
ls -lrt
...
-rw-r--r-- 1 ffxx68 ffxx68 122728 2012-09-21 08:46 uboot-sd.bin
-rwxr-xr-x 1 ffxx68 ffxx68 8768 2012-09-21 08:46 sdboot.bin
4) for a test, bootable SD-card
make distclean
make emev_sdtest_config
Add EMEV test-SD BOOT Option
make
...
ls -lrt
...
-rw-r--r-- 1 ffxx68 ffxx68 122712 2012-09-21 08:36 uboot-sd.bin
-rwxr-xr-x 1 ffxx68 ffxx68 8544 2012-09-21 08:36 sdboot.bin
- - - - -
Firmware "flashing" on final device
Installing a new firmware installation (i.e. "flashing") on Renesas devices implies having an FAT-32 or FAT-16 SD card, containing at least:
- sdboot.bin and uboot-sd.bin built from "emev_sd_line_config"
- a uImage with a kernel providing the basic services for file system access and update the screen buffer (to show installation progress)
- a cramfs file system, to run the installation
- an installation script
- the u-boot-emmc.bin built from "emev_emmc_config" and renamed to uboot4.bin
- the final kernel image, renamed to uImage4
- the complete userland file system, renamed to android-fs4.tar.gz
Starting the device with the Volume+ & Power button will trigger the SD card boot, which will in turn start the install routines.
Note - sdboot.bin and uboot-sd.bin built from "emev_sd_line_config"
Mounting for example onto a host Linux sytem the "cramfs" found in a typical stock firmware package from a Livall tablet, you can find how flashing works. E.g:
sudo mkdir /mnt/cramfs
sudo mount -o loop cramfs /mnt/cramfs
ls -l /mnt/cramfs/linuxrc
lrwxrwxrwx 1 root root 11 1970-01-01 01:00 /mnt/cramfs/linuxrc -> bin/busybox
cd /mnt/cramfs/etc/init.d
cat rcS
...
INSTALL_SH=`ls /tmp/sd/install.sh`
if [ "$INSTALL_SH" = "/tmp/sd/install.sh" ]; then
/tmp/sd/install.sh
fi
...
The boot command includes "init=/linuxrc", which points to a standard busybox executable. This will by default invoke the "::sysinit:/etc/init.d/rcS" action. This is how install.sh is invoked. Inside install.sh, you will find the instructions to transfer the bootloader, final kernel image and Android file system onto the internal NAND partitions.
An example script to prepare an SD card for a firmware update is given:
fwupd/fwupd.sh <destination>
which will generate all bootlaoder binaries and move files to destination path, which could also be the SD card root dir.
NOTE - The android file system (android-fs4.tar.gz) and kernel image (uImage4) are not included and should be loaded onto SD separately.
- - - - -
Running a "bootable" SD card
Booting from SD card is normally meant for firmware updates, but we could also make the system start the Android on the SD card itself, by properly partitioning and preparing it to be bootable, for faster test cycles during development stages.
The following approach could be used:
1) the SD card should be partitioned and prepared in a way that is similar to the internal NAND
2) the Android init.rc should be corrected to mount the fs to SD card partitions, in place of the NAND ones
3) the uboot-sd.bin should boot with "run ext3cmd" with root fs at "/dev/mmcblk1p3" (the SD card, partition 3)
The following configuration takes care of building the bootloader as per point 3 above:
emev_sdtest_config
The complete script to prepare the SD card in such way is provided:
testsd/testsd.sh /dev/sdd (where "/dev/sdd" is the mount point of the SD on the host)
including the uboot make, SD partitioning and creation steps.
NOTE - The android file system (android-fs4.tar.gz) and kernel image (uImage) are not included and should be stored in testsd/ before executing the script. Also, the android init.rc should have been patched assuming root fs at "/dev/mmcblk1p3", in place of the usual "/dev/mmcblk0p3".