Parcourir la source

Beginning of support for odroid c2

Bob Mottram il y a 8 ans
Parent
révision
33e6f2c2be
Aucun compte lié à l'adresse email de l'auteur

+ 1
- 1
README.md Voir le fichier

@@ -51,7 +51,7 @@ To build a 64bit Qemu image:
51 51
 
52 52
     freedombone-image -t qemu-x86_64 -s 8G
53 53
 
54
-Other supported boards are cubieboard2, cubietruck, olinuxino-lime, olinuxino-lime2 and olinuxino-micro.
54
+Other supported boards are cubieboard2, cubietruck, olinuxino-lime, olinuxino-lime2, olinuxino-micro and odroid-c2.
55 55
 
56 56
 If the image build fails with an error such as "/Error reading from server. Remote end closed connection/" then you can specify a debian package mirror repository manually with:
57 57
 

BIN
man/freedombone-image.1.gz Voir le fichier


+ 148
- 95
src/freedombone-image-hardware-setup Voir le fichier

@@ -32,27 +32,27 @@ export TEXTDOMAIN=${PROJECT_NAME}-image-hardware-setup
32 32
 export TEXTDOMAINDIR="/usr/share/locale"
33 33
 
34 34
 enable_serial_console() {
35
-    # By default, spawn a console on the serial port
36
-    device="$1"
37
-    echo $"Adding a getty on the serial port"
38
-    echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab
35
+	# By default, spawn a console on the serial port
36
+	device="$1"
37
+	echo $"Adding a getty on the serial port"
38
+	echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab
39 39
 }
40 40
 
