Implement package for flashdrive image

This commit is contained in:
George Hilliard 2019-09-04 00:21:38 -05:00
parent f3eb862f5f
commit 967723d900
13 changed files with 119 additions and 24 deletions

View file

@ -1,5 +1,6 @@
source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/sunxi-tools-f1c100s/Config.in.host"
source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/sunxi-tools-f1c100s/Config.in"
source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/businesscard-flashdrive/Config.in"
source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/2048/Config.in"
source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/fortune-mod/Config.in"
source "$BR2_EXTERNAL_BUSINESSCARD_PATH/package/robotfindskitten/Config.in"

View file

@ -20,28 +20,6 @@ image flash.bin {
}
}
image flashdrive.vfat {
vfat {
files = {
"George Hilliard resume.pdf",
"README.txt"
}
}
size = 64K
}
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 = 65K
}
image persist.ubifs {
ubifs {
extraargs = "--compr=zlib --jrn-size=192KiB --log-lebs=2"

View file

@ -59,11 +59,10 @@ BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"
BR2_TARGET_UBOOT_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_BUSINESSCARD_PATH)/board/businesscard/v1/dts/*"
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MKPASSWD=y
BR2_PACKAGE_HOST_MTD=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_SUNXI_TOOLS_F1C100S=y
BR2_PACKAGE_BUSINESSCARD_FLASHDRIVE=y
BR2_PACKAGE_2048=y
BR2_PACKAGE_FORTUNE_MOD=y
BR2_PACKAGE_FORTUNE_MOD_COOKIES="computers;humorists;linuxcookie;literature;pratchett;startrek;wisdom"

View file

@ -0,0 +1,11 @@
config BR2_PACKAGE_BUSINESSCARD_FLASHDRIVE
bool "businesscard-flashdrive"
select BR2_PACKAGE_HOST_GENIMAGE
select BR2_PACKAGE_HOST_DOSFSTOOLS
select BR2_PACKAGE_HOST_MTOOLS
help
The "flash drive" image that appears when you plug my business card into
a PC.
https://github.com/thirtythreeforty

View file

@ -0,0 +1,33 @@
################################################################################
#
# businesscard-flashdrive
#
################################################################################
BUSINESSCARD_FLASHDRIVE_SITE = $(BUSINESSCARD_FLASHDRIVE_PKGDIR)files
BUSINESSCARD_FLASHDRIVE_SITE_METHOD = local
BUSINESSCARD_FLASHDRIVE_LICENSE = Proprietary
BUSINESSCARD_FLASHDRIVE_DEPENDENCIES = host-genimage host-dosfstools host-mtools
BUSINESSCARD_INSTALL_IMAGES = YES
BUSINESSCARD_INSTALL_TARGET = NO
define BUSINESSCARD_FLASHDRIVE_BUILD_CMDS
rm -rf "$(@D)/tmp"
mkdir -p $(@D)/dummyroot
$(HOST_DIR)/bin/genimage \
--config $(@D)/genimage.cfg \
--inputpath $(@D) \
--outputpath $(@D) \
--tmppath $(@D)/tmp \
--rootpath $(@D)/dummyroot \
--mcopy $(HOST_DIR)/bin/mcopy \
--mkdosfs $(HOST_DIR)/sbin/mkdosfs
endef
define BUSINESSCARD_FLASHDRIVE_INSTALL_TARGET_CMDS
mkdir -p $(BINARIES_DIR)
cp $(@D)/flashdrive.img $(BINARIES_DIR)/flashdrive.img
endef
$(eval $(generic-package))

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

View file

@ -0,0 +1,55 @@
ABOUT ME
I am an embedded systems engineer. My specialty is designing software and
hardware for small microcontrollers and especially small Linux devices like this
business card. I do this both professionally and as a hobby. I am also fluent
in several computer languages, and comfortable working on any level of the
stack, from low-level drivers to cleanly-designed backend servers to smooth,
fluid Android apps.
I'm also a decent amateur photographer, vehicle mechanic, and cook.
If you'd like to work with me on business or a cool project, please don't
hesitate to reach out. (You have my card!)
ABOUT THIS CARD
This is a small Linux computer running a custom-built Linux distribution. It
has a $1.40 system-on-a-chip with 32MB RAM and 8MB storage; everything runs in
this very constrained environment. It is configured to appear as a "USB
gadget" -- a complete Linux device playing the role of a peripheral.
In this case, the card emulates a very small flash drive. This readme is on
the flash drive alongside my resume and some of my photography (unfortunately
not many photos will fit in the remaining space, but it is enough for a sample).
The card also emulates a serial port. You can use this to log into the card's
Linux shell and run programs -- it is a complete computer. On Windows, you can
use PuTTY or similar to connect to the COM port (you may need to open Device
Manager to discover which COM port number it has been assigned). On Linux, you
can use screen. Try this example command:
sudo screen /dev/ttyUSB0
You should get a "Welcome" message and a login prompt once you connect (if not,
press Enter a few times). The username is "root" and there is no password.
The card's functionality is limited by the "business card" form factor, so I
have mainly provided some amusements, as follows. Type any of the commands to
start them:
micropython - a complete implementation of Python 3.4
rogue - the original dungeon-crawling game (type Ctrl-C to quit)
fortune - random, hopefully interesting, quips from a bunch of sources
2048 - the simple puzzle game
The usual POSIX utilities such as vi and grep are present too. And finally,
there is a very small writable partition that will allow you to save your
progress in rogue, or write small Python programs.
This operating system is based on the Buildroot distribution, which I ported to
the hardware which I designed. All the parts for the card cost me about $3.
You can get the source code at github.com/thirtythreeforty/businesscard-linux.
Enjoy!
-- George Hilliard

View file

@ -0,0 +1,18 @@
image flashdrive.vfat {
vfat {
files = {
"Photography",
"George Hilliard resume.pdf",
"README.txt"
}
}
size = 1728K
}
image flashdrive.img {
hdimage {}
partition businesscard {
partition-type = 0xc
image = "flashdrive.vfat"
}
}