mirror of
https://github.com/FunKey-Project/FunKey-OS.git
synced 2026-03-19 10:22:46 +01:00
Make buildroot a git submodule
This commit is contained in:
4
FunKey/board/funkey/boot.cmd
Normal file
4
FunKey/board/funkey/boot.cmd
Normal file
@@ -0,0 +1,4 @@
|
||||
setenv bootargs console=ttyS0,115200 panic=5 console=tty0 rootwait fbcon=map:10 fbcon=font:VGA8x8 root=/dev/mmcblk0p2 earlyprintk rw
|
||||
load mmc 0:1 0x41000000 zImage
|
||||
load mmc 0:1 0x41800000 sun8i-v3s-funkey.dtb
|
||||
bootz 0x41000000 - 0x41800000
|
||||
1131
FunKey/board/funkey/busybox.config
Normal file
1131
FunKey/board/funkey/busybox.config
Normal file
File diff suppressed because it is too large
Load Diff
0
FunKey/board/funkey/device_table.txt
Normal file
0
FunKey/board/funkey/device_table.txt
Normal file
34
FunKey/board/funkey/genimage.cfg
Normal file
34
FunKey/board/funkey/genimage.cfg
Normal file
@@ -0,0 +1,34 @@
|
||||
image boot.vfat {
|
||||
vfat {
|
||||
files = {
|
||||
"zImage",
|
||||
"sun8i-v3s-funkey.dtb",
|
||||
"boot.scr"
|
||||
}
|
||||
}
|
||||
size = 8M
|
||||
}
|
||||
|
||||
image sdcard.img {
|
||||
hdimage {
|
||||
}
|
||||
|
||||
partition u-boot {
|
||||
in-partition-table = "no"
|
||||
image = "u-boot-sunxi-with-spl.bin"
|
||||
offset = 8192
|
||||
size = 516096 # 512KB - 8192
|
||||
}
|
||||
|
||||
partition boot {
|
||||
partition-type = 0xC
|
||||
bootable = "true"
|
||||
image = "boot.vfat"
|
||||
}
|
||||
|
||||
partition rootfs {
|
||||
partition-type = 0x83
|
||||
image = "rootfs.ext4"
|
||||
size = 0
|
||||
}
|
||||
}
|
||||
154
FunKey/board/funkey/linux.config
Normal file
154
FunKey/board/funkey/linux.config
Normal file
@@ -0,0 +1,154 @@
|
||||
CONFIG_LOCALVERSION="-funkey"
|
||||
# CONFIG_LOCALVERSION_AUTO is not set
|
||||
CONFIG_NO_HZ=y
|
||||
CONFIG_HIGH_RES_TIMERS=y
|
||||
CONFIG_CGROUPS=y
|
||||
CONFIG_BLK_DEV_INITRD=y
|
||||
CONFIG_PERF_EVENTS=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_ARCH_SUNXI=y
|
||||
# CONFIG_MACH_SUN4I is not set
|
||||
# CONFIG_MACH_SUN5I is not set
|
||||
# CONFIG_MACH_SUN6I is not set
|
||||
# CONFIG_MACH_SUN7I is not set
|
||||
# CONFIG_MACH_SUN9I is not set
|
||||
CONFIG_HAVE_ARM_ARCH_TIMER=y
|
||||
CONFIG_ARM_PSCI=y
|
||||
CONFIG_HIGHMEM=y
|
||||
CONFIG_ARM_APPENDED_DTB=y
|
||||
CONFIG_ARM_ATAG_DTB_COMPAT=y
|
||||
CONFIG_CPU_FREQ=y
|
||||
CONFIG_CPUFREQ_DT=y
|
||||
CONFIG_VFP=y
|
||||
CONFIG_NEON=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
CONFIG_UNIX=y
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
|
||||
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
|
||||
# CONFIG_INET_XFRM_MODE_BEET is not set
|
||||
# CONFIG_INET_DIAG is not set
|
||||
# CONFIG_IPV6 is not set
|
||||
CONFIG_DNS_RESOLVER=y
|
||||
# CONFIG_WIRELESS is not set
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_SPI_NOR=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_BLK_DEV_LOOP_MIN_COUNT=1
|
||||
CONFIG_SCSI=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_NETDEVICES=y
|
||||
# CONFIG_ETHERNET is not set
|
||||
# CONFIG_WLAN is not set
|
||||
CONFIG_INPUT_EVDEV=y
|
||||
CONFIG_KEYBOARD_SUN4I_LRADC=y
|
||||
# CONFIG_INPUT_MOUSE is not set
|
||||
CONFIG_INPUT_TOUCHSCREEN=y
|
||||
CONFIG_TOUCHSCREEN_NS2009=y
|
||||
CONFIG_INPUT_MISC=y
|
||||
CONFIG_INPUT_AXP20X_PEK=y
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_SERIAL_8250_NR_UARTS=8
|
||||
CONFIG_SERIAL_8250_RUNTIME_UARTS=8
|
||||
CONFIG_SERIAL_8250_DW=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_HW_RANDOM is not set
|
||||
CONFIG_I2C_CHARDEV=y
|
||||
CONFIG_I2C_MV64XXX=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_SUN6I=y
|
||||
CONFIG_PTP_1588_CLOCK=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
CONFIG_THERMAL=y
|
||||
CONFIG_CPU_THERMAL=y
|
||||
CONFIG_WATCHDOG=y
|
||||
CONFIG_SUNXI_WATCHDOG=y
|
||||
CONFIG_MFD_AXP20X_I2C=y
|
||||
CONFIG_MFD_AXP20X_RSB=y
|
||||
CONFIG_MFD_SYSCON=y
|
||||
CONFIG_REGULATOR=y
|
||||
CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
CONFIG_REGULATOR_AXP20X=y
|
||||
# CONFIG_RC_CORE is not set
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_SUN4I=y
|
||||
CONFIG_DRM_PANEL_SIMPLE=y
|
||||
CONFIG_DRM_DUMB_VGA_DAC=y
|
||||
CONFIG_FB_SIMPLE=y
|
||||
CONFIG_FB_SSD1307=y
|
||||
CONFIG_BACKLIGHT_PWM=y
|
||||
CONFIG_LOGO=y
|
||||
CONFIG_SOUND=y
|
||||
CONFIG_SND=y
|
||||
# CONFIG_SND_DRIVERS is not set
|
||||
# CONFIG_SND_ARM is not set
|
||||
# CONFIG_SND_SPI is not set
|
||||
CONFIG_SND_SOC=y
|
||||
CONFIG_SND_SUN4I_CODEC=y
|
||||
CONFIG_SND_SUN8I_CODEC=y
|
||||
CONFIG_SND_SUN8I_CODEC_ANALOG=y
|
||||
# CONFIG_HID_GENERIC is not set
|
||||
# CONFIG_HID_A4TECH is not set
|
||||
# CONFIG_HID_APPLE is not set
|
||||
# CONFIG_HID_BELKIN is not set
|
||||
# CONFIG_HID_CHERRY is not set
|
||||
# CONFIG_HID_CHICONY is not set
|
||||
# CONFIG_HID_CYPRESS is not set
|
||||
# CONFIG_HID_EZKEY is not set
|
||||
# CONFIG_HID_ITE is not set
|
||||
# CONFIG_HID_KENSINGTON is not set
|
||||
# CONFIG_HID_LOGITECH is not set
|
||||
# CONFIG_HID_MICROSOFT is not set
|
||||
# CONFIG_HID_MONTEREY is not set
|
||||
CONFIG_NOP_USB_XCEIV=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_ETH=m
|
||||
CONFIG_USB_ETH_EEM=y
|
||||
CONFIG_USB_MASS_STORAGE=m
|
||||
CONFIG_USB_G_SERIAL=m
|
||||
CONFIG_USB_G_ACM_MS=m
|
||||
CONFIG_MMC=y
|
||||
CONFIG_MMC_SUNXI=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
# CONFIG_RTC_INTF_SYSFS is not set
|
||||
# CONFIG_RTC_INTF_PROC is not set
|
||||
CONFIG_DMADEVICES=y
|
||||
CONFIG_DMA_SUN6I=y
|
||||
CONFIG_STAGING=y
|
||||
CONFIG_FB_TFT=y
|
||||
CONFIG_FB_TFT_ST7789V=y
|
||||
CONFIG_FB_FLEX=y
|
||||
# CONFIG_SUN8I_A23_CCU is not set
|
||||
# CONFIG_SUN8I_A33_CCU is not set
|
||||
# CONFIG_SUN8I_H3_CCU is not set
|
||||
CONFIG_SUN8I_DE2_CCU=y
|
||||
# CONFIG_IOMMU_SUPPORT is not set
|
||||
CONFIG_PWM_SUN4I=y
|
||||
CONFIG_PHY_SUN4I_USB=y
|
||||
CONFIG_NVMEM_SUNXI_SID=y
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_VFAT_FS=y
|
||||
CONFIG_TMPFS=y
|
||||
CONFIG_CONFIGFS_FS=y
|
||||
# CONFIG_MISC_FILESYSTEMS is not set
|
||||
# CONFIG_NETWORK_FILESYSTEMS is not set
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
CONFIG_DEBUG_FS=y
|
||||
CONFIG_KEYS=y
|
||||
CONFIG_CRYPTO_CCM=y
|
||||
CONFIG_CRYPTO_GCM=y
|
||||
CONFIG_CRYPTO_CMAC=y
|
||||
CONFIG_CRYPTO_ARC4=y
|
||||
CONFIG_CRYPTO_DEV_SUN4I_SS=y
|
||||
@@ -0,0 +1,74 @@
|
||||
fb_st7789v.c | 34 ++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 32 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
|
||||
index a5d7c87..69f52af 100644
|
||||
--- a/drivers/staging/fbtft/fb_st7789v.c
|
||||
+++ b/drivers/staging/fbtft/fb_st7789v.c
|
||||
@@ -86,6 +86,28 @@ enum st7789v_command {
|
||||
static int init_display(struct fbtft_par *par)
|
||||
{
|
||||
/* turn off sleep mode */
|
||||
+ /*write_reg(par, 0x11);
|
||||
+ mdelay(120);
|
||||
+
|
||||
+ write_reg(par, 0x36, 0x00);
|
||||
+ write_reg(par, 0x3A, 0x05);
|
||||
+
|
||||
+ write_reg(par, 0xB2,0x0C,0x0C,0x00,0x33,0x33);
|
||||
+ write_reg(par, 0xB7,0x35);
|
||||
+ write_reg(par, 0xBB,0x1A);
|
||||
+ write_reg(par, 0xC0,0x2C);
|
||||
+ write_reg(par, 0xC2,0x01);
|
||||
+ write_reg(par, 0xC3,0x0B);
|
||||
+ write_reg(par, 0xC4,0x20);
|
||||
+ write_reg(par, 0xC6,0x0F);
|
||||
+ write_reg(par, 0xD0,0xA4,0xA1);
|
||||
+ write_reg(par, 0x21);
|
||||
+ write_reg(par, 0xE0,0x00,0x19,0x1E,0x0A,0x09,0x15,0x3D,0x44,0x51,0x12,0x03,0x00,0x3F,0x3F);
|
||||
+ write_reg(par, 0xE1,0x00,0x18,0x1E,0x0A,0x09,0x25,0x3F,0x43,0x52,0x33,0x03,0x00,0x3F,0x3F);
|
||||
+ write_reg(par, 0x29);*/
|
||||
+
|
||||
+
|
||||
+ /* turn off sleep mode */
|
||||
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
|
||||
mdelay(120);
|
||||
|
||||
@@ -128,7 +150,14 @@ static int init_display(struct fbtft_par *par)
|
||||
*/
|
||||
write_reg(par, PWCTRL1, 0xA4, 0xA1);
|
||||
|
||||
+ /* Ystart at 80 , Yend at 240 */
|
||||
+ write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xF0);
|
||||
+
|
||||
+ /* Display Inversion of colors */
|
||||
+ write_reg(par, 0x21);
|
||||
+
|
||||
write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -189,7 +218,7 @@ static int set_gamma(struct fbtft_par *par, u32 *curves)
|
||||
* The masks are the same for both positive and negative voltage
|
||||
* gamma curves.
|
||||
*/
|
||||
- static const u8 gamma_par_mask[] = {
|
||||
+ const u8 gamma_par_mask[] = {
|
||||
0xFF, /* V63[3:0], V0[3:0]*/
|
||||
0x3F, /* V1[5:0] */
|
||||
0x3F, /* V2[5:0] */
|
||||
@@ -241,7 +270,7 @@ static int blank(struct fbtft_par *par, bool on)
|
||||
static struct fbtft_display display = {
|
||||
.regwidth = 8,
|
||||
.width = 240,
|
||||
- .height = 320,
|
||||
+ .height = 240,
|
||||
.gamma_num = 2,
|
||||
.gamma_len = 14,
|
||||
.gamma = DEFAULT_GAMMA,
|
||||
@@ -263,3 +292,4 @@ MODULE_ALIAS("platform:st7789v");
|
||||
MODULE_DESCRIPTION("FB driver for the ST7789V LCD Controller");
|
||||
MODULE_AUTHOR("Dennis Menschel");
|
||||
MODULE_LICENSE("GPL");
|
||||
+
|
||||
9673
FunKey/board/funkey/patches/linux/0002-added-240x240-boot-logo.patch
Normal file
9673
FunKey/board/funkey/patches/linux/0002-added-240x240-boot-logo.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,67 @@
|
||||
From 538e97d56bae968580ac046389243383b7559ab9 Mon Sep 17 00:00:00 2001
|
||||
From: Michel Stempin <michel.stempin@wanadoo.fr>
|
||||
Date: Tue, 19 Mar 2019 22:26:56 +0100
|
||||
Subject: [PATCH 9/9] rotated screen 90 degrees CW
|
||||
|
||||
Signed-off-by: Michel Stempin <michel.stempin@wanadoo.fr>
|
||||
---
|
||||
arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts | 2 +-
|
||||
drivers/staging/fbtft/fb_st7789v.c | 13 ++++++++++---
|
||||
drivers/staging/fbtft/fbtft-core.c | 8 +++++++-
|
||||
3 files changed, 18 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
|
||||
index 69f52af..e966993 100644
|
||||
--- a/drivers/staging/fbtft/fb_st7789v.c
|
||||
+++ b/drivers/staging/fbtft/fb_st7789v.c
|
||||
@@ -150,9 +150,6 @@ static int init_display(struct fbtft_par *par)
|
||||
*/
|
||||
write_reg(par, PWCTRL1, 0xA4, 0xA1);
|
||||
|
||||
- /* Ystart at 80 , Yend at 240 */
|
||||
- write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xF0);
|
||||
-
|
||||
/* Display Inversion of colors */
|
||||
write_reg(par, 0x21);
|
||||
|
||||
@@ -190,6 +187,16 @@ static int set_var(struct fbtft_par *par)
|
||||
return -EINVAL;
|
||||
}
|
||||
write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, madctl_par);
|
||||
+
|
||||
+ // All offset operations are done after in fbtft_set_addr_win, not here
|
||||
+ /* Ystart at 0 , Yend at 239 */
|
||||
+ //write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xEF);
|
||||
+ write_reg(par, 0x2B, 0x00, 0x00, 0x00, 0xEF);
|
||||
+ //write_reg(par, 0x2B, 0x00, 0x50, 0x01, 0x3F);
|
||||
+ /* Xstart at 80 , Xend at 319 */
|
||||
+ write_reg(par, 0x2A, 0x00, 0x50, 0x01, 0x3F);
|
||||
+ //write_reg(par, 0x2A, 0x00, 0x50, 0x00, 0xEF);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
|
||||
index 6d0363d..fbb0934 100644
|
||||
--- a/drivers/staging/fbtft/fbtft-core.c
|
||||
+++ b/drivers/staging/fbtft/fbtft-core.c
|
||||
@@ -391,9 +391,15 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
|
||||
fbtft_par_dbg(DEBUG_UPDATE_DISPLAY, par, "%s(start_line=%u, end_line=%u)\n",
|
||||
__func__, start_line, end_line);
|
||||
|
||||
- if (par->fbtftops.set_addr_win)
|
||||
+ // Carefull removing this. this will work only if the full screen is updated at once
|
||||
+ /*if (par->fbtftops.set_addr_win){
|
||||
par->fbtftops.set_addr_win(par, 0, start_line,
|
||||
par->info->var.xres - 1, end_line);
|
||||
+ }*/
|
||||
+ if (par->fbtftops.set_addr_win){
|
||||
+ par->fbtftops.set_addr_win(par, 80, start_line,
|
||||
+ 320 - 1, end_line);
|
||||
+ }
|
||||
|
||||
offset = start_line * par->info->fix.line_length;
|
||||
len = (end_line - start_line + 1) * par->info->fix.line_length;
|
||||
--
|
||||
2.7.4
|
||||
|
||||
166
FunKey/board/funkey/patches/linux/0004-add-funkey-dts.patch
Normal file
166
FunKey/board/funkey/patches/linux/0004-add-funkey-dts.patch
Normal file
@@ -0,0 +1,166 @@
|
||||
--- /dev/null 2019-03-22 21:33:35.539154398 +0100
|
||||
+++ a/arch/arm/boot/dts/sun8i-v3s-funkey.dts 2019-03-22 22:37:31.157868364 +0100
|
||||
@@ -0,0 +1,163 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
|
||||
+ *
|
||||
+ * This file is dual-licensed: you can use it either under the terms
|
||||
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||
+ * licensing only applies to this file, and not this project as a
|
||||
+ * whole.
|
||||
+ *
|
||||
+ * a) This file is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This file is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Or, alternatively,
|
||||
+ *
|
||||
+ * b) Permission is hereby granted, free of charge, to any person
|
||||
+ * obtaining a copy of this software and associated documentation
|
||||
+ * files (the "Software"), to deal in the Software without
|
||||
+ * restriction, including without limitation the rights to use,
|
||||
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following
|
||||
+ * conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "sun8i-v3s.dtsi"
|
||||
+#include "sunxi-common-regulators.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "FunKey";
|
||||
+ compatible = "funkey", "allwinner,sun8i-v3s";
|
||||
+
|
||||
+ aliases {
|
||||
+ serial0 = &uart0;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = "serial0:115200n8";
|
||||
+ };
|
||||
+
|
||||
+ backlight: backlight {
|
||||
+ compatible = "pwm-backlight";
|
||||
+ pwms = <&pwm 0 1000000 0>;
|
||||
+ brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
|
||||
+ default-brightness-level = <100>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&codec {
|
||||
+ allwinner,audio-routing =
|
||||
+ "Headphone", "HP",
|
||||
+ "Headphone", "HPCOM",
|
||||
+ "MIC1", "Mic",
|
||||
+ "Mic", "HBIAS";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ehci0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ axp209: pmic@34 {
|
||||
+ compatible = "x-powers,axp209";
|
||||
+ reg = <0x34>;
|
||||
+ interrupts = <0>;
|
||||
+
|
||||
+ interrupt-controller;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&mmc0 {
|
||||
+ pinctrl-0 = <&mmc0_pins_a>;
|
||||
+ pinctrl-names = "default";
|
||||
+ broken-cd;
|
||||
+ bus-width = <4>;
|
||||
+ vmmc-supply = <®_vcc3v3>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ohci0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+#include "axp209.dtsi"
|
||||
+
|
||||
+®_dcdc2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1400000>;
|
||||
+ regulator-name = "vdd-cpu-sys-ephy";
|
||||
+};
|
||||
+
|
||||
+®_dcdc3 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-min-microvolt = <3000000>;
|
||||
+ regulator-max-microvolt = <3450000>;
|
||||
+ regulator-name = "vcc-io-ephy-mcsi-usb";
|
||||
+};
|
||||
+
|
||||
+®_ldo1 {
|
||||
+ regulator-min-microvolt = <3000000>;
|
||||
+ regulator-max-microvolt = <3600000>;
|
||||
+ regulator-name = "vcc-rtc";
|
||||
+};
|
||||
+
|
||||
+®_ldo2 {
|
||||
+ regulator-always-on;
|
||||
+ regulator-min-microvolt = <2800000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "avcc-pll";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ st7789v@0 {
|
||||
+ compatible = "sitronix,st7789v";
|
||||
+ reg = <0>;
|
||||
+
|
||||
+ spi-max-frequency = <40000000>;
|
||||
+ txbuflen = <115200>;
|
||||
+ rotate = <90>;
|
||||
+ fps = <42>;
|
||||
+ buswidth = <8>;
|
||||
+ reset-gpios = <&pio 4 1 GPIO_ACTIVE_LOW>; //PE1
|
||||
+ dc-gpios = <&pio 2 0 GPIO_ACTIVE_LOW>; //PC0 (MISO)
|
||||
+ debug = <0>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ pinctrl-0 = <&uart0_pins_a>;
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 1f97ae8..e798bf1 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -932,6 +932,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
|
||||
sun8i-h3-orangepi-plus2e.dtb \
|
||||
sun8i-r16-bananapi-m2m.dtb \
|
||||
sun8i-r16-parrot.dtb \
|
||||
+ sun8i-v3s-funkey.dtb \
|
||||
sun8i-v3s-licheepi-zero.dtb \
|
||||
sun8i-v3s-licheepi-zero-dock.dtb \
|
||||
sun8i-v3s-licheepi-zero-with-480x272-lcd.dtb \
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
|
||||
*
|
||||
* This file is dual-licensed: you can use it either under the terms
|
||||
* of the GPL or the X11 license, at your option. Note that this dual
|
||||
* licensing only applies to this file, and not this project as a
|
||||
* whole.
|
||||
*
|
||||
* a) This file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Or, alternatively,
|
||||
*
|
||||
* b) Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include "sun8i-v3s.dtsi"
|
||||
#include "sunxi-common-regulators.dtsi"
|
||||
|
||||
/ {
|
||||
model = "FunKey";
|
||||
compatible = "funkey", "allwinner,sun8i-v3s";
|
||||
|
||||
aliases {
|
||||
serial0 = &uart0;
|
||||
};
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
backlight: backlight {
|
||||
compatible = "pwm-backlight";
|
||||
pwms = <&pwm 0 1000000 0>;
|
||||
brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
|
||||
default-brightness-level = <100>;
|
||||
};
|
||||
};
|
||||
|
||||
&codec {
|
||||
allwinner,audio-routing =
|
||||
"Headphone", "HP",
|
||||
"Headphone", "HPCOM",
|
||||
"MIC1", "Mic",
|
||||
"Mic", "HBIAS";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ehci0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
|
||||
axp209: pmic@34 {
|
||||
compatible = "x-powers,axp209";
|
||||
reg = <0x34>;
|
||||
interrupts = <0>;
|
||||
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
&mmc0 {
|
||||
pinctrl-0 = <&mmc0_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
broken-cd;
|
||||
bus-width = <4>;
|
||||
vmmc-supply = <®_vcc3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ohci0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
#include "axp209.dtsi"
|
||||
|
||||
®_dcdc2 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <1000000>;
|
||||
regulator-max-microvolt = <1400000>;
|
||||
regulator-name = "vdd-cpu-sys-ephy";
|
||||
};
|
||||
|
||||
®_dcdc3 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <3000000>;
|
||||
regulator-max-microvolt = <3450000>;
|
||||
regulator-name = "vcc-io-ephy-mcsi-usb";
|
||||
};
|
||||
|
||||
®_ldo1 {
|
||||
regulator-min-microvolt = <3000000>;
|
||||
regulator-max-microvolt = <3600000>;
|
||||
regulator-name = "vcc-rtc";
|
||||
};
|
||||
|
||||
®_ldo2 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <2800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "avcc-pll";
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
|
||||
st7789v@0 {
|
||||
compatible = "sitronix,st7789v";
|
||||
reg = <0>;
|
||||
|
||||
spi-max-frequency = <40000000>;
|
||||
txbuflen = <115200>;
|
||||
rotate = <90>;
|
||||
fps = <42>;
|
||||
buswidth = <8>;
|
||||
reset-gpios = <&pio 4 1 GPIO_ACTIVE_LOW>; //PE1
|
||||
dc-gpios = <&pio 2 0 GPIO_ACTIVE_LOW>; //PC0 (MISO)
|
||||
debug = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
pinctrl-0 = <&uart0_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pwm0_pins>;
|
||||
status = "okay";
|
||||
};
|
||||
86
FunKey/board/funkey/patches/uboot/0001-add-funkey-dts.patch
Normal file
86
FunKey/board/funkey/patches/uboot/0001-add-funkey-dts.patch
Normal file
@@ -0,0 +1,86 @@
|
||||
--- /dev/null 2019-03-22 21:33:35.539154398 +0100
|
||||
+++ a/arch/arm/dts/sun8i-v3s-funkey.dts 2019-03-22 22:22:37.417295027 +0100
|
||||
@@ -0,0 +1,83 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
|
||||
+ *
|
||||
+ * This file is dual-licensed: you can use it either under the terms
|
||||
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||
+ * licensing only applies to this file, and not this project as a
|
||||
+ * whole.
|
||||
+ *
|
||||
+ * a) This file is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License as
|
||||
+ * published by the Free Software Foundation; either version 2 of the
|
||||
+ * License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This file is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * Or, alternatively,
|
||||
+ *
|
||||
+ * b) Permission is hereby granted, free of charge, to any person
|
||||
+ * obtaining a copy of this software and associated documentation
|
||||
+ * files (the "Software"), to deal in the Software without
|
||||
+ * restriction, including without limitation the rights to use,
|
||||
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following
|
||||
+ * conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "sun8i-v3s.dtsi"
|
||||
+#include "sunxi-common-regulators.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "FunKey";
|
||||
+ compatible = "funkey", "allwinner,sun8i-v3s";
|
||||
+
|
||||
+ aliases {
|
||||
+ serial0 = &uart0;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = "serial0:115200n8";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&mmc0 {
|
||||
+ pinctrl-0 = <&mmc0_pins_a>;
|
||||
+ pinctrl-names = "default";
|
||||
+ broken-cd;
|
||||
+ bus-width = <4>;
|
||||
+ vmmc-supply = <®_vcc3v3>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ pinctrl-0 = <&uart0_pins_a>;
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_otg {
|
||||
+ dr_mode = "otg";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usbphy {
|
||||
+ usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
|
||||
index 469dd71..e91a8d3 100644
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -281,6 +281,7 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \
|
||||
sun8i-h3-orangepi-plus2e.dtb \
|
||||
sun8i-h3-nanopi-neo.dtb
|
||||
dtb-$(CONFIG_MACH_SUN8I_V3S) += \
|
||||
+ sun8i-v3s-funkey.dtb \
|
||||
sun8i-v3s-licheepi-zero.dtb
|
||||
dtb-$(CONFIG_MACH_SUN50I) += \
|
||||
sun50i-a64-pine64-plus.dtb \
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
|
||||
*
|
||||
* This file is dual-licensed: you can use it either under the terms
|
||||
* of the GPL or the X11 license, at your option. Note that this dual
|
||||
* licensing only applies to this file, and not this project as a
|
||||
* whole.
|
||||
*
|
||||
* a) This file is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Or, alternatively,
|
||||
*
|
||||
* b) Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include "sun8i-v3s.dtsi"
|
||||
#include "sunxi-common-regulators.dtsi"
|
||||
|
||||
/ {
|
||||
model = "FunKey";
|
||||
compatible = "funkey", "allwinner,sun8i-v3s";
|
||||
|
||||
aliases {
|
||||
serial0 = &uart0;
|
||||
};
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
};
|
||||
|
||||
&mmc0 {
|
||||
pinctrl-0 = <&mmc0_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
broken-cd;
|
||||
bus-width = <4>;
|
||||
vmmc-supply = <®_vcc3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
pinctrl-0 = <&uart0_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_otg {
|
||||
dr_mode = "otg";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbphy {
|
||||
usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
|
||||
status = "okay";
|
||||
};
|
||||
5
FunKey/board/funkey/post-build.sh
Executable file
5
FunKey/board/funkey/post-build.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Swap
|
||||
sed -i '/^\/swap/d' "${TARGET_DIR}/etc/fstab"
|
||||
echo "/swap none swap defaults 0 0" >> "${TARGET_DIR}/etc/fstab"
|
||||
65
FunKey/board/funkey/readme.txt
Normal file
65
FunKey/board/funkey/readme.txt
Normal file
@@ -0,0 +1,65 @@
|
||||
# FunKey
|
||||
|
||||
Intro
|
||||
=====
|
||||
|
||||
This directory contains a buildroot-based external configuration for
|
||||
building the FunKey.
|
||||
|
||||
How to build it
|
||||
===============
|
||||
|
||||
Configure Buildroot
|
||||
-------------------
|
||||
|
||||
There is only one FunKey defconfig files in Buildroot:
|
||||
|
||||
$ ./fun funkey_defconfig
|
||||
|
||||
Build the rootfs
|
||||
----------------
|
||||
|
||||
Note: you will need to have access to the network, since Buildroot
|
||||
will download the packages' sources.
|
||||
|
||||
You may now build your FunKey with:
|
||||
|
||||
$ ./have fun
|
||||
|
||||
(This may take a while, consider getting yourself a coffee ;-) )
|
||||
|
||||
Result of the build
|
||||
-------------------
|
||||
|
||||
After building, you should obtain this tree:
|
||||
|
||||
FunKey/output/images/
|
||||
+-- boot.scr
|
||||
+-- boot.vfat
|
||||
+-- rootfs.ext2
|
||||
+-- rootfs.ext4 -> rootfs.ext2
|
||||
+-- rootfs.tar
|
||||
+-- sdcard.img
|
||||
+-- sun8i-v3s-funkey.dtb
|
||||
+-- u-boot.bin
|
||||
+-- u-boot-sunxi-with-spl.bin
|
||||
`-- zImage
|
||||
|
||||
How to write the SD card
|
||||
========================
|
||||
|
||||
Once the build process is finished you will have an image called
|
||||
"sdcard.img" in the FunKey/output/images/ directory.
|
||||
|
||||
Copy the bootable "sdcard.img" onto an SD card with "dd":
|
||||
|
||||
$ sudo dd if=<FunKey directory>/FunKey/output/images/sdcard.img of=/dev/sdX
|
||||
|
||||
Alternatively, you can use the Etcher graphical tool to burn the image
|
||||
to the SD card safely and on any platform:
|
||||
|
||||
https://etcher.io/
|
||||
|
||||
Once the SD card is burned, insert it into your FunKey board, and
|
||||
power it up. Your new system should come up now and start a console on
|
||||
the UART0 serial port.
|
||||
24
FunKey/board/funkey/rootfs-overlay/etc/init.d/S02resize_rootfs
Executable file
24
FunKey/board/funkey/rootfs-overlay/etc/init.d/S02resize_rootfs
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
THIS=$(basename $0)
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
sleep 1
|
||||
echo "$THIS: starting resizing the root partition" | tee /dev/kmsg &&
|
||||
resize_rootfs &&
|
||||
rm /etc/init.d/S02resize_rootfs
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$THIS: finished resizing the root partition, rebooting to enlarge the root filesystem" | tee /dev/kmsg
|
||||
reboot
|
||||
exit 0
|
||||
else
|
||||
echo "$THIS: cannot resize the root partition, aborting" | tee /dev/kmsg
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
54
FunKey/board/funkey/rootfs-overlay/etc/init.d/S03swap
Executable file
54
FunKey/board/funkey/rootfs-overlay/etc/init.d/S03swap
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
THIS=$(basename $0)
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ ! -f /swap ]; then
|
||||
ROOT_PART=$(df | grep /dev/root)
|
||||
set $ROOT_PART
|
||||
let LEFT="$4 * 1024"
|
||||
if [ $LEFT -lt 134217728 ]; then
|
||||
echo "$THIS: not enough free space for swap file found, aborting" | tee /dev/kmsg
|
||||
exit 1
|
||||
fi
|
||||
echo "$THIS: no swap file found, creating it" | tee /dev/kmsg &&
|
||||
dd if=/dev/zero of=/swap bs=1M count=128 &&
|
||||
mkswap /swap &&
|
||||
chmod 0600 /swap
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$THIS: created swap file" | tee /dev/kmsg
|
||||
else
|
||||
echo "$THIS: cannot create swap file, aborting" | tee /dev/kmsg
|
||||
rm /swap
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
echo "$THIS: enabling swap file" | tee /dev/kmsg &&
|
||||
swapon -a
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$THIS: swap file enabled" | tee /dev/kmsg
|
||||
else
|
||||
echo "$THIS: cannot enable swap file, aborting" | tee /dev/kmsg
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo "$THIS: disabling swap file" | tee /dev/kmsg &&
|
||||
swapoff -a
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$THIS: swap file disabled" | tee /dev/kmsg
|
||||
else
|
||||
echo "$THIS: cannot disable swap file, aborting" | tee /dev/kmsg
|
||||
exit 4
|
||||
fi
|
||||
;;
|
||||
restart|reload)
|
||||
"$0" stop
|
||||
"$0" start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}" >&2
|
||||
exit 5
|
||||
;;
|
||||
esac
|
||||
52
FunKey/board/funkey/rootfs-overlay/etc/init.d/S04modules
Executable file
52
FunKey/board/funkey/rootfs-overlay/etc/init.d/S04modules
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Assure that the kernel has module support.
|
||||
[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
|
||||
|
||||
THIS=$(basename $0)
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
|
||||
# Exit if there's no modules file or there are no
|
||||
# valid entries
|
||||
if [ -r /etc/sysconfig/modules ]; then
|
||||
egrep -qv '^($|#)' /etc/sysconfig/modules
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: no module found in /etc/sysconfig/modules" | tee/dev/kmsg
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$THIS: loading modules from /etc/sysconfig/modules:" | tee/dev/kmsg
|
||||
|
||||
# Only try to load modules if the user has actually given us
|
||||
# some modules to load.
|
||||
while read MODULE ARGS; do
|
||||
|
||||
# Ignore comments and blank lines.
|
||||
case "$MODULE" in
|
||||
""|"#"*) continue ;;
|
||||
esac
|
||||
|
||||
# Attempt to load the module, making
|
||||
# sure to pass any arguments provided.
|
||||
modprobe ${MODULE} ${ARGS} >/dev/null
|
||||
|
||||
# Print the module name if successful,
|
||||
# otherwise take note.
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$THIS: loaded module ${MODULE}" | tee /dev/kmsg
|
||||
else
|
||||
echo "$THIS: failed to load module ${MODULE}" | tee /dev/kmsg
|
||||
fi
|
||||
done < /etc/sysconfig/modules
|
||||
|
||||
# Print a message about successfully loaded
|
||||
# modules on the correct line.
|
||||
echo "$THIS: finished loading modules" | tee /dev/kmsg
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ${0} {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
209
FunKey/board/funkey/rootfs-overlay/etc/init.d/S50alsa-utils
Executable file
209
FunKey/board/funkey/rootfs-overlay/etc/init.d/S50alsa-utils
Executable file
@@ -0,0 +1,209 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# alsa-utils initscript
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: alsa-utils
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $remote_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Restore and store ALSA driver settings
|
||||
# Description: This script stores and restores mixer levels on
|
||||
# shutdown and bootup.On sysv-rc systems: to
|
||||
# disable storing of mixer levels on shutdown,
|
||||
# remove /etc/rc[06].d/K50alsa-utils. To disable
|
||||
# restoring of mixer levels on bootup, rename the
|
||||
# "S50alsa-utils" symbolic link in /etc/rcS.d/ to
|
||||
# "K50alsa-utils".
|
||||
### END INIT INFO
|
||||
|
||||
# Don't use set -e; check exit status instead
|
||||
|
||||
# Exit silently if package is no longer installed
|
||||
[ -x /usr/sbin/alsactl ] || exit 0
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
MYNAME=/etc/init.d/alsa-utils
|
||||
ALSACTLHOME=/run/alsa
|
||||
|
||||
[ -d "$ALSACTLHOME" ] || mkdir -p "$ALSACTLHOME"
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
. /usr/share/alsa/utils.sh
|
||||
|
||||
# $1 EXITSTATUS
|
||||
# [$2 MESSAGE]
|
||||
log_action_end_msg_and_exit()
|
||||
{
|
||||
log_action_end_msg "$1" ${2:+"$2"}
|
||||
exit $1
|
||||
}
|
||||
|
||||
# $1 PROGRAM
|
||||
executable()
|
||||
{
|
||||
# If which is not available then we must be running before
|
||||
# /usr is mounted on a system that has which in /usr/bin/.
|
||||
# Conclude that $1 is not executable.
|
||||
[ -x /bin/which ] || [ -x /usr/bin/which ] || return 1
|
||||
which "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
executable amixer || { echo "${MYNAME}: Error: No amixer program available." >&2 ; exit 1 ; }
|
||||
|
||||
# $1 <card ID> | "all"
|
||||
restore_levels()
|
||||
{
|
||||
[ -f /var/lib/alsa/asound.state ] || return 1
|
||||
CARD="$1"
|
||||
[ "$1" = all ] && CARD=""
|
||||
# Assume that if alsactl prints a message on stderr
|
||||
# then it failed somehow. This works around the fact
|
||||
# that alsactl doesn't return nonzero status when it
|
||||
# can't restore settings for the card
|
||||
if MSG="$(alsactl -E HOME="$ALSACTLHOME" restore $CARD 2>&1 >/dev/null)" && [ ! "$MSG" ] ; then
|
||||
return 0
|
||||
else
|
||||
# Retry with the "force" option. This restores more levels
|
||||
# but it results in much longer error messages.
|
||||
alsactl -F restore $CARD >/dev/null 2>&1
|
||||
log_action_cont_msg "warning: 'alsactl -E HOME="$ALSACTLHOME" restore${CARD:+ $CARD}' failed with error message '$MSG'"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 <card ID> | "all"
|
||||
store_levels()
|
||||
{
|
||||
CARD="$1"
|
||||
[ "$1" = all ] && CARD=""
|
||||
if MSG="$(alsactl -E HOME="$ALSACTLHOME" store $CARD 2>&1)" ; then
|
||||
sleep 1
|
||||
return 0
|
||||
else
|
||||
log_action_cont_msg "warning: 'alsactl store${CARD:+ $CARD}' failed with error message '$MSG'"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# $1 <card ID>
|
||||
mute_and_zero_levels_on_card()
|
||||
{
|
||||
CARDOPT="-c $1"
|
||||
for CTL in \
|
||||
Master \
|
||||
PCM \
|
||||
Synth \
|
||||
CD \
|
||||
Line \
|
||||
Mic \
|
||||
"PCM,1" \
|
||||
Wave \
|
||||
Music \
|
||||
AC97 \
|
||||
"Master Digital" \
|
||||
DAC \
|
||||
"DAC,0" \
|
||||
"DAC,1" \
|
||||
Headphone \
|
||||
Speaker \
|
||||
Playback
|
||||
do
|
||||
mute_and_zero_level "$CTL"
|
||||
done
|
||||
# for CTL in \
|
||||
# "Audigy Analog/Digital Output Jack" \
|
||||
# "SB Live Analog/Digital Output Jack"
|
||||
# do
|
||||
# switch_control "$CTL" off
|
||||
# done
|
||||
return 0
|
||||
}
|
||||
|
||||
# $1 <card ID> | "all"
|
||||
mute_and_zero_levels()
|
||||
{
|
||||
TTZML_RETURNSTATUS=0
|
||||
case "$1" in
|
||||
all)
|
||||
for CARD in $(echo_card_indices) ; do
|
||||
mute_and_zero_levels_on_card "$CARD" || TTZML_RETURNSTATUS=1
|
||||
done
|
||||
;;
|
||||
*)
|
||||
mute_and_zero_levels_on_card "$1" || TTZML_RETURNSTATUS=1
|
||||
;;
|
||||
esac
|
||||
return $TTZML_RETURNSTATUS
|
||||
}
|
||||
|
||||
|
||||
# $1 <card ID> | "all"
|
||||
card_OK()
|
||||
{
|
||||
[ "$1" ] || bugout
|
||||
if [ "$1" = all ] ; then
|
||||
[ -d /proc/asound ]
|
||||
return $?
|
||||
else
|
||||
[ -d "/proc/asound/card$1" ] || [ -d "/proc/asound/$1" ]
|
||||
return $?
|
||||
fi
|
||||
}
|
||||
|
||||
# If a card identifier is provided in $2 then regard it as an error
|
||||
# if that card is not present; otherwise don't regard it as an error.
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
EXITSTATUS=0
|
||||
TARGET_CARD="$2"
|
||||
case "$TARGET_CARD" in
|
||||
""|all) TARGET_CARD=all ; log_action_begin_msg "Setting up ALSA" ;;
|
||||
*) log_action_begin_msg "Setting up ALSA card ${TARGET_CARD}" ;;
|
||||
esac
|
||||
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
|
||||
preinit_levels "$TARGET_CARD" || EXITSTATUS=1
|
||||
if ! restore_levels "$TARGET_CARD" ; then
|
||||
sanify_levels "$TARGET_CARD" || EXITSTATUS=1
|
||||
restore_levels "$TARGET_CARD" >/dev/null 2>&1 || :
|
||||
fi
|
||||
log_action_end_msg_and_exit "$EXITSTATUS"
|
||||
;;
|
||||
stop)
|
||||
EXITSTATUS=0
|
||||
TARGET_CARD="$2"
|
||||
case "$TARGET_CARD" in
|
||||
""|all) TARGET_CARD=all ; log_action_begin_msg "Shutting down ALSA" ;;
|
||||
*) log_action_begin_msg "Shutting down ALSA card ${TARGET_CARD}" ;;
|
||||
esac
|
||||
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
|
||||
store_levels "$TARGET_CARD" || EXITSTATUS=1
|
||||
#mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
|
||||
log_action_end_msg_and_exit "$EXITSTATUS"
|
||||
;;
|
||||
restart|force-reload)
|
||||
EXITSTATUS=0
|
||||
$0 stop || EXITSTATUS=1
|
||||
$0 start || EXITSTATUS=1
|
||||
exit $EXITSTATUS
|
||||
;;
|
||||
reset)
|
||||
TARGET_CARD="$2"
|
||||
case "$TARGET_CARD" in
|
||||
""|all) TARGET_CARD=all ; log_action_begin_msg "Resetting ALSA" ;;
|
||||
*) log_action_begin_msg "Resetting ALSA card ${TARGET_CARD}" ;;
|
||||
esac
|
||||
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
|
||||
preinit_levels "$TARGET_CARD"
|
||||
sanify_levels "$TARGET_CARD"
|
||||
log_action_end_msg_and_exit "$?"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $MYNAME {start [CARD]|stop [CARD]|restart [CARD]|reset [CARD]}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
10
FunKey/board/funkey/rootfs-overlay/etc/issue
Normal file
10
FunKey/board/funkey/rootfs-overlay/etc/issue
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
_______ __ __
|
||||
| ___|.--.--.-----.| |/ |.-----.--.--.
|
||||
| ___|| | | || < | -__| | |
|
||||
|___| |_____|__|__||__|\\__||_____|___ |
|
||||
FUN ON A KEYCHAIN |_____|
|
||||
-----------------------------------------------------
|
||||
Version 0.1
|
||||
-----------------------------------------------------
|
||||
|
||||
1
FunKey/board/funkey/rootfs-overlay/etc/sysconfig/modules
Normal file
1
FunKey/board/funkey/rootfs-overlay/etc/sysconfig/modules
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
34
FunKey/board/funkey/rootfs-overlay/lib/lsb/init-functions
Executable file
34
FunKey/board/funkey/rootfs-overlay/lib/lsb/init-functions
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
#set -xv
|
||||
|
||||
if [ x"$THIS" != x ]; then
|
||||
THIS="${THIS}: "
|
||||
fi
|
||||
log_action_msg () {
|
||||
echo "${THIS}${@}." | tee /dev/kmsg
|
||||
}
|
||||
|
||||
log_action_begin_msg () {
|
||||
echo "${THIS}${@}..." | tee /dev/kmsg
|
||||
}
|
||||
|
||||
log_action_cont_msg () {
|
||||
echo "${THIS}${@}..." | tee /dev/kmsg
|
||||
}
|
||||
|
||||
log_action_end_msg () {
|
||||
local end
|
||||
if [ -z "${2:-}" ]; then
|
||||
end="."
|
||||
else
|
||||
end=" ($2)."
|
||||
fi
|
||||
|
||||
if [ $1 -eq 0 ]; then
|
||||
echo "${THIS}done${end}" | tee /dev/kmsg
|
||||
else
|
||||
echo "${THIS}failed${end}" | tee /dev/kmsg
|
||||
fi
|
||||
}
|
||||
|
||||
80
FunKey/board/funkey/rootfs-overlay/usr/sbin/resize_rootfs
Executable file
80
FunKey/board/funkey/rootfs-overlay/usr/sbin/resize_rootfs
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
|
||||
THIS=$(basename $0)
|
||||
|
||||
echo "$THIS: resizing rootfs" | tee /dev/kmsg
|
||||
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
echo "$THIS: this script must be run as root. Try 'sudo resize_rootfs'\n" | tee /dev/kmsg
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT_PART=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p')
|
||||
|
||||
PART_NUM=${ROOT_PART#mmcblk0p}
|
||||
if [ "$PART_NUM" = "$ROOT_PART" ]; then
|
||||
echo "$THIS: $ROOT_PART is not an SD card. Don't know how to expand" | tee /dev/kmsg
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$PART_NUM" -ne 2 ]; then
|
||||
echo "$THIS: your partition layout is not currently supported by this tool" | tee /dev/kmsg
|
||||
exit 3
|
||||
fi
|
||||
|
||||
LAST_PART_LINE=$(fdisk /dev/mmcblk0 -l | grep '^/' | tail -n 1)
|
||||
set $LAST_PART_LINE
|
||||
LAST_PART=${1#/dev/}
|
||||
PART_START=${2}
|
||||
if [ "$LAST_PART" != "$ROOT_PART" ]; then
|
||||
echo "$THIS: $ROOT_PART is not the last partition. Don't know how to expand" | tee /dev/kmsg
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# Return value will likely be error for fdisk as it fails to reload the
|
||||
# partition table because the root fs is mounted
|
||||
# NOTE: This script only works the genuine fdisk, NOT with the busybox one!!!
|
||||
fdisk /dev/mmcblk0 <<EOF
|
||||
p
|
||||
d
|
||||
$PART_NUM
|
||||
n
|
||||
p
|
||||
$PART_NUM
|
||||
$PART_START
|
||||
|
||||
n
|
||||
p
|
||||
w
|
||||
EOF
|
||||
sync
|
||||
|
||||
# Now set up an init.d script
|
||||
cat <<EOF > /etc/init.d/S02resize2fs &&
|
||||
#!/bin/sh
|
||||
|
||||
THIS=\$(basename \$0)
|
||||
|
||||
case "\$1" in
|
||||
start)
|
||||
sleep 1
|
||||
echo "\$THIS: starting resizing the root filesystem" | tee /dev/kmsg &&
|
||||
resize2fs /dev/$ROOT_PART &&
|
||||
rm /etc/init.d/S02resize2fs
|
||||
if [ \$? -eq 0 ]; then
|
||||
echo "\$THIS: finished resizing the root filesystem" | tee /dev/kmsg
|
||||
else
|
||||
echo "\$THIS: cannot resize the root filesystem, aborting" | tee /dev/kmsg
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: \$0 start" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x /etc/init.d/S02resize2fs
|
||||
echo "$THIS: the root partition has been resized" | tee /dev/kmsg
|
||||
echo "$THIS: the system must reboot to enlarge the root filesystem" | tee /dev/kmsg
|
||||
115
FunKey/board/funkey/rootfs-overlay/usr/sbin/share
Executable file
115
FunKey/board/funkey/rootfs-overlay/usr/sbin/share
Executable file
@@ -0,0 +1,115 @@
|
||||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
|
||||
THIS=$(basename $0)
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
|
||||
if [ ! -f /mass_storage ]; then
|
||||
echo "$THIS: no shared storage file, create it" | tee /dev/kmsg
|
||||
dd if=/dev/zero of=/mass_storage bs=1M seek=1024 count=0 &&
|
||||
cat <<EOF | sfdisk /mass_storage
|
||||
,,C
|
||||
EOF
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: cannot create shared storage file" | tee /dev/kmsg
|
||||
exit 1
|
||||
fi
|
||||
UNIT_LINE=$(fdisk -l /mass_storage | egrep Units)
|
||||
set $UNIT_LINE
|
||||
UNIT=${8}
|
||||
PART_LINE=$(fdisk -l /mass_storage | egrep /mass_storage1)
|
||||
set $PART_LINE
|
||||
let START="${2} * $UNIT"
|
||||
if [ x"$START" = x -o $START -eq 0 ]; then
|
||||
echo "$THIS: cannot find shared storage file start" | tee /dev/kmsg
|
||||
exit 2
|
||||
fi
|
||||
losetup -o$START /dev/loop0 /mass_storage &&
|
||||
mkdosfs /dev/loop0 &&
|
||||
losetup -d /dev/loop0
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: cannot format shared storage file" | tee /dev/kmsg
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
lsmod | egrep -q ^g_mass_storage
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$THIS; shared storage already started" | tee /dev/kmsg
|
||||
exit 4
|
||||
fi
|
||||
echo "$THIS: start shared storage" | tee /dev/kmsg
|
||||
modprobe g_mass_storage file=/mass_storage
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: cannot start shared storage" | tee /dev/kmsg
|
||||
exit 5
|
||||
fi
|
||||
echo "$THIS: shared storage started" | tee /dev/kmsg
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo "$THIS: stop shared storage" | tee /dev/kmsg
|
||||
lsmod | egrep -q ^g_mass_storage
|
||||
if [ $? -eq 0 ]; then
|
||||
modprobe -r g_mass_storage
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: cannot stop shared storage" | tee /dev/kmsg
|
||||
exit 6
|
||||
fi
|
||||
else
|
||||
echo "$THIS: shared storage not started" | tee /dev/kmsg
|
||||
exit 7
|
||||
fi
|
||||
echo "$THIS: shared storage stopped" | tee /dev/kmsg
|
||||
;;
|
||||
|
||||
mount)
|
||||
if [ ! -f /mass_storage ]; then
|
||||
echo "$THIS: no shared storage file" | tee /dev/kmsg
|
||||
exit 8
|
||||
fi
|
||||
echo "$THIS: mounting shared storage" | tee /dev/kmsg
|
||||
UNIT_LINE=$(fdisk -l /mass_storage | egrep Units)
|
||||
set $UNIT_LINE
|
||||
UNIT=${8}
|
||||
PART_LINE=$(fdisk -l /mass_storage | egrep /mass_storage1)
|
||||
set $PART_LINE
|
||||
let START="${2} * $UNIT"
|
||||
if [ x"$START" = x -o $START -eq 0 ]; then
|
||||
echo "$THIS: cannot find shared storage file start" | tee /dev/kmsg
|
||||
exit 9
|
||||
fi
|
||||
losetup -o$START /dev/loop0 /mass_storage &&
|
||||
mount -t vfat /dev/loop0 /mnt/
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: cannot mount shared storage file" | tee /dev/kmsg
|
||||
exit 10
|
||||
fi
|
||||
echo "$THIS: shared storage mounted" | tee /dev/kmsg
|
||||
;;
|
||||
|
||||
umount)
|
||||
losetup -a | egrep -q /mass_storage
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: no mounted shared storage file" | tee /dev/kmsg
|
||||
exit 11
|
||||
fi
|
||||
echo "unmounting shared storage"
|
||||
umount /mnt &
|
||||
losetup -d /dev/loop0
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$THIS: cannot unmount shared storage" | tee /dev/kmsg
|
||||
exit 12
|
||||
fi
|
||||
echo "$THIS: shared storage unmounted" | tee //dev/kmsg
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage ${0} {start|stop|mount|umount}"
|
||||
exit 13
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
182
FunKey/board/funkey/rootfs-overlay/usr/share/alsa/utils.sh
Executable file
182
FunKey/board/funkey/rootfs-overlay/usr/share/alsa/utils.sh
Executable file
@@ -0,0 +1,182 @@
|
||||
# Shell snippet.
|
||||
|
||||
bugout() { echo "${MYNAME}: Programming error" >&2 ; exit 123 ; }
|
||||
|
||||
echo_card_indices()
|
||||
{
|
||||
if [ -f /proc/asound/cards ] ; then
|
||||
sed -n -e's/^[[:space:]]*\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards
|
||||
fi
|
||||
}
|
||||
|
||||
filter_amixer_output()
|
||||
{
|
||||
sed \
|
||||
-e '/Unable to find simple control/d' \
|
||||
-e '/Unknown playback setup/d' \
|
||||
-e '/^$/d'
|
||||
}
|
||||
|
||||
# The following functions try to set many controls.
|
||||
# No card has all the controls and so some of the attempts are bound to fail.
|
||||
# Because of this, the functions can't return useful status values.
|
||||
|
||||
# $1 <control>
|
||||
# $2 <level>
|
||||
# $CARDOPT
|
||||
unmute_and_set_level()
|
||||
{
|
||||
{ [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
|
||||
amixer $CARDOPT -q set "$1" "$2" unmute 2>&1 | filter_amixer_output || :
|
||||
return 0
|
||||
}
|
||||
|
||||
# $1 <control>
|
||||
# $CARDOPT
|
||||
mute_and_zero_level()
|
||||
{
|
||||
{ [ "$1" ] && [ "$CARDOPT" ] ; } || bugout
|
||||
amixer $CARDOPT -q set "$1" "0%" mute 2>&1 | filter_amixer_output || :
|
||||
return 0
|
||||
}
|
||||
|
||||
# $1 <control>
|
||||
# $2 "on" | "off"
|
||||
# $CARDOPT
|
||||
switch_control()
|
||||
{
|
||||
{ [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
|
||||
amixer $CARDOPT -q set "$1" "$2" 2>&1 | filter_amixer_output || :
|
||||
return 0
|
||||
}
|
||||
|
||||
# $1 <card ID>
|
||||
sanify_levels_on_card()
|
||||
{
|
||||
CARDOPT="-c $1"
|
||||
|
||||
unmute_and_set_level "Master" "80%"
|
||||
unmute_and_set_level "Master Mono" "80%" # See Bug#406047
|
||||
unmute_and_set_level "Master Digital" "80%" # E.g., cs4237B
|
||||
unmute_and_set_level "Playback" "80%"
|
||||
unmute_and_set_level "Headphone" "70%"
|
||||
unmute_and_set_level "PCM" "80%"
|
||||
unmute_and_set_level "PCM,1" "80%" # E.g., ess1969
|
||||
unmute_and_set_level "DAC" "80%" # E.g., envy24, cs46xx
|
||||
unmute_and_set_level "DAC,0" "80%" # E.g., envy24
|
||||
unmute_and_set_level "DAC,1" "80%" # E.g., envy24
|
||||
unmute_and_set_level "Synth" "80%"
|
||||
unmute_and_set_level "CD" "80%"
|
||||
|
||||
mute_and_zero_level "Mic"
|
||||
mute_and_zero_level "IEC958" # Ubuntu #19648
|
||||
|
||||
# Intel P4P800-MX (Ubuntu bug #5813)
|
||||
switch_control "Master Playback Switch" on
|
||||
switch_control "Master Surround" on
|
||||
|
||||
# Trident/YMFPCI/emu10k1:
|
||||
unmute_and_set_level "Wave" "80%"
|
||||
unmute_and_set_level "Music" "80%"
|
||||
unmute_and_set_level "AC97" "80%"
|
||||
|
||||
# DRC:
|
||||
unmute_and_set_level "Dynamic Range Compression" "80%"
|
||||
|
||||
# Required for HDA Intel (hda-intel):
|
||||
unmute_and_set_level "Front" "80%"
|
||||
unmute_and_set_level "Master Front" "80%"
|
||||
|
||||
# Required for SB Live 7.1/24-bit (ca0106):
|
||||
unmute_and_set_level "Analog Front" "80%"
|
||||
|
||||
# Required at least for Via 823x hardware on DFI K8M800-MLVF Motherboard with kernels 2.6.10-3/4 (see ubuntu #7286):
|
||||
switch_control "IEC958 Capture Monitor" off
|
||||
|
||||
# Required for hardware allowing toggles for AC97 through IEC958,
|
||||
# valid values are 0, 1, 2, 3. Needs to be set to 0 for PCM1.
|
||||
unmute_and_set_level "IEC958 Playback AC97-SPSA" "0"
|
||||
|
||||
# Required for newer Via hardware (see Ubuntu #31784)
|
||||
unmute_and_set_level "VIA DXS,0" "80%"
|
||||
unmute_and_set_level "VIA DXS,1" "80%"
|
||||
unmute_and_set_level "VIA DXS,2" "80%"
|
||||
unmute_and_set_level "VIA DXS,3" "80%"
|
||||
|
||||
# Required on some notebooks with ICH4:
|
||||
switch_control "Headphone Jack Sense" off
|
||||
switch_control "Line Jack Sense" off
|
||||
|
||||
# Some machines need one or more of these to be on;
|
||||
# others need one or more of these to be off:
|
||||
#
|
||||
# switch_control "External Amplifier" on
|
||||
# switch_control "Audigy Analog/Digital Output Jack" on
|
||||
# switch_control "SB Live Analog/Digital Output Jack" on
|
||||
|
||||
# D1984 -- Thinkpad T61/X61
|
||||
switch_control "Speaker" on
|
||||
switch_control "Headphone" on
|
||||
|
||||
# HDA-Intel w/ "Digital" capture mixer (See Ubuntu #193823)
|
||||
unmute_and_set_level "Digital" "80%"
|
||||
|
||||
# On MacBookPro5,3 and later models (See Bug#597791)
|
||||
unmute_and_set_level "Front Speaker" "80%"
|
||||
# On MacBook5,2 models (See Bug#602973)
|
||||
unmute_and_set_level "LFE" "80%"
|
||||
|
||||
# On Intel 82801H (See Bug#603550)
|
||||
unmute_and_set_level "Speaker" "80%"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# $1 <card ID> | "all"
|
||||
sanify_levels()
|
||||
{
|
||||
TTSDML_RETURNSTATUS=0
|
||||
case "$1" in
|
||||
all)
|
||||
for CARD in $(echo_card_indices) ; do
|
||||
sanify_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
|
||||
done
|
||||
;;
|
||||
*)
|
||||
sanify_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
|
||||
;;
|
||||
esac
|
||||
return $TTSDML_RETURNSTATUS
|
||||
}
|
||||
|
||||
# $1 <card ID>
|
||||
preinit_levels_on_card()
|
||||
{
|
||||
CARDOPT="-c $1"
|
||||
|
||||
# Silly dance to activate internal speakers by default on PowerMac
|
||||
# Snapper and Tumbler
|
||||
id=$(cat /proc/asound/card$1/id 2>/dev/null)
|
||||
if [ "$id" = "Snapper" -o "$id" = "Tumbler" ]; then
|
||||
switch_control "Auto Mute" off
|
||||
switch_control "PC Speaker" off
|
||||
switch_control "Auto Mute" on
|
||||
fi
|
||||
}
|
||||
|
||||
# $1 <card ID> | "all"
|
||||
preinit_levels()
|
||||
{
|
||||
TTSDML_RETURNSTATUS=0
|
||||
case "$1" in
|
||||
all)
|
||||
for CARD in $(echo_card_indices) ; do
|
||||
preinit_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
|
||||
done
|
||||
;;
|
||||
*)
|
||||
preinit_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
|
||||
;;
|
||||
esac
|
||||
return $TTSDML_RETURNSTATUS
|
||||
}
|
||||
16
FunKey/board/funkey/uboot.config
Normal file
16
FunKey/board/funkey/uboot.config
Normal file
@@ -0,0 +1,16 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_SUNXI=y
|
||||
# CONFIG_ARMV7_NONSEC is not set
|
||||
CONFIG_IDENT_STRING=" FunKey"
|
||||
CONFIG_MACH_SUN8I_V3S=y
|
||||
CONFIG_DRAM_CLK=360
|
||||
CONFIG_DRAM_ZQ=14779
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-funkey"
|
||||
CONFIG_BOOTDELAY=0
|
||||
# CONFIG_CONSOLE_MUX is not set
|
||||
CONFIG_SPL=y
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
# CONFIG_NETDEVICES is not set
|
||||
CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
0
FunKey/board/funkey/users_table.txt
Normal file
0
FunKey/board/funkey/users_table.txt
Normal file
Reference in New Issue
Block a user