Beginning of support for odroid c2
This commit is contained in:
parent
7cbb3242bf
commit
33e6f2c2be
|
@ -51,7 +51,7 @@ To build a 64bit Qemu image:
|
||||||
|
|
||||||
freedombone-image -t qemu-x86_64 -s 8G
|
freedombone-image -t qemu-x86_64 -s 8G
|
||||||
|
|
||||||
Other supported boards are cubieboard2, cubietruck, olinuxino-lime, olinuxino-lime2 and olinuxino-micro.
|
Other supported boards are cubieboard2, cubietruck, olinuxino-lime, olinuxino-lime2, olinuxino-micro and odroid-c2.
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -32,27 +32,27 @@ export TEXTDOMAIN=${PROJECT_NAME}-image-hardware-setup
|
||||||
export TEXTDOMAINDIR="/usr/share/locale"
|
export TEXTDOMAINDIR="/usr/share/locale"
|
||||||
|
|
||||||
enable_serial_console() {
|
enable_serial_console() {
|
||||||
# By default, spawn a console on the serial port
|
# By default, spawn a console on the serial port
|
||||||
device="$1"
|
device="$1"
|
||||||
echo $"Adding a getty on the serial port"
|
echo $"Adding a getty on the serial port"
|
||||||
echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab
|
echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab
|
||||||
}
|
}
|
||||||
|
|
||||||
beaglebone_setup_boot() {
|
beaglebone_setup_boot() {
|
||||||
# Setup uEnv.txt
|
# Setup uEnv.txt
|
||||||
if grep -q btrfs /etc/fstab ; then
|
if grep -q btrfs /etc/fstab ; then
|
||||||
fstype=btrfs
|
fstype=btrfs
|
||||||
else
|
else
|
||||||
fstype=ext4
|
fstype=ext4
|
||||||
fi
|
fi
|
||||||
kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
|
kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
|
||||||
version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
|
version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
|
||||||
initRd=initrd.img-$version
|
initRd=initrd.img-$version
|
||||||
vmlinuz=vmlinuz-$version
|
vmlinuz=vmlinuz-$version
|
||||||
|
|
||||||
# uEnv.txt for Beaglebone
|
# uEnv.txt for Beaglebone
|
||||||
# based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
|
# based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
|
||||||
cat >> /boot/uEnv.txt <<EOF
|
cat >> /boot/uEnv.txt <<EOF
|
||||||
mmcroot=/dev/mmcblk0p2 ro
|
mmcroot=/dev/mmcblk0p2 ro
|
||||||
mmcrootfstype=$fstype rootwait fixrtc
|
mmcrootfstype=$fstype rootwait fixrtc
|
||||||
mmcrootflags=subvol=@
|
mmcrootflags=subvol=@
|
||||||
|
@ -79,17 +79,17 @@ mmcargs=setenv bootargs console=tty0 console=\${console} root=\${mmcroot} rootfs
|
||||||
uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
|
uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p /boot/dtbs
|
mkdir -p /boot/dtbs
|
||||||
cp /usr/lib/linux-image-*-armmp/* /boot/dtbs
|
cp /usr/lib/linux-image-*-armmp/* /boot/dtbs
|
||||||
}
|
}
|
||||||
|
|
||||||
beaglebone_flash() {
|
beaglebone_flash() {
|
||||||
# allow flash-kernel to work without valid /proc contents
|
# allow flash-kernel to work without valid /proc contents
|
||||||
# ** this doesn't *really* work, since there are too many checks
|
# ** this doesn't *really* work, since there are too many checks
|
||||||
# that fail in an emulated environment! We'll have to do it by
|
# that fail in an emulated environment! We'll have to do it by
|
||||||
# hand below anyway...
|
# hand below anyway...
|
||||||
export FK_MACHINE="TI AM335x BeagleBone"
|
export FK_MACHINE="TI AM335x BeagleBone"
|
||||||
apt-get install -y flash-kernel
|
apt-get install -y flash-kernel
|
||||||
}
|
}
|
||||||
|
|
||||||
beaglebone_repack_kernel() {
|
beaglebone_repack_kernel() {
|
||||||
|
@ -105,50 +105,99 @@ beaglebone_repack_kernel() {
|
||||||
# on the kernel command line is completely ignored! repack the initrd
|
# on the kernel command line is completely ignored! repack the initrd
|
||||||
# to remove this evil...
|
# to remove this evil...
|
||||||
|
|
||||||
echo "info: repacking beaglebone kernel and initrd"
|
echo "info: repacking beaglebone kernel and initrd"
|
||||||
|
|
||||||
kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
|
kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
|
||||||
version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
|
version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
|
||||||
initRd=initrd.img-$version
|
initRd=initrd.img-$version
|
||||||
vmlinuz=vmlinuz-$version
|
vmlinuz=vmlinuz-$version
|
||||||
|
|
||||||
mkdir /tmp/initrd-repack
|
mkdir /tmp/initrd-repack
|
||||||
|
|
||||||
(cd /tmp/initrd-repack ; \
|
(cd /tmp/initrd-repack ; \
|
||||||
zcat /boot/$initRd | cpio -i ; \
|
zcat /boot/$initRd | cpio -i ; \
|
||||||
rm -f conf/param.conf ; \
|
rm -f conf/param.conf ; \
|
||||||
find . | cpio --quiet -o -H newc | \
|
find . | cpio --quiet -o -H newc | \
|
||||||
gzip -9 > /boot/$initRd )
|
gzip -9 > /boot/$initRd )
|
||||||
|
|
||||||
rm -rf /tmp/initrd-repack
|
rm -rf /tmp/initrd-repack
|
||||||
|
|
||||||
(cd /boot ; \
|
(cd /boot ; \
|
||||||
cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \
|
cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \
|
||||||
cat $vmlinuz dtb >> temp-kernel ; \
|
cat $vmlinuz dtb >> temp-kernel ; \
|
||||||
mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \
|
mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \
|
||||||
-C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \
|
-C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \
|
||||||
rm -f temp-kernel ; \
|
rm -f temp-kernel ; \
|
||||||
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \
|
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \
|
||||||
-n "Debian ramdisk ${version}" \
|
-n "Debian ramdisk ${version}" \
|
||||||
-d $initRd uInitrd )
|
-d $initRd uInitrd )
|
||||||
|
}
|
||||||
|
|
||||||
|
odroidc2_setup_boot() {
|
||||||
|
dtb="$1"
|
||||||
|
|
||||||
|
# Setup uEnv.txt
|
||||||
|
if grep -q btrfs /etc/fstab ; then
|
||||||
|
fstype=btrfs
|
||||||
|
else
|
||||||
|
fstype=ext4
|
||||||
|
fi
|
||||||
|
kernelVersion=$(ls /usr/lib/*/${dtb}.dtb | head -1 | cut -d/ -f4)
|
||||||
|
version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
|
||||||
|
initRd=initrd.img-$version
|
||||||
|
vmlinuz=vmlinuz-$version
|
||||||
|
|
||||||
|
# based on http://odroid.com/dokuwiki/doku.php?id=en:c2_building_u-boot
|
||||||
|
cat >> /boot/uEnv.txt <<EOF
|
||||||
|
mmcroot=/dev/mmcblk0p2 ro
|
||||||
|
mmcrootfstype=$fstype rootwait fixrtc
|
||||||
|
mmcrootflags=subvol=@
|
||||||
|
|
||||||
|
console=ttyO0,115200n8
|
||||||
|
|
||||||
|
kernel_file=$vmlinuz
|
||||||
|
initrd_file=$initRd
|
||||||
|
|
||||||
|
loadaddr=0x11000000
|
||||||
|
initrd_addr=0x13000000
|
||||||
|
fdtaddr=0x1000000
|
||||||
|
|
||||||
|
initrd_high=0xffffffff
|
||||||
|
fdt_high=0xffffffff
|
||||||
|
|
||||||
|
loadkernel=load mmc \${mmcdev}:\${mmcpart} \${loadaddr} \${kernel_file}
|
||||||
|
loadinitrd=load mmc \${mmcdev}:\${mmcpart} \${initrd_addr} \${initrd_file}; setenv initrd_size \${filesize}
|
||||||
|
loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
|
||||||
|
|
||||||
|
m="1080p60hz"
|
||||||
|
m_bpp="32"
|
||||||
|
|
||||||
|
loadfiles=run loadkernel; run loadinitrd; run loadfdt
|
||||||
|
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
|
||||||
|
|
||||||
|
uenvcmd=run loadfiles; run mmcargs; booti \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mkdir -p /boot/dtbs
|
||||||
|
cp /usr/lib/linux-image-*-armmp/* /boot/dtbs
|
||||||
}
|
}
|
||||||
|
|
||||||
a20_setup_boot() {
|
a20_setup_boot() {
|
||||||
dtb="$1"
|
dtb="$1"
|
||||||
|
|
||||||
# Setup boot.cmd
|
# Setup boot.cmd
|
||||||
if grep -q btrfs /etc/fstab ; then
|
if grep -q btrfs /etc/fstab ; then
|
||||||
fstype=btrfs
|
fstype=btrfs
|
||||||
else
|
else
|
||||||
fstype=ext4
|
fstype=ext4
|
||||||
fi
|
fi
|
||||||
kernelVersion=$(ls /usr/lib/*/$dtb | head -1 | cut -d/ -f4)
|
kernelVersion=$(ls /usr/lib/*/$dtb | head -1 | cut -d/ -f4)
|
||||||
version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
|
version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
|
||||||
initRd=initrd.img-$version
|
initRd=initrd.img-$version
|
||||||
vmlinuz=vmlinuz-$version
|
vmlinuz=vmlinuz-$version
|
||||||
|
|
||||||
# Create boot.cmd
|
# Create boot.cmd
|
||||||
cat >> /boot/boot.cmd <<EOF
|
cat >> /boot/boot.cmd <<EOF
|
||||||
setenv mmcdev 0
|
setenv mmcdev 0
|
||||||
setenv mmcpart 1
|
setenv mmcpart 1
|
||||||
|
|
||||||
|
@ -179,42 +228,46 @@ setenv mmcargs setenv bootargs console=\${console} root=\${mmcroot} rootfstype=\
|
||||||
run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
|
run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# boot.scr for Allwinner A20 based device
|
# boot.scr for Allwinner A20 based device
|
||||||
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
|
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
|
||||||
|
|
||||||
# Copy all DTBs
|
# Copy all DTBs
|
||||||
mkdir -p /boot/dtbs
|
mkdir -p /boot/dtbs
|
||||||
cp /usr/lib/$kernelVersion/* /boot/dtbs
|
cp /usr/lib/$kernelVersion/* /boot/dtbs
|
||||||
|
|
||||||
# extra boot modules
|
# extra boot modules
|
||||||
echo "rtc_sunxi" >> /etc/initramfs-tools/modules
|
echo "rtc_sunxi" >> /etc/initramfs-tools/modules
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$MACHINE" in
|
case "$MACHINE" in
|
||||||
beaglebone)
|
beaglebone)
|
||||||
beaglebone_setup_boot
|
beaglebone_setup_boot
|
||||||
beaglebone_flash
|
beaglebone_flash
|
||||||
beaglebone_repack_kernel
|
beaglebone_repack_kernel
|
||||||
enable_serial_console ttyO0
|
enable_serial_console ttyO0
|
||||||
;;
|
;;
|
||||||
cubietruck)
|
odroid-c2)
|
||||||
a20_setup_boot sun7i-a20-cubietruck.dtb
|
odroidc2_setup_boot meson64_odroidc2
|
||||||
enable_serial_console ttyS0
|
enable_serial_console ttyO0
|
||||||
;;
|
;;
|
||||||
a20-olinuxino-lime)
|
cubietruck)
|
||||||
a20_setup_boot sun7i-a20-olinuxino-lime.dtb
|
a20_setup_boot sun7i-a20-cubietruck.dtb
|
||||||
enable_serial_console ttyS0
|
enable_serial_console ttyS0
|
||||||
;;
|
;;
|
||||||
a20-olinuxino-lime2)
|
a20-olinuxino-lime)
|
||||||
a20_setup_boot sun7i-a20-olinuxino-lime2.dtb
|
a20_setup_boot sun7i-a20-olinuxino-lime.dtb
|
||||||
enable_serial_console ttyS0
|
enable_serial_console ttyS0
|
||||||
;;
|
;;
|
||||||
a20-olinuxino-micro)
|
a20-olinuxino-lime2)
|
||||||
a20_setup_boot sun7i-a20-olinuxino-micro.dtb
|
a20_setup_boot sun7i-a20-olinuxino-lime2.dtb
|
||||||
enable_serial_console ttyS0
|
enable_serial_console ttyS0
|
||||||
;;
|
;;
|
||||||
cubieboard2)
|
a20-olinuxino-micro)
|
||||||
a20_setup_boot sun7i-a20-cubieboard2.dtb
|
a20_setup_boot sun7i-a20-olinuxino-micro.dtb
|
||||||
enable_serial_console ttyS0
|
enable_serial_console ttyS0
|
||||||
;;
|
;;
|
||||||
|
cubieboard2)
|
||||||
|
a20_setup_boot sun7i-a20-cubieboard2.dtb
|
||||||
|
enable_serial_console ttyS0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -83,6 +83,9 @@ logrotate module-init-tools netbase rsyslog udev debian-archive-keyring"
|
||||||
# Packages needed on the beaglebone
|
# Packages needed on the beaglebone
|
||||||
beaglebone_pkgs="linux-image-armmp u-boot-tools u-boot"
|
beaglebone_pkgs="linux-image-armmp u-boot-tools u-boot"
|
||||||
|
|
||||||
|
# Packages needed on the Odroid C2 devices:
|
||||||
|
odroidc2_pkgs="linux-image-armmp-lpae u-boot-tools u-boot"
|
||||||
|
|
||||||
# Packages needed on the Allwinner A20 devices:
|
# Packages needed on the Allwinner A20 devices:
|
||||||
a20_pkgs="linux-image-armmp-lpae u-boot-tools u-boot u-boot-sunxi"
|
a20_pkgs="linux-image-armmp-lpae u-boot-tools u-boot u-boot-sunxi"
|
||||||
|
|
||||||
|
@ -103,6 +106,19 @@ case "$MACHINE" in
|
||||||
--no-extlinux \
|
--no-extlinux \
|
||||||
--foreign /usr/bin/qemu-arm-static \
|
--foreign /usr/bin/qemu-arm-static \
|
||||||
--roottype btrfs \
|
--roottype btrfs \
|
||||||
|
"
|
||||||
|
;;
|
||||||
|
odroid-c2)
|
||||||
|
extra_pkgs="$odroidc2_pkgs"
|
||||||
|
extra_opts="\
|
||||||
|
--variant minbase \
|
||||||
|
--bootoffset=2mib \
|
||||||
|
--bootsize 128M \
|
||||||
|
--boottype ext2 \
|
||||||
|
--no-kernel \
|
||||||
|
--no-extlinux \
|
||||||
|
--foreign /usr/bin/qemu-arm-static \
|
||||||
|
--roottype btrfs \
|
||||||
"
|
"
|
||||||
;;
|
;;
|
||||||
cubietruck | a20-olinuxino-lime | a20-olinuxino-lime2 | a20-olinuxino-micro | cubieboard2)
|
cubietruck | a20-olinuxino-lime | a20-olinuxino-lime2 | a20-olinuxino-micro | cubieboard2)
|
||||||
|
|
|
@ -89,6 +89,17 @@ beaglebone: prep
|
||||||
$(SIGN)
|
$(SIGN)
|
||||||
@echo "Build complete."
|
@echo "Build complete."
|
||||||
|
|
||||||
|
# build Odroid C2 SD card image
|
||||||
|
odroid-c2: prep
|
||||||
|
$(eval ARCHITECTURE = aarch64)
|
||||||
|
$(eval MACHINE = odroid-c2)
|
||||||
|
$(MAKE_IMAGE)
|
||||||
|
@rm -f $(ARCHIVE)
|
||||||
|
$(XZ) $(IMAGE)
|
||||||
|
@echo ""
|
||||||
|
$(SIGN)
|
||||||
|
@echo "Build complete."
|
||||||
|
|
||||||
# build Cubieboard2 SD card image
|
# build Cubieboard2 SD card image
|
||||||
cubieboard2: prep
|
cubieboard2: prep
|
||||||
$(eval ARCHITECTURE = armhf)
|
$(eval ARCHITECTURE = armhf)
|
||||||
|
|
Loading…
Reference in New Issue