41 41
 beaglebone_setup_boot() {
42
-    # Setup uEnv.txt
43
-    if grep -q btrfs /etc/fstab ; then
44
-        fstype=btrfs
45
-    else
46
-        fstype=ext4
47
-    fi
48
-    kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
49
-    version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
50
-    initRd=initrd.img-$version
51
-    vmlinuz=vmlinuz-$version
52
-
53
-    # uEnv.txt for Beaglebone
54
-    # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
55
-    cat >> /boot/uEnv.txt <<EOF
42
+	# Setup uEnv.txt
43
+	if grep -q btrfs /etc/fstab ; then
44
+		fstype=btrfs
45
+	else
46
+		fstype=ext4
47
+	fi
48
+	kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
49
+	version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
50
+	initRd=initrd.img-$version
51
+	vmlinuz=vmlinuz-$version
52
+
53
+	# uEnv.txt for Beaglebone
54
+	# based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
55
+	cat >> /boot/uEnv.txt <<EOF
56 56
 mmcroot=/dev/mmcblk0p2 ro
57 57
 mmcrootfstype=$fstype rootwait fixrtc
58 58
 mmcrootflags=subvol=@
@@ -79,17 +79,17 @@ mmcargs=setenv bootargs console=tty0 console=\${console} root=\${mmcroot} rootfs
79 79
 uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
80 80
 EOF
81 81
 
82
-    mkdir -p /boot/dtbs
83
-    cp /usr/lib/linux-image-*-armmp/* /boot/dtbs
82
+	mkdir -p /boot/dtbs
83
+	cp /usr/lib/linux-image-*-armmp/* /boot/dtbs
84 84
 }
85 85
 
86 86
 beaglebone_flash() {
87
-    # allow flash-kernel to work without valid /proc contents
88
-    # ** this doesn't *really* work, since there are too many checks
89
-    #    that fail in an emulated environment!  We'll have to do it by
90
-    #    hand below anyway...
91
-    export FK_MACHINE="TI AM335x BeagleBone"
92
-    apt-get install -y flash-kernel
87
+	# allow flash-kernel to work without valid /proc contents
88
+	# ** this doesn't *really* work, since there are too many checks
89
+	#    that fail in an emulated environment!  We'll have to do it by
90
+	#    hand below anyway...
91
+	export FK_MACHINE="TI AM335x BeagleBone"
92
+	apt-get install -y flash-kernel
93 93
 }
94 94
 
95 95
 beaglebone_repack_kernel() {
@@ -105,50 +105,99 @@ beaglebone_repack_kernel() {
105 105
 # on the kernel command line is completely ignored!  repack the initrd
106 106
 # to remove this evil...
107 107
 
108
-    echo "info: repacking beaglebone kernel and initrd"
108
+	echo "info: repacking beaglebone kernel and initrd"
109 109
 
110
-    kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
111
-    version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
112
-    initRd=initrd.img-$version
113
-    vmlinuz=vmlinuz-$version
110
+	kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
111
+	version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
112
+	initRd=initrd.img-$version
113
+	vmlinuz=vmlinuz-$version
114 114
 
115
-    mkdir /tmp/initrd-repack
115
+	mkdir /tmp/initrd-repack
116 116
 
117
-    (cd /tmp/initrd-repack ; \
118
-    zcat /boot/$initRd | cpio -i ; \
119
-    rm -f conf/param.conf ; \
120
-    find . | cpio --quiet -o -H newc | \
121
-    gzip -9 > /boot/$initRd )
117
+	(cd /tmp/initrd-repack ; \
118
+	zcat /boot/$initRd | cpio -i ; \
119
+	rm -f conf/param.conf ; \
120
+	find . | cpio --quiet -o -H newc | \
121
+	gzip -9 > /boot/$initRd )
122 122
 
123
-    rm -rf /tmp/initrd-repack
123
+	rm -rf /tmp/initrd-repack
124 124
 
125
-    (cd /boot ; \
126
-    cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \
127
-    cat $vmlinuz dtb >> temp-kernel ; \
128
-    mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \
129
-    -C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \
130
-    rm -f temp-kernel ; \
131
-    mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \
132
-    -n "Debian ramdisk ${version}" \
133
-    -d $initRd uInitrd )
125
+	(cd /boot ; \
126
+	cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \
127
+	cat $vmlinuz dtb >> temp-kernel ; \
128
+	mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \
129
+	-C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \
130
+	rm -f temp-kernel ; \
131
+	mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \
132
+	-n "Debian ramdisk ${version}" \
133
+	-d $initRd uInitrd )
134
+}
135
+
136
+odroidc2_setup_boot() {
137
+	dtb="$1"
138
+
139
+	# Setup uEnv.txt
140
+	if grep -q btrfs /etc/fstab ; then
141
+		fstype=btrfs
142
+	else
143
+		fstype=ext4
144
+	fi
145
+	kernelVersion=$(ls /usr/lib/*/${dtb}.dtb | head -1 | cut -d/ -f4)
146
+	version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
147
+	initRd=initrd.img-$version
148
+	vmlinuz=vmlinuz-$version
149
+
150
+	# based on http://odroid.com/dokuwiki/doku.php?id=en:c2_building_u-boot
151
+	cat >> /boot/uEnv.txt <<EOF
152
+mmcroot=/dev/mmcblk0p2 ro
153
+mmcrootfstype=$fstype rootwait fixrtc
154
+mmcrootflags=subvol=@
155
+
156
+console=ttyO0,115200n8
157
+
158
+kernel_file=$vmlinuz
159
+initrd_file=$initRd
160
+
161
+loadaddr=0x11000000
162
+initrd_addr=0x13000000
163
+fdtaddr=0x1000000
164
+
165
+initrd_high=0xffffffff
166
+fdt_high=0xffffffff
167
+
168
+loadkernel=load mmc \${mmcdev}:\${mmcpart} \${loadaddr} \${kernel_file}
169
+loadinitrd=load mmc \${mmcdev}:\${mmcpart} \${initrd_addr} \${initrd_file}; setenv initrd_size \${filesize}
170
+loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
171
+
172
+m="1080p60hz"
173
+m_bpp="32"
174
+
175
+loadfiles=run loadkernel; run loadinitrd; run loadfdt
176
+mmcargs=setenv bootargs rootwait rw console=tty0 console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} fsck.fix=yes
177
+
178
+uenvcmd=run loadfiles; run mmcargs; booti \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
179
+EOF
180
+
181
+	mkdir -p /boot/dtbs
182
+	cp /usr/lib/linux-image-*-armmp/* /boot/dtbs
134 183
 }
135 184
 
136 185
 a20_setup_boot() {
137
-    dtb="$1"
138
-
139
-    # Setup boot.cmd
140
-    if grep -q btrfs /etc/fstab ; then
141
-    fstype=btrfs
142
-    else
143
-    fstype=ext4
144
-    fi
145
-    kernelVersion=$(ls /usr/lib/*/$dtb | head -1 | cut -d/ -f4)
146
-    version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
147
-    initRd=initrd.img-$version
148
-    vmlinuz=vmlinuz-$version
149
-
150
-    # Create boot.cmd
151
-    cat >> /boot/boot.cmd <<EOF
186
+	dtb="$1"
187
+
188
+	# Setup boot.cmd
189
+	if grep -q btrfs /etc/fstab ; then
190
+	fstype=btrfs
191
+	else
192
+	fstype=ext4
193
+	fi
194
+	kernelVersion=$(ls /usr/lib/*/$dtb | head -1 | cut -d/ -f4)
195
+	version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
196
+	initRd=initrd.img-$version
197
+	vmlinuz=vmlinuz-$version
198
+
199
+	# Create boot.cmd
200
+	cat >> /boot/boot.cmd <<EOF
152 201
 setenv mmcdev 0
153 202
 setenv mmcpart 1
154 203
 
@@ -179,42 +228,46 @@ setenv mmcargs setenv bootargs console=\${console} root=\${mmcroot} rootfstype=\
179 228
 run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
180 229
 EOF
181 230
 
182
-    # boot.scr for Allwinner A20 based device
183
-    mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
231
+	# boot.scr for Allwinner A20 based device
232
+	mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
184 233
 
185
-    # Copy all DTBs
186
-    mkdir -p /boot/dtbs
187
-    cp /usr/lib/$kernelVersion/* /boot/dtbs
234
+	# Copy all DTBs
235
+	mkdir -p /boot/dtbs
236
+	cp /usr/lib/$kernelVersion/* /boot/dtbs
188 237
 
189
-    # extra boot modules
190
-    echo "rtc_sunxi" >> /etc/initramfs-tools/modules
238
+	# extra boot modules
239
+	echo "rtc_sunxi" >> /etc/initramfs-tools/modules
191 240
 }
192 241
 
193 242
 case "$MACHINE" in
194
-    beaglebone)
195
-    beaglebone_setup_boot
196
-    beaglebone_flash
197
-    beaglebone_repack_kernel
198
-    enable_serial_console ttyO0
199
-    ;;
200
-    cubietruck)
201
-    a20_setup_boot sun7i-a20-cubietruck.dtb
202
-    enable_serial_console ttyS0
203
-    ;;
204
-    a20-olinuxino-lime)
205
-    a20_setup_boot sun7i-a20-olinuxino-lime.dtb
206
-    enable_serial_console ttyS0
207
-    ;;
208
-    a20-olinuxino-lime2)
209
-    a20_setup_boot sun7i-a20-olinuxino-lime2.dtb
210
-    enable_serial_console ttyS0
211
-    ;;
212
-    a20-olinuxino-micro)
213
-    a20_setup_boot sun7i-a20-olinuxino-micro.dtb
214
-    enable_serial_console ttyS0
215
-    ;;
216
-    cubieboard2)
217
-    a20_setup_boot sun7i-a20-cubieboard2.dtb
218
-    enable_serial_console ttyS0
219
-    ;;
243
+	beaglebone)
244
+	beaglebone_setup_boot
245
+	beaglebone_flash
246
+	beaglebone_repack_kernel
247
+	enable_serial_console ttyO0
248
+	;;
249
+	odroid-c2)
250
+	odroidc2_setup_boot meson64_odroidc2
251
+	enable_serial_console ttyO0
252
+	;;
253
+	cubietruck)
254
+	a20_setup_boot sun7i-a20-cubietruck.dtb
255
+	enable_serial_console ttyS0
256
+	;;
257
+	a20-olinuxino-lime)
258
+	a20_setup_boot sun7i-a20-olinuxino-lime.dtb
259
+	enable_serial_console ttyS0
260
+	;;
261
+	a20-olinuxino-lime2)
262
+	a20_setup_boot sun7i-a20-olinuxino-lime2.dtb
263
+	enable_serial_console ttyS0
264
+	;;
265
+	a20-olinuxino-micro)
266
+	a20_setup_boot sun7i-a20-olinuxino-micro.dtb
267
+	enable_serial_console ttyS0
268
+	;;
269
+	cubieboard2)
270
+	a20_setup_boot sun7i-a20-cubieboard2.dtb
271
+	enable_serial_console ttyS0
272
+	;;
220 273
 esac

+ 16
- 0
src/freedombone-image-make Voir le fichier

@@ -83,6 +83,9 @@ logrotate module-init-tools netbase rsyslog udev debian-archive-keyring"
83 83
 # Packages needed on the beaglebone
84 84
 beaglebone_pkgs="linux-image-armmp u-boot-tools u-boot"
85 85
 
86
+# Packages needed on the Odroid C2 devices:
87
+odroidc2_pkgs="linux-image-armmp-lpae u-boot-tools u-boot"
88
+
86 89
 # Packages needed on the Allwinner A20 devices:
87 90
 a20_pkgs="linux-image-armmp-lpae u-boot-tools u-boot u-boot-sunxi"
88 91
 
@@ -105,6 +108,19 @@ case "$MACHINE" in
105 108
  --roottype btrfs \
106 109
 "
107 110
 		;;
111
+    odroid-c2)
112
+		extra_pkgs="$odroidc2_pkgs"
113
+		extra_opts="\
114
+ --variant minbase \
115
+ --bootoffset=2mib \
116
+ --bootsize 128M \
117
+ --boottype ext2 \
118
+ --no-kernel \
119
+ --no-extlinux \
120
+ --foreign /usr/bin/qemu-arm-static \
121
+ --roottype btrfs \
122
+"
123
+		;;
108 124
     cubietruck | a20-olinuxino-lime | a20-olinuxino-lime2 | a20-olinuxino-micro | cubieboard2)
109 125
 		extra_pkgs="$a20_pkgs"
110 126
 		extra_opts="\

+ 11
- 0
src/freedombone-image-makefile Voir le fichier

@@ -89,6 +89,17 @@ beaglebone: prep
89 89
 	$(SIGN)
90 90
 	@echo "Build complete."
91 91
 
92
+# build Odroid C2 SD card image
93
+odroid-c2: prep
94
+	$(eval ARCHITECTURE = aarch64)
95
+	$(eval MACHINE = odroid-c2)
96
+	$(MAKE_IMAGE)
97
+	@rm -f $(ARCHIVE)
98
+	$(XZ) $(IMAGE)
99
+	@echo ""
100
+	$(SIGN)
101
+	@echo "Build complete."
102
+
92 103
 # build Cubieboard2 SD card image
93 104
 cubieboard2: prep
94 105
 	$(eval ARCHITECTURE = armhf)