Implement USB "flash drive" gadget
This commit is contained in:
parent
25609ac32c
commit
0033ca1c38
5 changed files with 47 additions and 1 deletions
15
board/businesscard/rootfs_overlay/etc/init.d/S99flashdrive
Executable file
15
board/businesscard/rootfs_overlay/etc/init.d/S99flashdrive
Executable file
|
@ -0,0 +1,15 @@
|
|||
#! /bin/sh
|
||||
|
||||
case "$1" in
|
||||
start|"")
|
||||
echo 1 > /sys/class/udc/musb-hdrc.1.auto/device/gadget/lun0/ro
|
||||
echo /dev/ubiblock0_3 > /sys/class/udc/musb-hdrc.1.auto/device/gadget/lun0/file
|
||||
;;
|
||||
stop)
|
||||
echo '' > /sys/class/udc/musb-hdrc.1.auto/device/gadget/lun0/file
|
||||
;;
|
||||
*)
|
||||
echo "Usage: flashdrive {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -20,6 +20,28 @@ image flash.bin {
|
|||
}
|
||||
}
|
||||
|
||||
image flashdrive.vfat {
|
||||
vfat {
|
||||
files = {
|
||||
"George Hilliard resume.pdf",
|
||||
"README.txt"
|
||||
}
|
||||
}
|
||||
size = 96K
|
||||
}
|
||||
|
||||
image flashdrive.img {
|
||||
hdimage {}
|
||||
partition businesscard {
|
||||
partition-type = 0xc
|
||||
image = "flashdrive.vfat"
|
||||
}
|
||||
// Hardcode a size here to help the ubi builder, which cannot infer a size
|
||||
// of this image or wait until this image is built, due to the design of
|
||||
// genimage.
|
||||
size = 97K
|
||||
}
|
||||
|
||||
image root.ubi {
|
||||
ubi {}
|
||||
partition kernel {
|
||||
|
@ -34,6 +56,10 @@ image root.ubi {
|
|||
image = "rootfs.squashfs"
|
||||
read-only = true
|
||||
}
|
||||
partition flashdrive {
|
||||
image = flashdrive.img
|
||||
read-only = true
|
||||
}
|
||||
}
|
||||
|
||||
image boot.vfat {
|
||||
|
|
3
board/businesscard/v1/post-build.sh
Executable file
3
board/businesscard/v1/post-build.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
grep -q "GADGET_SERIAL" "${TARGET_DIR}/etc/inittab" \
|
||||
|| echo '/dev/ttyGS0::respawn:/sbin/getty -L /dev/ttyGS0 0 vt100 # GADGET_SERIAL' >> "${TARGET_DIR}/etc/inittab"
|
|
@ -10,7 +10,7 @@ CONFIG_DRAM_ZQ=0
|
|||
CONFIG_SPL_SPI_SUNXI=y
|
||||
# CONFIG_FIT is not set
|
||||
CONFIG_BOOTDELAY=0
|
||||
CONFIG_BOOTCOMMAND="setenv bootargs console=ttyS0,115200 ubi.mtd=1 ubi.block=0,root root=/dev/ubiblock0_2; sf probe 0 20000000; ubi part rootubi; ubi read ${kernel_addr_r} kernel; ubi read ${fdt_addr_r} dtb; bootz ${kernel_addr_r} - ${fdt_addr_r}"
|
||||
CONFIG_BOOTCOMMAND="setenv bootargs console=ttyS0,115200 ubi.mtd=1 ubi.block=0,root ubi.block=0,flashdrive root=/dev/ubiblock0_2 g_acm_ms.removable=1; sf probe 0 20000000; ubi part rootubi; ubi read ${kernel_addr_r} kernel; ubi read ${fdt_addr_r} dtb; bootz ${kernel_addr_r} - ${fdt_addr_r}"
|
||||
CONFIG_LOG_MAX_LEVEL=6
|
||||
CONFIG_LOG_ERROR_RETURN=y
|
||||
# CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
|
||||
|
|
|
@ -12,6 +12,8 @@ BR2_TARGET_GENERIC_ISSUE="Welcome to Businesscard Linux!"
|
|||
BR2_TARGET_GENERIC_GETTY_PORT="/dev/ttyS0"
|
||||
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
|
||||
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
|
||||
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_BUSINESSCARD_PATH)/board/businesscard/rootfs_overlay"
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_BUSINESSCARD_PATH)/board/businesscard/v1/post-build.sh"
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BR2_EXTERNAL_BUSINESSCARD_PATH)/board/businesscard/v1/genimage.cfg"
|
||||
BR2_LINUX_KERNEL=y
|
||||
|
|
Loading…
Reference in a new issue