Skip to content

Commit ec62122

Browse files
committed
fix sound issue;add google policy support
1 parent 8341c21 commit ec62122

24 files changed

+7211
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
options snd_bcm2835 force_bulk enable_headphones enable_hdmi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2018 The Fyde OS Authors. All rights reserved.
2+
# Distributed under the terms of the BSD
3+
4+
EAPI="5"
5+
6+
DESCRIPTION="empty project"
7+
HOMEPAGE="http://fydeos.com"
8+
9+
LICENSE="BSD-Google"
10+
SLOT="0"
11+
KEYWORDS="*"
12+
IUSE=""
13+
14+
RDEPEND=""
15+
16+
DEPEND="${RDEPEND}"
17+
18+
S=$WORKDIR
19+
20+
src_install() {
21+
insinto /etc/modprobe.d
22+
doins ${FILESDIR}/snd_bcm2835.conf
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
description "Check serial number for compability"
2+
author "yang@fydeos.io"
3+
4+
start on starting system-services
5+
exec /bin/sh /usr/share/cros/init/check_serial_number.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/sh
2+
OEM_PATH=/usr/share/oem
3+
LICENCE=${OEM_PATH}/.oem_licence
4+
NET_NODE=/sys/class/net
5+
LAN_MAC_NODE=$NET_NODE/eth0/address
6+
WLAN_MAC_NODE=$NET_NODE/wlan0/address
7+
8+
[ ! -f ${LICENCE} ] && exit 0
9+
10+
get_system_mac() {
11+
local mac
12+
13+
# On the first boot, the upstart service machine-info which will call this script starts so early
14+
# that the NIC drivers may not even loaded, so it failed to get a mac address. This is to workaround
15+
# that issue, by keep trying for about 1min until get one. This does not impact subsequential boots
16+
# as the mac is stored.
17+
for i in $(seq 20); do
18+
if [ -e $LAN_MAC_NODE ]; then
19+
mac=$(cat $LAN_MAC_NODE)
20+
elif [ -e $WLAN_MAC_NODE ]; then
21+
mac=$(cat $WLAN_MAC_NODE)
22+
else
23+
mac=$(ifconfig -a | awk '/ether/ {print $2;exit}')
24+
fi
25+
26+
if [ -n "$mac" ]; then
27+
echo $mac
28+
break
29+
fi
30+
31+
[ -n "$UPSTART_JOB" ] && logger -t "$UPSTART_JOB" "Cannot get mac, maybe NIC driver is not ready yet, waiting to retry"
32+
sleep 1s
33+
done
34+
}
35+
36+
is_booting_from_usb() {
37+
[ -n "$(udevadm info $(rootdev -d) | grep ID_BUS |grep usb)" ]
38+
}
39+
40+
remount_oem_writable() {
41+
mount -o remount,rw "$OEM_PATH"
42+
}
43+
44+
remount_oem_readonly() {
45+
mount -o remount,ro "$OEM_PATH"
46+
}
47+
48+
count_chars() {
49+
printf $1 | wc -c
50+
}
51+
52+
update_serial_number() {
53+
local serial=$1
54+
vpd -i RO_VPD \
55+
-p $(count_chars $serial) -s "serial_number=${serial}"
56+
dump_vpd_log --force
57+
}
58+
59+
check_serial_number() {
60+
local serial=$(vpd -i RO_VPD -g serial_number 2>/dev/null)
61+
local mac_serial=$(get_system_mac | sed "s/://g")
62+
if [ -z "$mac_serial" ]; then
63+
exit 1
64+
fi
65+
if [ "$serial" != "$mac_serial" ]; then
66+
if is_booting_from_usb; then
67+
update_serial_number $mac_serial
68+
elif [ -z "$serial" ]; then
69+
update_serial_number $mac_serial
70+
fi
71+
fi
72+
}
73+
74+
remount_oem_writable
75+
check_serial_number
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/util/dump_vpd_log b/util/dump_vpd_log
2+
index f751015..1351028 100755
3+
--- a/util/dump_vpd_log
4+
+++ b/util/dump_vpd_log
5+
@@ -84,11 +84,13 @@ atomic_move() {
6+
}
7+
8+
flash_partial() {
9+
- flashrom -p host -i FMAP -i RO_VPD -i RW_VPD -r "$@"
10+
+ # flashrom -p host -i FMAP -i RO_VPD -i RW_VPD -r "$@"
11+
+ cp /usr/share/oem/.oem_licence $1
12+
}
13+
14+
flash_whole() {
15+
- flashrom -p host -r "$@"
16+
+ cp /usr/share/oem/.oem_licence $1
17+
+ # flashrom -p host -r "$@"
18+
}
19+
20+
generate_cache_file() {
Binary file not shown.
34.4 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/vpd.c b/vpd.c
2+
index 1adac95..41c7710 100644
3+
--- a/vpd.c
4+
+++ b/vpd.c
5+
@@ -942,6 +942,7 @@ int main(int argc, char *argv[]) {
6+
int option_index = 0;
7+
vpd_err_t retval = VPD_OK;
8+
const char *optstring = "hf:E:s:S:p:i:lOg:d:0";
9+
+ char *def_filename = "/usr/share/oem/.oem_licence";
10+
static struct option long_options[] = {
11+
{"help", 0, 0, 'h'},
12+
{"file", 0, 0, 'f'},
13+
@@ -959,7 +960,7 @@ int main(int argc, char *argv[]) {
14+
{"delete", 0, 0, 'd'},
15+
{0, 0, 0, 0}
16+
};
17+
- char *filename = NULL;
18+
+ char *filename = def_filename;
19+
const char *load_file = NULL;
20+
const char *save_file = NULL;
21+
const char *tmp_part_file = NULL;
22+
@@ -1240,7 +1241,7 @@ int main(int argc, char *argv[]) {
23+
24+
teardown:
25+
if (spd_data) free(spd_data);
26+
- if (filename) free(filename);
27+
+ if (filename && filename != def_filename) free(filename);
28+
if (key_to_export) free(key_to_export);
29+
destroyContainer(&file);
30+
destroyContainer(&set_argument);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI="4"
5+
CROS_WORKON_COMMIT="fabe3f4cc2204755d26ff611a1631fd51c8b0fa6"
6+
CROS_WORKON_TREE="e5239bf292c078381e7d19833a31752f0f72f5df"
7+
CROS_WORKON_PROJECT="chromiumos/platform/vpd"
8+
9+
inherit cros-workon systemd
10+
11+
DESCRIPTION="ChromeOS vital product data utilities"
12+
HOMEPAGE="http://www.chromium.org/"
13+
SRC_URI=""
14+
15+
LICENSE="BSD-Google"
16+
SLOT="0"
17+
KEYWORDS="*"
18+
IUSE="static systemd"
19+
20+
# util-linux is for libuuid.
21+
DEPEND="sys-apps/util-linux"
22+
# shflags for dump_vpd_log.
23+
# chromeos-activate-date for ActivateDate upstart and script.
24+
RDEPEND="
25+
sys-apps/flashrom
26+
dev-util/shflags
27+
virtual/chromeos-activate-date
28+
!chromeos-base/vpd-info-append
29+
"
30+
31+
FYDEOS_DEFAULT_LOCALE="en-US"
32+
FYDEOS_DEFAULT_TIMEZONE="US/Pacific"
33+
FYDEOS_DEFAULT_REGION="en-US"
34+
VPD_TEMPLATE="oem_licence.tmp"
35+
36+
src_prepare() {
37+
default
38+
epatch ${FILESDIR}/*.patch
39+
cp ${FILESDIR}/${VPD_TEMPLATE} ${S}
40+
}
41+
42+
src_configure() {
43+
cros-workon_src_configure
44+
}
45+
46+
count_chars() {
47+
printf $1 | wc -c
48+
}
49+
50+
src_compile() {
51+
tc-export CC
52+
use static && append-ldflags -static
53+
emake all
54+
local locale=${FYDEOS_LOCALE:-`echo $FYDEOS_DEFAULT_LOCALE`}
55+
local timezone=${FYDEOS_TIMEZONE:-`echo $FYDEOS_DEFAULT_TIMEZONE`}
56+
local region=${FYDEOS_REGION:-`echo $FYDEOS_DEFAULT_REGION`}
57+
${FILESDIR}/vpd -i RO_VPD -f ${VPD_TEMPLATE} \
58+
-p $(count_chars $locale) -s "initial_locale=${locale}" \
59+
-p $(count_chars $timezone) -s "initial_timezone=${timezone}" \
60+
-p $(count_chars $region) -s "region=${region}"
61+
}
62+
63+
src_install() {
64+
# This target list should be architecture specific
65+
# (no ACPI stuff on ARM for instance)
66+
dosbin vpd vpd_s
67+
dosbin util/check_rw_vpd util/dump_vpd_log util/update_rw_vpd
68+
dosbin util/vpd_get_value
69+
70+
# install the init script
71+
if use systemd; then
72+
systemd_dounit init/vpd-log.service
73+
systemd_enable_service boot-services.target vpd-log.service
74+
else
75+
insinto /etc/init
76+
doins init/check-rw-vpd.conf
77+
doins init/vpd-log.conf
78+
doins ${FILESDIR}/check_serial_number.conf
79+
fi
80+
insinto /usr/share/oem
81+
newins ${VPD_TEMPLATE} .oem_licence
82+
insinto /usr/share/cros/init
83+
doins ${FILESDIR}/check_serial_number.sh
84+
}
85+
86+
src_test() {
87+
if ! use x86 && ! use amd64; then
88+
ewarn "Skipping unittests for non-x86 arches"
89+
return
90+
fi
91+
emake test
92+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI="4"
5+
CROS_WORKON_PROJECT="chromiumos/platform/vpd"
6+
7+
inherit cros-workon systemd
8+
9+
DESCRIPTION="ChromeOS vital product data utilities"
10+
HOMEPAGE="http://www.chromium.org/"
11+
SRC_URI=""
12+
13+
LICENSE="BSD-Google"
14+
SLOT="0"
15+
KEYWORDS="~*"
16+
IUSE="static systemd"
17+
18+
# util-linux is for libuuid.
19+
DEPEND="sys-apps/util-linux"
20+
# shflags for dump_vpd_log.
21+
# chromeos-activate-date for ActivateDate upstart and script.
22+
RDEPEND="
23+
sys-apps/flashrom
24+
dev-util/shflags
25+
virtual/chromeos-activate-date
26+
"
27+
28+
src_configure() {
29+
cros-workon_src_configure
30+
}
31+
32+
src_compile() {
33+
tc-export CC
34+
use static && append-ldflags -static
35+
emake all
36+
}
37+
38+
src_install() {
39+
# This target list should be architecture specific
40+
# (no ACPI stuff on ARM for instance)
41+
dosbin vpd vpd_s
42+
dosbin util/check_rw_vpd util/dump_vpd_log util/update_rw_vpd
43+
dosbin util/vpd_get_value
44+
45+
# install the init script
46+
if use systemd; then
47+
systemd_dounit init/vpd-log.service
48+
systemd_enable_service boot-services.target vpd-log.service
49+
else
50+
insinto /etc/init
51+
doins init/check-rw-vpd.conf
52+
doins init/vpd-log.conf
53+
fi
54+
}
55+
56+
src_test() {
57+
if ! use x86 && ! use amd64; then
58+
ewarn "Skipping unittests for non-x86 arches"
59+
return
60+
fi
61+
emake test
62+
}

0 commit comments

Comments
 (0)