mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-08-22 11:29:20 +00:00
Compare commits
223 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2ac3fceaf4 | ||
![]() |
babf11d710 | ||
![]() |
47a648392a | ||
![]() |
0b251bb950 | ||
![]() |
3df7743633 | ||
![]() |
a355da2075 | ||
![]() |
66405f102a | ||
![]() |
91532037bb | ||
![]() |
55bbddad4f | ||
![]() |
444f65ca94 | ||
![]() |
74af855056 | ||
![]() |
1291848041 | ||
![]() |
885f0a82ab | ||
![]() |
eec6dfb28d | ||
![]() |
f169f78bb0 | ||
![]() |
71e580175e | ||
![]() |
78cdaab597 | ||
![]() |
b9e66fbfd0 | ||
![]() |
9dfbdd9d12 | ||
![]() |
b28dd8c4c4 | ||
![]() |
23039ceea7 | ||
![]() |
180c9ada3f | ||
![]() |
6047770d7f | ||
![]() |
0dc9c65d3c | ||
![]() |
f612d42fb3 | ||
![]() |
c9e2b50406 | ||
![]() |
7edde96735 | ||
![]() |
59851f7a51 | ||
![]() |
8fd7f26d74 | ||
![]() |
a2ff594a75 | ||
![]() |
f459a1174d | ||
![]() |
a5cdc318d4 | ||
![]() |
9e00205ceb | ||
![]() |
3f161bc7d1 | ||
![]() |
bb0086addf | ||
![]() |
1bd9245219 | ||
![]() |
fb7a9c4196 | ||
![]() |
8f69cd7fd1 | ||
![]() |
67ddfe2563 | ||
![]() |
ce8b777d74 | ||
![]() |
82f36004f5 | ||
![]() |
1b6b40ebe7 | ||
![]() |
998d0e37fe | ||
![]() |
a4a3912b21 | ||
![]() |
5d58a25b62 | ||
![]() |
cf546d6f76 | ||
![]() |
62a30ac509 | ||
![]() |
ba73a8c3d7 | ||
![]() |
0fdf920b89 | ||
![]() |
f27c429be2 | ||
![]() |
e4d00de474 | ||
![]() |
65789af595 | ||
![]() |
39b1c6de4e | ||
![]() |
2916a1c247 | ||
![]() |
2e6b38a0e1 | ||
![]() |
5d164b12d1 | ||
![]() |
e3bbe2003f | ||
![]() |
93ac046349 | ||
![]() |
d615f8c71e | ||
![]() |
3977f1f039 | ||
![]() |
d9e46d6dbb | ||
![]() |
b23b54bed0 | ||
![]() |
5eb7ccb761 | ||
![]() |
c6d4e2788e | ||
![]() |
14ca2ac75e | ||
![]() |
4fb27c2ca8 | ||
![]() |
c7018054b4 | ||
![]() |
7f9116b7f8 | ||
![]() |
e97b1231dc | ||
![]() |
1a7dc0ca1f | ||
![]() |
d3a43a4ca4 | ||
![]() |
3c2f014acb | ||
![]() |
1b6cfbf940 | ||
![]() |
cdee2c5838 | ||
![]() |
7e7612ffeb | ||
![]() |
832b70bab1 | ||
![]() |
0c08acd2c3 | ||
![]() |
1467cc5f64 | ||
![]() |
d44d93e4a1 | ||
![]() |
2fb1663a35 | ||
![]() |
a7617340e9 | ||
![]() |
77e2b92972 | ||
![]() |
fd31ce14ea | ||
![]() |
598e06de5d | ||
![]() |
d83602c6d3 | ||
![]() |
55b3446bd9 | ||
![]() |
f292ba02e2 | ||
![]() |
42baa80900 | ||
![]() |
ba86720163 | ||
![]() |
0452965fb0 | ||
![]() |
d6fa83a0d3 | ||
![]() |
edba18f6c4 | ||
![]() |
50a0062ee6 | ||
![]() |
26c383484e | ||
![]() |
d8baa98ae2 | ||
![]() |
ccca13d3ca | ||
![]() |
7a19b892a5 | ||
![]() |
66fc7d7e2a | ||
![]() |
9cc45f65ea | ||
![]() |
c2527a2ae1 | ||
![]() |
a32974e1a7 | ||
![]() |
d51a0d3cec | ||
![]() |
13c4bb56c0 | ||
![]() |
327e9a07c9 | ||
![]() |
568499072f | ||
![]() |
bc7c109163 | ||
![]() |
b0bc71a835 | ||
![]() |
a80311a285 | ||
![]() |
6de9da2560 | ||
![]() |
5d5bc36892 | ||
![]() |
77a28bd1df | ||
![]() |
038bfd9073 | ||
![]() |
eb2bdf85e9 | ||
![]() |
d148ad2b50 | ||
![]() |
63a05a5a1e | ||
![]() |
150be514e4 | ||
![]() |
45cbd1d9b7 | ||
![]() |
00171ae44c | ||
![]() |
777432913e | ||
![]() |
d57b6be01e | ||
![]() |
1f8ed07c42 | ||
![]() |
3ef8b07676 | ||
![]() |
ea286d9dad | ||
![]() |
4308c45391 | ||
![]() |
33d8b538ad | ||
![]() |
245c0d0b03 | ||
![]() |
c20841ac1e | ||
![]() |
0555e89ad0 | ||
![]() |
203885a7d8 | ||
![]() |
7298ffc13f | ||
![]() |
6c7b6fdebe | ||
![]() |
87a6c84025 | ||
![]() |
94c6930acd | ||
![]() |
a70ed7e81e | ||
![]() |
62d7794a6c | ||
![]() |
8490b3bf70 | ||
![]() |
abe018d4aa | ||
![]() |
0e9e8ca2a6 | ||
![]() |
27bc7306ff | ||
![]() |
6c2d5b5006 | ||
![]() |
d847b9803a | ||
![]() |
89533755bc | ||
![]() |
6d77355c1c | ||
![]() |
26f0b5a9b7 | ||
![]() |
542f69efa4 | ||
![]() |
ae588b762a | ||
![]() |
6135ecdcc7 | ||
![]() |
22b63ae779 | ||
![]() |
bd7474fc97 | ||
![]() |
5ed9057728 | ||
![]() |
682d59434e | ||
![]() |
2c725d90f6 | ||
![]() |
8dbc03cc76 | ||
![]() |
8aa9869e4f | ||
![]() |
dd96b5019a | ||
![]() |
229cc7ebbb | ||
![]() |
ca71774e7d | ||
![]() |
12597f197f | ||
![]() |
2c266c53f1 | ||
![]() |
d7338e7570 | ||
![]() |
301bf4a377 | ||
![]() |
2ea9eccf79 | ||
![]() |
1a5a2c4e28 | ||
![]() |
7a94a2ef71 | ||
![]() |
ddd528b8e7 | ||
![]() |
9fa953745a | ||
![]() |
fce19b7846 | ||
![]() |
65f35c65b2 | ||
![]() |
67315f86d4 | ||
![]() |
4e44b101f3 | ||
![]() |
21fd9e64c8 | ||
![]() |
9dab6908c9 | ||
![]() |
a277854add | ||
![]() |
8854dd4ddb | ||
![]() |
478538eac0 | ||
![]() |
e1b11540a1 | ||
![]() |
82c3e2a859 | ||
![]() |
9272065664 | ||
![]() |
77c28be3cd | ||
![]() |
85d7c23a5f | ||
![]() |
4f53947596 | ||
![]() |
dd76a1dda4 | ||
![]() |
c9efdea83b | ||
![]() |
56ae6e1cb7 | ||
![]() |
2254260dad | ||
![]() |
3252676fde | ||
![]() |
5dc234d14f | ||
![]() |
3e970f1e9a | ||
![]() |
ea217fe5bd | ||
![]() |
bfe9943068 | ||
![]() |
7166a83998 | ||
![]() |
7a69678505 | ||
![]() |
0c9deaeebf | ||
![]() |
de3f2c6420 | ||
![]() |
78d281fce1 | ||
![]() |
7013872665 | ||
![]() |
974812a8af | ||
![]() |
e18c6ef4ce | ||
![]() |
889b561ca1 | ||
![]() |
90b618b096 | ||
![]() |
5ee9cef8c8 | ||
![]() |
040af8fd9b | ||
![]() |
94bf84a807 | ||
![]() |
b564fb3fa7 | ||
![]() |
2d6b731b9a | ||
![]() |
adbd449494 | ||
![]() |
cff5c81cf0 | ||
![]() |
aafa022800 | ||
![]() |
ccf92bc87f | ||
![]() |
a45cab1756 | ||
![]() |
6c11146d9c | ||
![]() |
e144c2bc96 | ||
![]() |
6c7c972c5d | ||
![]() |
1953c2afdb | ||
![]() |
6b062f3c75 | ||
![]() |
c085ff2b10 | ||
![]() |
454d764676 | ||
![]() |
0e3a2d016d | ||
![]() |
8226323a1b | ||
![]() |
122dd1c288 | ||
![]() |
fe1978f98f | ||
![]() |
541afd452b | ||
![]() |
b5795a0277 |
16
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
16
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -23,6 +23,7 @@ body:
|
||||
required: true
|
||||
attributes:
|
||||
label: What operating system image do you use?
|
||||
default: 0
|
||||
options:
|
||||
- generic-x86-64 (Generic UEFI capable x86-64 systems)
|
||||
- generic-aarch64 (Generic UEFI capable aarch64 systems)
|
||||
@@ -59,10 +60,21 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Did you upgrade the Operating System.
|
||||
label: Did the problem occur after upgrading the Operating System?
|
||||
default: 0
|
||||
options:
|
||||
- "Yes"
|
||||
- "No"
|
||||
- "Yes"
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Hardware details
|
||||
description: >
|
||||
Provide details about the hardware used for your install.
|
||||
This is especially important for bare-metal x86 installations.
|
||||
If you have any USB devices attached, please list them here.
|
||||
For VMs, include the hypervisor type and version.
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
|
8
.github/release-drafter.yml
vendored
8
.github/release-drafter.yml
vendored
@@ -4,8 +4,6 @@ version-template: "$MAJOR.$MINOR"
|
||||
categories:
|
||||
- title: 'Home Assistant Operating System'
|
||||
label: 'os'
|
||||
- title: 'Build System'
|
||||
label: 'build'
|
||||
- title: 'Raspberry Pi'
|
||||
label: 'board/raspberrypi'
|
||||
- title: 'Home Assistant Yellow'
|
||||
@@ -24,6 +22,12 @@ categories:
|
||||
label: 'board/khadas'
|
||||
- title: 'Generic aarch64'
|
||||
label: 'board/generic-aarch64'
|
||||
- title: 'Documentation'
|
||||
label: 'documentation'
|
||||
- title: 'Build System'
|
||||
label: 'build'
|
||||
- title: 'Dependencies'
|
||||
label: 'dependencies'
|
||||
filter-by-commitish: true
|
||||
template: |
|
||||
## Changes
|
||||
|
25
.github/workflows/artifacts-index.yaml
vendored
25
.github/workflows/artifacts-index.yaml
vendored
@@ -83,11 +83,20 @@ jobs:
|
||||
|
||||
- name: Flush CloudFlare cache
|
||||
run: |
|
||||
curl --silent --show-error --fail -X POST \
|
||||
"https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache" \
|
||||
-H "Authorization: Bearer ${{ secrets.CF_PURGE_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"files": [
|
||||
"https://os-artifacts.home-assistant.io/index.html",
|
||||
"https://os-artifacts.home-assistant.io/index.json"
|
||||
] }'
|
||||
# Create purge list of all artifacts
|
||||
jq -r '. | map("https://os-artifacts.home-assistant.io/${{ inputs.version }}/" + .) | join("\n")' < "${{ inputs.version }}.json" > purge_list
|
||||
# Add indexes to purge list too
|
||||
echo "https://os-artifacts.home-assistant.io/indexes/${{ inputs.version }}.json" >> purge_list
|
||||
echo "https://os-artifacts.home-assistant.io/index.html" >> purge_list
|
||||
echo "https://os-artifacts.home-assistant.io/index.json" >> purge_list
|
||||
# Split to chunks of 30 files (limit of CF API)
|
||||
split -d -l30 purge_list purge_list_chunked
|
||||
# Convert chunked lists to JSON arrays and call CF purge API
|
||||
for f in purge_list_chunked*; do
|
||||
files=$(jq -R -s 'split("\n")[:-1]' < "$f")
|
||||
curl --silent --show-error --fail -X POST \
|
||||
"https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache" \
|
||||
-H "Authorization: Bearer ${{ secrets.CF_PURGE_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "{\"files\": ${files}}"
|
||||
done
|
||||
|
8
.github/workflows/build.yaml
vendored
8
.github/workflows/build.yaml
vendored
@@ -136,15 +136,15 @@ jobs:
|
||||
}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.1.0
|
||||
uses: docker/setup-buildx-action@v3.7.1
|
||||
- name: Log in to the GitHub container registry
|
||||
uses: docker/login-action@v3.0.0
|
||||
uses: docker/login-action@v3.3.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v5.1.0
|
||||
uses: docker/build-push-action@v6.10.0
|
||||
id: build_haos_builder
|
||||
with:
|
||||
context: .
|
||||
@@ -316,7 +316,7 @@ jobs:
|
||||
echo "## Partitions" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| File | Size (bytes) | Size (formatted) |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "|:-|:-|:-|" >> $GITHUB_STEP_SUMMARY
|
||||
for f in boot.vfat kernel.img rootfs.squashfs overlay.ext4 data.ext4; do
|
||||
for f in boot.vfat kernel.img rootfs.erofs overlay.ext4 data.ext4; do
|
||||
echo "| ${f} | $(du -b output/images/$f | cut -f1) | $(du -bh output/images/$f | cut -f1) |" >> $GITHUB_STEP_SUMMARY
|
||||
done
|
||||
|
||||
|
8
.github/workflows/pr-checks.yml
vendored
8
.github/workflows/pr-checks.yml
vendored
@@ -8,6 +8,12 @@ jobs:
|
||||
linters:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Install additional dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install \
|
||||
python3-flake8
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -25,4 +31,4 @@ jobs:
|
||||
|
||||
- name: Check buildroot-external packages
|
||||
run: |
|
||||
buildroot/utils/check-package --exclude PackageHeader --br2-external buildroot-external/package/*/*
|
||||
buildroot/utils/check-package --exclude PackageHeader --exclude Upstream --br2-external buildroot-external/package/*/*
|
||||
|
11
.github/workflows/test.yaml
vendored
11
.github/workflows/test.yaml
vendored
@@ -28,9 +28,6 @@ jobs:
|
||||
test:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
|
||||
env:
|
||||
NO_KVM: 1
|
||||
|
||||
name: Test in QEMU
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
@@ -69,6 +66,12 @@ jobs:
|
||||
xz -dc haos*.qcow2.xz > tests/haos.qcow2
|
||||
rm haos*.qcow2.xz
|
||||
|
||||
- name: Enable KVM group perms
|
||||
run: |
|
||||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
./tests/run_tests.sh
|
||||
@@ -90,7 +93,7 @@ jobs:
|
||||
tests/junit_reports/*.xml
|
||||
|
||||
- name: Publish test report
|
||||
uses: mikepenz/action-junit-report@v4
|
||||
uses: mikepenz/action-junit-report@v5
|
||||
if: always()
|
||||
with:
|
||||
report_paths: 'tests/junit_reports/*.xml'
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,4 +1,4 @@
|
||||
[submodule "buildroot"]
|
||||
path = buildroot
|
||||
url = https://github.com/home-assistant/buildroot.git
|
||||
branch = 2022.02.x-haos
|
||||
branch = 2024.02.x-haos
|
||||
|
@@ -4,6 +4,10 @@
|
||||
|
||||
The following boards/devices are supported:
|
||||
|
||||
- Nabu Casa
|
||||
- [Home Assistant Green](https://www.home-assistant.io/green/)
|
||||
- [Home Assistant Yellow](https://www.home-assistant.io/yellow/) (based custom carrier board and powered by a Raspberry Pi 4 Compute Module)
|
||||
- [Home Assistant Blue](https://www.home-assistant.io/blue/) (based on ODROID-N2+)
|
||||
- Raspberry Pi
|
||||
- Pi 5 ([4 GB](https://www.raspberrypi.com/products/raspberry-pi-5/?variant=raspberry-pi-5-4gb) and [8 GB](https://www.raspberrypi.com/products/raspberry-pi-5/?variant=raspberry-pi-5-8gb) model) 64-bit
|
||||
- Pi 4 Model B ([1 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-1gb), [2 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-2gb), [4 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-4gb) and [8 GB](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-8gb) model) 32-bit or 64-bit (recommended)
|
||||
@@ -39,6 +43,8 @@ Notes:
|
||||
|
||||
|Board|Build|Config|Docs|
|
||||
|-----|----|------|----|
|
||||
|Green |`make green` |[green](../../buildroot-external/configs/green_defconfig)|-|
|
||||
|Yellow |`make yellow` |[yellow](../../buildroot-external/configs/yellow_defconfig)|-|
|
||||
|Pi5 64-bit |`make rpi5_64` |[rpi5_64](../../buildroot-external/configs/rpi5_64_defconfig)|[raspberrypi](./raspberrypi/)|
|
||||
|Pi4B 64-bit |`make rpi4_64` |[rpi4_64](../../buildroot-external/configs/rpi4_64_defconfig)|[raspberrypi](./raspberrypi/)|
|
||||
|Pi4B 32-bit |`make rpi4` |[rpi4](../../buildroot-external/configs/rpi4_defconfig)|[raspberrypi](./raspberrypi/)|
|
||||
|
@@ -8,18 +8,18 @@ SD-card boot is supported via on-board bootloader (SPL) or recovery button.
|
||||
|
||||
## eMMC
|
||||
|
||||
eMMC boot via on-board bootloader requires the latest version of Petitboot
|
||||
(spiboot 20230328). To install the latest version download the SPI boot image
|
||||
eMMC boot via on-board bootloader requires a newer version of Petitboot
|
||||
(spiboot 20230328 or later). To install the latest version download the SPI boot image
|
||||
from [linuxfactory.or.kr][1] as follows:
|
||||
|
||||
1. Download `spiupdate_odroidm1_20220304.img.xz`
|
||||
1. Download `spiupdate_odroidm1_20240415.img.xz`
|
||||
2. Use balenaEtcher or another tool to flash the updater onto an SD card
|
||||
3. Download `spiboot-20230328.img`
|
||||
4. Rename the `spiboot-20230328.img` file to`spiboot.img`.
|
||||
3. Download `spiboot-20240109.img`
|
||||
4. Rename the `spiboot-20240109.img` file to`spiboot.img`.
|
||||
5. Paste the `spiboot.img` file onto the FAT partition of that same SD card.
|
||||
6. Plug-in that SD card to your ODROID-M1. Petitboot will update itself, you can verify the progress on the HDMI output.
|
||||
7. If you see the version 20230328 in the top right corner, the installation was successful.
|
||||
* If you see any other version there, the installation failed.
|
||||
7. If you see the version 20240109 in the top left corner, the installation was successful.\
|
||||
If you see any other version there, the installation failed.
|
||||
|
||||
Once Petitboot is updated you can flash Home Assistant OS directly onto an eMMC.
|
||||
|
||||
|
@@ -10,8 +10,8 @@ ODROID-M1S can boot HAOS directly from an SD card, as it has higher priority tha
|
||||
|
||||
HAOS can be installed directly to the eMMC using a special boot image, to do that:
|
||||
|
||||
1. Download [`ODROID-M1S_EMMC2UMS.img`][1]
|
||||
2. Use balenaEtcher or another tool to flash the UMS utility onto an SD card.
|
||||
1. Download the _UMS Utility_ image: [`ODROID-M1S_EMMC2UMS.img`][1]. The _UMS Utility_ is a special image that switches ODROID-M1S to USB Mass Storage device.
|
||||
2. Use balenaEtcher or another tool to flash the _UMS utility_ onto an SD card.
|
||||
3. Plug-in that SD card to your ODROID-M1S and boot it. Connect your PC to the Micro USB OTG port.
|
||||
4. The eMMC will show as a drive on your PC and you can directly flash the HAOS image with balenaEther.
|
||||
|
||||
|
@@ -1,26 +1,24 @@
|
||||
|
||||
# Kernel Version
|
||||
|
||||
Default Kernel tree: 6.1
|
||||
|
||||
| Board | Version |
|
||||
|-------|---------|
|
||||
| Open Virtual Appliance | 6.6.20 |
|
||||
| Raspberry Pi | 6.1.73 |
|
||||
| Raspberry Pi 0-W | 6.1.73 |
|
||||
| Raspberry Pi 2 | 6.1.73 |
|
||||
| Raspberry Pi 3 | 6.1.73 |
|
||||
| Raspberry Pi 4 | 6.1.73 |
|
||||
| Raspberry Pi 5 | 6.1.73 |
|
||||
| Home Assistant Yellow | 6.1.73 |
|
||||
| Home Assistant Green | 6.6.20 |
|
||||
| Tinker Board | 6.6.20 |
|
||||
| ODROID-C2 | 6.6.20 |
|
||||
| ODROID-C4 | 6.6.20 |
|
||||
| ODROID-M1 | 6.6.20 |
|
||||
| ODROID-M1S | 6.6.20 |
|
||||
| ODROID-N2 | 6.6.20 |
|
||||
| ODROID-XU4 | 6.6.20 |
|
||||
| Generic aarch64 | 6.6.20 |
|
||||
| Generic x86-64 | 6.6.20 |
|
||||
| Khadas VIM3 | 6.6.20 |
|
||||
| Open Virtual Appliance | 6.6.63 |
|
||||
| Raspberry Pi | 6.6.51 |
|
||||
| Raspberry Pi 0-W | 6.6.51 |
|
||||
| Raspberry Pi 2 | 6.6.51 |
|
||||
| Raspberry Pi 3 | 6.6.51 |
|
||||
| Raspberry Pi 4 | 6.6.51 |
|
||||
| Raspberry Pi 5 | 6.6.51 |
|
||||
| Home Assistant Yellow | 6.6.51 |
|
||||
| Home Assistant Green | 6.6.63 |
|
||||
| Tinker Board | 6.6.63 |
|
||||
| ODROID-C2 | 6.6.63 |
|
||||
| ODROID-C4 | 6.6.63 |
|
||||
| ODROID-M1 | 6.6.63 |
|
||||
| ODROID-M1S | 6.6.63 |
|
||||
| ODROID-N2 | 6.6.63 |
|
||||
| ODROID-XU4 | 6.6.63 |
|
||||
| Generic aarch64 | 6.6.63 |
|
||||
| Generic x86-64 | 6.6.63 |
|
||||
| Khadas VIM3 | 6.6.63 |
|
||||
|
@@ -4,6 +4,8 @@ Home Assistant Operating System (formerly HassOS) is a Linux based operating sys
|
||||
|
||||
Home Assistant Operating System uses Docker as its container engine. By default it deploys the Home Assistant Supervisor as a container. Home Assistant Supervisor in turn uses the Docker container engine to control Home Assistant Core and Add-Ons in separate containers. Home Assistant Operating System is **not** based on a regular Linux distribution like Ubuntu. It is built using [Buildroot](https://buildroot.org/) and it is optimized to run Home Assistant. It targets single board compute (SBC) devices like the Raspberry Pi or ODROID but also supports x86-64 systems with UEFI.
|
||||
|
||||
[](https://www.openhomefoundation.org/)
|
||||
|
||||
## Features
|
||||
|
||||
- Lightweight and memory-efficient
|
||||
@@ -14,6 +16,7 @@ Home Assistant Operating System uses Docker as its container engine. By default
|
||||
|
||||
## Supported hardware
|
||||
|
||||
- Nabu Casa
|
||||
- Raspberry Pi
|
||||
- Hardkernel ODROID
|
||||
- Asus Tinker Board
|
||||
@@ -37,7 +40,7 @@ The Home Assistant Operating System documentation can be found on the [Home Assi
|
||||
### Components
|
||||
|
||||
- **Bootloader:**
|
||||
- [Barebox](https://barebox.org/) for devices that support UEFI
|
||||
- [GRUB](https://www.gnu.org/software/grub/) for devices that support UEFI
|
||||
- [U-Boot](https://www.denx.de/wiki/U-Boot) for devices that don't support UEFI
|
||||
- **Operating System:**
|
||||
- [Buildroot](https://buildroot.org/) LTS Linux
|
||||
|
Submodule buildroot updated: 15dc3b6e0c...1d7407c66b
@@ -2,6 +2,7 @@ source "$BR2_EXTERNAL_HASSOS_PATH/package/bluetooth-rtl8723/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/eq3_char_loop/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/gasket/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/generic_raw_uart/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/hailo8-firmware/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/hardkernel-boot/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/hassio/Config.in"
|
||||
source "$BR2_EXTERNAL_HASSOS_PATH/package/khadas-boot/Config.in"
|
||||
|
@@ -1 +1 @@
|
||||
console=tty1 console=ttyS0
|
||||
console=ttyS0 console=tty0
|
||||
|
@@ -10,6 +10,9 @@ function hassos_pre_image() {
|
||||
cp "${BOARD_DIR}/grub.cfg" "${EFIPART_DATA}/EFI/BOOT/grub.cfg"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${EFIPART_DATA}/cmdline.txt"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" create
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set ORDER="A B"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set A_OK=1
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set A_TRY=0
|
||||
|
||||
cp -r "${EFIPART_DATA}/"* "${BOOT_DATA}/"
|
||||
}
|
||||
@@ -24,4 +27,3 @@ function hassos_post_image() {
|
||||
|
||||
convert_disk_image_xz
|
||||
}
|
||||
|
||||
|
@@ -55,3 +55,5 @@ CONFIG_HYPERV_VSOCKETS=m
|
||||
CONFIG_PCI_HYPERV=m
|
||||
CONFIG_PCI_HYPERV_INTERFACE=m
|
||||
CONFIG_FB_HYPERV=y
|
||||
|
||||
CONFIG_I6300ESB_WDT=y
|
||||
|
@@ -3,9 +3,9 @@ BOARD_NAME="Generic aarch64"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=grub
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=efi
|
||||
PARTITION_TABLE_TYPE=gpt
|
||||
BOOT_SIZE=32M
|
||||
BOOT_SPL=false
|
||||
DISK_SIZE=6
|
||||
DISK_SIZE=6G
|
||||
SUPERVISOR_MACHINE=qemuarm-64
|
||||
SUPERVISOR_ARCH=aarch64
|
||||
|
@@ -3,7 +3,6 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp -t "${BOOT_DATA}" \
|
||||
"${BINARIES_DIR}/boot.scr" \
|
||||
@@ -13,13 +12,7 @@ function hassos_pre_image() {
|
||||
mkdir -p "${BOOT_DATA}/overlays"
|
||||
cp "${BINARIES_DIR}"/*.dtbo "${BOOT_DATA}/overlays/"
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
|
||||
echo "console=tty1" > "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BINARIES_DIR}/u-boot-rockchip.bin" of="${SPL_IMG}" conv=notrunc bs=512 seek=64
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
}
|
||||
|
||||
|
||||
|
1
buildroot-external/board/asus/tinker/cmdline.txt
Normal file
1
buildroot-external/board/asus/tinker/cmdline.txt
Normal file
@@ -0,0 +1 @@
|
||||
console=tty0
|
13
buildroot-external/board/asus/tinker/image-spl-spl.cfg
Normal file
13
buildroot-external/board/asus/tinker/image-spl-spl.cfg
Normal file
@@ -0,0 +1,13 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 32k
|
||||
image = "u-boot-rockchip.bin"
|
||||
}
|
||||
}
|
@@ -482,7 +482,6 @@ CONFIG_BT_BNEP=m
|
||||
CONFIG_BT_BNEP_MC_FILTER=y
|
||||
CONFIG_BT_BNEP_PROTO_FILTER=y
|
||||
CONFIG_BT_HIDP=m
|
||||
CONFIG_BT_HS=y
|
||||
CONFIG_BT_6LOWPAN=m
|
||||
CONFIG_BT_LEDS=y
|
||||
CONFIG_BT_HCIBTUSB=m
|
||||
@@ -1556,7 +1555,6 @@ CONFIG_SECURITY=y
|
||||
CONFIG_SECURITY_APPARMOR=y
|
||||
CONFIG_SECURITY_YAMA=y
|
||||
CONFIG_LSM="apparmor"
|
||||
CONFIG_CRYPTO_USER=m
|
||||
CONFIG_CRYPTO_PCRYPT=m
|
||||
CONFIG_CRYPTO_TEST=m
|
||||
CONFIG_CRYPTO_DH=m
|
||||
@@ -1598,10 +1596,6 @@ CONFIG_CRYPTO_ZSTD=m
|
||||
CONFIG_CRYPTO_ANSI_CPRNG=y
|
||||
CONFIG_CRYPTO_DRBG_HASH=y
|
||||
CONFIG_CRYPTO_DRBG_CTR=y
|
||||
CONFIG_CRYPTO_USER_API_HASH=m
|
||||
CONFIG_CRYPTO_USER_API_SKCIPHER=m
|
||||
CONFIG_CRYPTO_USER_API_RNG=m
|
||||
CONFIG_CRYPTO_USER_API_AEAD=m
|
||||
CONFIG_CRYPTO_GHASH_ARM_CE=m
|
||||
CONFIG_CRYPTO_SHA1_ARM_NEON=m
|
||||
CONFIG_CRYPTO_SHA1_ARM_CE=m
|
||||
|
@@ -3,7 +3,7 @@ BOARD_NAME="Asus TinkerBoard"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=zImage
|
||||
BOOT_SYS=hybrid
|
||||
PARTITION_TABLE_TYPE=hybrid
|
||||
BOOT_SIZE=24M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=8M
|
||||
|
@@ -0,0 +1,7 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(0; 17k)"}
|
||||
}
|
@@ -23,8 +23,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 ro rootwait"
|
||||
|
||||
# Load environment from haos-config.txt
|
||||
if test -e mmc ${devnum}:1 haos-config.txt; then
|
||||
|
@@ -1 +1 @@
|
||||
console=tty0 console=ttyAML0,115200n8
|
||||
console=ttyAML0,115200n8 console=tty0
|
||||
|
@@ -3,9 +3,6 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local BL1="${BINARIES_DIR}/bl1.bin.hardkernel"
|
||||
local UBOOT_GXBB="${BINARIES_DIR}/u-boot.gxbb"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}/meson-gxbb-odroidc2.dtb" "${BOOT_DATA}/meson-gxbb-odroidc2.dtb"
|
||||
@@ -14,13 +11,6 @@ function hassos_pre_image() {
|
||||
cp "${BINARIES_DIR}"/*.dtbo "${BOOT_DATA}/overlays/"
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BL1}" of="${SPL_IMG}" conv=notrunc bs=1 count=440
|
||||
dd if="${BL1}" of="${SPL_IMG}" conv=notrunc bs=512 skip=1 seek=1
|
||||
dd if="${UBOOT_GXBB}" of="${SPL_IMG}" conv=notrunc bs=512 seek=97
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,20 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition bl1 {
|
||||
in-partition-table = "no"
|
||||
image = "bl1.bin.hardkernel"
|
||||
offset = 0
|
||||
}
|
||||
|
||||
partition u-boot {
|
||||
in-partition-table = "no"
|
||||
image = "u-boot.gxbb"
|
||||
offset = 97s
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Hardkernel ODROID-C2"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=mbr
|
||||
PARTITION_TABLE_TYPE=mbr
|
||||
BOOT_SIZE=24M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=8M
|
||||
|
@@ -0,0 +1,8 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(440; 512)"}
|
||||
}
|
||||
|
@@ -25,8 +25,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 ro rootwait"
|
||||
|
||||
# Load environment from haos-config.txt
|
||||
if test -e mmc ${devnum}:1 haos-config.txt; then
|
||||
|
@@ -1 +1 @@
|
||||
console=tty0 console=ttyAML0,115200n8
|
||||
console=ttyAML0,115200n8 console=tty0
|
||||
|
@@ -3,8 +3,6 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local UBOOT_SM1="${BINARIES_DIR}/u-boot.sm1"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}/meson-sm1-odroid-c4.dtb" "${BOOT_DATA}/meson-sm1-odroid-c4.dtb"
|
||||
@@ -13,11 +11,6 @@ function hassos_pre_image() {
|
||||
cp "${BINARIES_DIR}"/*.dtbo "${BOOT_DATA}/overlays/"
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${UBOOT_SM1}" of="${SPL_IMG}" conv=notrunc bs=512 seek=1
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,13 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 512
|
||||
image = "u-boot.sm1"
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Hardkernel ODROID-C4"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=mbr
|
||||
PARTITION_TABLE_TYPE=mbr
|
||||
BOOT_SIZE=24M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=8M
|
||||
|
@@ -0,0 +1,7 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(0; 512)"}
|
||||
}
|
@@ -25,8 +25,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} clk_ignore_unused usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 ro rootwait"
|
||||
|
||||
# Load environment from haos-config.txt
|
||||
if test -e mmc ${devnum}:1 haos-config.txt; then
|
||||
|
@@ -0,0 +1 @@
|
||||
console=tty0
|
||||
|
@@ -3,18 +3,12 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}"/*.dtb "${BOOT_DATA}/"
|
||||
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BINARIES_DIR}/u-boot-rockchip.bin" of="${SPL_IMG}" conv=notrunc bs=512 seek=64
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,13 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 32k
|
||||
image = "u-boot-rockchip.bin"
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Hardkernel ODROID-M1"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=gpt
|
||||
PARTITION_TABLE_TYPE=hybrid
|
||||
BOOT_SIZE=16M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=16M
|
||||
|
@@ -0,0 +1,17 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(0; 17k)", "(8M; 16M)"}
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
size = 8M
|
||||
offset = 8M
|
||||
# FIXME: hdd-image intended to use the following, but the next one
|
||||
# is in the img because of the _fix_disk_spl_gpt function
|
||||
# partition-type-uuid = "21686148-6449-6e6f-744e-656564454649"
|
||||
partition-type-uuid = "e3c9e316-0b5c-4db8-817d-f92df00215ae"
|
||||
# no image here - already contains data from spl.img
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
From 023bc5bd23d3239494bca81d807d3c093f78c131 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= <sairon@sairon.cz>
|
||||
Date: Thu, 8 Aug 2024 17:52:47 +0200
|
||||
Subject: [PATCH] odroid-m1: Disable eMMC DDR52 mode, enable HS200
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Disable DDR52 mode on odroid-m1 to fix eMMC writes. Also enable HS200,
|
||||
as it's supposed to work more reliably than slower modes.
|
||||
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
Upstream: https://patchwork.ozlabs.org/project/uboot/cover/20240204205312.2342868-1-jonas@kwiboo.se/
|
||||
---
|
||||
arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi | 3 ---
|
||||
configs/odroid-m1-rk3568_defconfig | 2 ++
|
||||
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi b/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
|
||||
index 0fc360b06d..f9d34d3b77 100644
|
||||
--- a/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/rk3568-odroid-m1-u-boot.dtsi
|
||||
@@ -14,10 +14,7 @@
|
||||
|
||||
&sdhci {
|
||||
cap-mmc-highspeed;
|
||||
- mmc-ddr-1_8v;
|
||||
mmc-hs200-1_8v;
|
||||
- mmc-hs400-1_8v;
|
||||
- mmc-hs400-enhanced-strobe;
|
||||
pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
|
||||
};
|
||||
|
||||
diff --git a/configs/odroid-m1-rk3568_defconfig b/configs/odroid-m1-rk3568_defconfig
|
||||
index 96b4e9ecda..517ac0575d 100644
|
||||
--- a/configs/odroid-m1-rk3568_defconfig
|
||||
+++ b/configs/odroid-m1-rk3568_defconfig
|
||||
@@ -72,6 +72,8 @@ CONFIG_ROCKCHIP_GPIO=y
|
||||
CONFIG_SYS_I2C_ROCKCHIP=y
|
||||
CONFIG_MISC=y
|
||||
CONFIG_SUPPORT_EMMC_RPMB=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_SPL_MMC_HS200_SUPPORT=y
|
||||
CONFIG_MMC_DW=y
|
||||
CONFIG_MMC_DW_ROCKCHIP=y
|
||||
CONFIG_MMC_SDHCI=y
|
@@ -23,8 +23,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 ro rootwait"
|
||||
|
||||
part number mmc ${devnum} hassos-boot boot_partnum
|
||||
|
||||
|
@@ -0,0 +1 @@
|
||||
console=tty0
|
||||
|
@@ -3,18 +3,12 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}"/*.dtb "${BOOT_DATA}/"
|
||||
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BINARIES_DIR}/u-boot-rockchip.bin" of="${SPL_IMG}" conv=notrunc bs=512 seek=64
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,13 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 32k
|
||||
image = "u-boot-rockchip.bin"
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Hardkernel ODROID-M1S"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=gpt
|
||||
PARTITION_TABLE_TYPE=hybrid
|
||||
BOOT_SIZE=16M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=16M
|
||||
|
@@ -0,0 +1,17 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(0; 17k)", "(8M; 16M)"}
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
size = 8M
|
||||
offset = 8M
|
||||
# FIXME: hdd-image intended to use the following, but the next one
|
||||
# is in the img because of the _fix_disk_spl_gpt function
|
||||
# partition-type-uuid = "21686148-6449-6e6f-744e-656564454649"
|
||||
partition-type-uuid = "e3c9e316-0b5c-4db8-817d-f92df00215ae"
|
||||
# no image here - already contains data from spl.img
|
||||
}
|
@@ -23,8 +23,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 ro rootwait"
|
||||
|
||||
part number ${devtype} ${devnum} hassos-boot boot_partnum
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
console=tty0 console=ttyAML0,115200n8
|
||||
console=ttyAML0,115200n8 console=tty0
|
||||
|
@@ -3,8 +3,6 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local UBOOT_G12B="${BINARIES_DIR}/u-boot.g12b"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}"/*.dtb "${BOOT_DATA}/"
|
||||
@@ -13,11 +11,6 @@ function hassos_pre_image() {
|
||||
cp "${BINARIES_DIR}"/*.dtbo "${BOOT_DATA}/overlays/"
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${UBOOT_G12B}" of="${SPL_IMG}" conv=notrunc bs=512 seek=1
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,13 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 512
|
||||
image = "u-boot.g12b"
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Hardkernel ODROID-N2"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=mbr
|
||||
PARTITION_TABLE_TYPE=mbr
|
||||
BOOT_SIZE=24M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=8M
|
||||
|
@@ -0,0 +1,7 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(0; 512)"}
|
||||
}
|
@@ -25,8 +25,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 ro rootwait"
|
||||
|
||||
# Load environment from haos-config.txt
|
||||
if test -e mmc ${devnum}:1 haos-config.txt; then
|
||||
|
@@ -1 +1 @@
|
||||
console=tty1 console=ttySAC2,115200
|
||||
console=ttySAC2,115200 console=tty0
|
||||
|
@@ -3,24 +3,10 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local BL1="${BINARIES_DIR}/bl1.bin.hardkernel"
|
||||
local BL2="${BINARIES_DIR}/bl2.bin.hardkernel.720k_uboot"
|
||||
local BLTZ="${BINARIES_DIR}/tzsw.bin.hardkernel"
|
||||
local UBOOT="${BINARIES_DIR}/u-boot.bin"
|
||||
local spl_img="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}/exynos5422-odroidxu4.dtb" "${BOOT_DATA}/exynos5422-odroidxu4.dtb"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BL1}" of="${spl_img}" conv=notrunc bs=512 seek=1
|
||||
dd if="${BL2}" of="${spl_img}" conv=notrunc bs=512 seek=31
|
||||
dd if="${UBOOT}" of="${spl_img}" conv=notrunc bs=512 seek=63
|
||||
dd if="${BLTZ}" of="${spl_img}" conv=notrunc bs=512 seek=1503
|
||||
dd if=/dev/zero of="${spl_img}" conv=notrunc bs=512 count=32 seek=2015
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,33 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition 0 {
|
||||
size = 512
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition bl1 {
|
||||
image = "bl1.bin.hardkernel"
|
||||
holes = {"(15360; 15616)"} # last 256 bytes are overwritten by bl2
|
||||
}
|
||||
|
||||
partition bl2 {
|
||||
offset = 31s
|
||||
image = "bl2.bin.hardkernel.720k_uboot"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 63s
|
||||
image = "u-boot.bin"
|
||||
}
|
||||
|
||||
partition tzsw {
|
||||
offset = 1503s
|
||||
image = "tzsw.bin.hardkernel"
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Hardkernel ODROID-XU4"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=zImage
|
||||
BOOT_SYS=mbr
|
||||
PARTITION_TABLE_TYPE=mbr
|
||||
BOOT_SIZE=24M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=8M
|
||||
|
@@ -0,0 +1,7 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(440; 512)"}
|
||||
}
|
@@ -27,8 +27,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 ro rootwait"
|
||||
|
||||
# Load extraargs
|
||||
fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline
|
||||
|
@@ -0,0 +1,81 @@
|
||||
From 024796cbf752d2e210341ae8609792803641eb92 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= <sairon@sairon.cz>
|
||||
Date: Thu, 7 Nov 2024 12:39:02 +0100
|
||||
Subject: [PATCH] HACK: mmc: meson-gx: limit f_max to 24 MHz on the first try
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
To initialize some eMMCs cards properly, ODROID N2 needed to have
|
||||
maximum clock rate limited to 24 MHz. This was working good until ODROID
|
||||
released eMMC modules with Kingson chips which do not initialize at the
|
||||
limited frequency at all - instead it seems it's best for the if
|
||||
no limit is set (which would result in using 52 MHz anyway).
|
||||
|
||||
Instead of hard-limiting the frequency, add a boolean flag that caps the
|
||||
frequency to the proven 24 MHz, and if mmc_select_mode_and_width fails,
|
||||
remove this cap and use f_max set to 100 MHz, as limited in upstream
|
||||
U-Boot.
|
||||
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/mmc/meson_gx_mmc.c | 2 ++
|
||||
drivers/mmc/mmc.c | 11 +++++++++++
|
||||
include/mmc.h | 2 ++
|
||||
3 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
|
||||
index fcf4f03d1e..715dce3522 100644
|
||||
--- a/drivers/mmc/meson_gx_mmc.c
|
||||
+++ b/drivers/mmc/meson_gx_mmc.c
|
||||
@@ -283,6 +283,8 @@ static int meson_mmc_probe(struct udevice *dev)
|
||||
cfg->b_max = 511; /* max 512 - 1 blocks */
|
||||
cfg->name = dev->name;
|
||||
|
||||
+ mmc->meson_gx_f_max_hack = true;
|
||||
+
|
||||
mmc->priv = pdata;
|
||||
upriv->mmc = mmc;
|
||||
|
||||
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
|
||||
index d96db7a0f8..c8dc676612 100644
|
||||
--- a/drivers/mmc/mmc.c
|
||||
+++ b/drivers/mmc/mmc.c
|
||||
@@ -1652,6 +1652,10 @@ int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
|
||||
clock = mmc->cfg->f_min;
|
||||
}
|
||||
|
||||
+ /* Apply 24 MHz limit that fixes issues with some cards on meson. */
|
||||
+ if (mmc->meson_gx_f_max_hack && clock > 24000000)
|
||||
+ clock = 24000000;
|
||||
+
|
||||
mmc->clock = clock;
|
||||
mmc->clk_disable = disable;
|
||||
|
||||
@@ -2647,6 +2651,13 @@ static int mmc_startup(struct mmc *mmc)
|
||||
if (err)
|
||||
return err;
|
||||
err = mmc_select_mode_and_width(mmc, mmc->card_caps);
|
||||
+ if (err && mmc->meson_gx_f_max_hack) {
|
||||
+ /* Some eMMCs (namely Kingston) do not initialize at limited frequency. */
|
||||
+ printf("Card failed to initialize at %d Hz, disabling meson_gx hack.\n",
|
||||
+ mmc->clock);
|
||||
+ mmc->meson_gx_f_max_hack = false;
|
||||
+ err = mmc_select_mode_and_width(mmc, mmc->card_caps);
|
||||
+ }
|
||||
}
|
||||
#endif
|
||||
if (err)
|
||||
diff --git a/include/mmc.h b/include/mmc.h
|
||||
index 1022db3ffa..0ea48c6fd9 100644
|
||||
--- a/include/mmc.h
|
||||
+++ b/include/mmc.h
|
||||
@@ -739,6 +739,8 @@ struct mmc {
|
||||
u8 hs400_tuning;
|
||||
|
||||
enum bus_mode user_speed_mode; /* input speed mode from user */
|
||||
+
|
||||
+ bool meson_gx_f_max_hack;
|
||||
};
|
||||
|
||||
#if CONFIG_IS_ENABLED(DM_MMC)
|
@@ -1,26 +0,0 @@
|
||||
From 11f015e13ef0442b6d2bb734954291abde415f73 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 2 Sep 2019 15:42:04 +0200
|
||||
Subject: [PATCH] HACK: mmc: meson-gx: limit to 24MHz
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/mmc/meson_gx_mmc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
|
||||
index fcf4f03d1e..6ded4b619b 100644
|
||||
--- a/drivers/mmc/meson_gx_mmc.c
|
||||
+++ b/drivers/mmc/meson_gx_mmc.c
|
||||
@@ -279,7 +279,7 @@ static int meson_mmc_probe(struct udevice *dev)
|
||||
cfg->host_caps = MMC_MODE_8BIT | MMC_MODE_4BIT |
|
||||
MMC_MODE_HS_52MHz | MMC_MODE_HS;
|
||||
cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV);
|
||||
- cfg->f_max = 100000000; /* 100 MHz */
|
||||
+ cfg->f_max = SD_EMMC_CLKSRC_24M;
|
||||
cfg->b_max = 511; /* max 512 - 1 blocks */
|
||||
cfg->name = dev->name;
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1 +1 @@
|
||||
console=tty0 console=ttyAML0,115200n8
|
||||
console=ttyAML0,115200n8 console=tty0
|
||||
|
@@ -3,20 +3,12 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local UBOOT_GXL="${BINARIES_DIR}/u-boot.gxl"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}/meson-g12b-s922x-khadas-vim3.dtb" "${BOOT_DATA}/meson-g12b-s922x-khadas-vim3.dtb"
|
||||
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${UBOOT_GXL}" of="${SPL_IMG}" conv=notrunc bs=1 count=444
|
||||
dd if="${UBOOT_GXL}" of="${SPL_IMG}" conv=notrunc bs=512 skip=1 seek=1
|
||||
}
|
||||
|
||||
|
||||
|
16
buildroot-external/board/khadas/vim3/image-spl-spl.cfg
Normal file
16
buildroot-external/board/khadas/vim3/image-spl-spl.cfg
Normal file
@@ -0,0 +1,16 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
# FIXME: May not be necessary, but keeping it for now for binary-identical output
|
||||
exec-post = "dd if=/dev/zero of=${BINARIES_DIR}/spl.img seek=444 count=68 bs=1 conv=notrunc"
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 0
|
||||
image = "u-boot.gxl"
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Khadas VIM3"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=mbr
|
||||
PARTITION_TABLE_TYPE=mbr
|
||||
BOOT_SIZE=24M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=8M
|
||||
|
@@ -0,0 +1,7 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(440; 512)"}
|
||||
}
|
@@ -25,8 +25,8 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 rootfstype=squashfs ro rootwait"
|
||||
setenv bootargs_a "root=PARTUUID=48617373-06 ro rootwait"
|
||||
setenv bootargs_b "root=PARTUUID=48617373-08 ro rootwait"
|
||||
|
||||
# Load environment from haos-config.txt
|
||||
if test -e mmc ${devnum}:1 haos-config.txt; then
|
||||
|
@@ -0,0 +1 @@
|
||||
console=ttyS2,1500000n8 console=tty0
|
||||
|
@@ -3,18 +3,12 @@
|
||||
|
||||
function hassos_pre_image() {
|
||||
local BOOT_DATA="$(path_boot_dir)"
|
||||
local SPL_IMG="$(path_spl_img)"
|
||||
|
||||
cp "${BINARIES_DIR}/boot.scr" "${BOOT_DATA}/boot.scr"
|
||||
cp "${BINARIES_DIR}"/*.dtb "${BOOT_DATA}/"
|
||||
|
||||
cp "${BOARD_DIR}/boot-env.txt" "${BOOT_DATA}/haos-config.txt"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${BOOT_DATA}/cmdline.txt"
|
||||
|
||||
# SPL
|
||||
create_spl_image
|
||||
|
||||
dd if="${BINARIES_DIR}/u-boot-rockchip.bin" of="${SPL_IMG}" conv=notrunc bs=512 seek=64
|
||||
}
|
||||
|
||||
|
||||
|
13
buildroot-external/board/nabucasa/green/image-spl-spl.cfg
Normal file
13
buildroot-external/board/nabucasa/green/image-spl-spl.cfg
Normal file
@@ -0,0 +1,13 @@
|
||||
image spl.img {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
|
||||
hdimage {
|
||||
partition-table-type = "none"
|
||||
fill = "yes"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
offset = 32k
|
||||
image = "u-boot-rockchip.bin"
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ BOARD_NAME="Home Assistant Green"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=uboot
|
||||
KERNEL_FILE=Image
|
||||
BOOT_SYS=gpt
|
||||
PARTITION_TABLE_TYPE=hybrid
|
||||
BOOT_SIZE=16M
|
||||
BOOT_SPL=true
|
||||
BOOT_SPL_SIZE=16M
|
||||
|
@@ -0,0 +1,7 @@
|
||||
partition spl {
|
||||
size = ${BOOT_SPL_SIZE}
|
||||
image = "spl.img"
|
||||
in-partition-table = "no"
|
||||
offset = 0
|
||||
holes = {"(0; 17k)"}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
From 331826e0c52d6bdd65d862e06834f23b3a750276 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= <sairon@sairon.cz>
|
||||
Date: Wed, 12 Jun 2024 15:20:46 +0200
|
||||
Subject: [PATCH] green: Do not use eMMC DDR52 mode, enable HS200
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
There is a known issue on RK356x boards that the eMMC writing fails when
|
||||
DDR52 mode is used. Disable this mode and other HS modes, keep only
|
||||
HS200 which works reliably with the eMMC used on Green. For more details
|
||||
see the upstream commit and mailing list discussion [1].
|
||||
|
||||
Also enable HS200 support in defconfig.
|
||||
|
||||
[1] https://patchwork.ozlabs.org/project/uboot/patch/20240204205312.2342868-2-jonas@kwiboo.se/
|
||||
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
arch/arm/dts/rk3566-ha-green-u-boot.dtsi | 5 +----
|
||||
configs/green_defconfig | 2 ++
|
||||
2 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/dts/rk3566-ha-green-u-boot.dtsi b/arch/arm/dts/rk3566-ha-green-u-boot.dtsi
|
||||
index 48d7b61513..8dc1585aac 100644
|
||||
--- a/arch/arm/dts/rk3566-ha-green-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/rk3566-ha-green-u-boot.dtsi
|
||||
@@ -71,10 +71,7 @@
|
||||
|
||||
&sdhci {
|
||||
cap-mmc-highspeed;
|
||||
- mmc-ddr-1_8v;
|
||||
mmc-hs200-1_8v;
|
||||
- mmc-hs400-1_8v;
|
||||
- mmc-hs400-enhanced-strobe;
|
||||
};
|
||||
|
||||
&sfc {
|
||||
@@ -115,4 +112,4 @@
|
||||
|
||||
&vcc5v0_usb_host {
|
||||
regulator-boot-on;
|
||||
-};
|
||||
\ No newline at end of file
|
||||
+};
|
||||
diff --git a/configs/green_defconfig b/configs/green_defconfig
|
||||
index 71c9257d7d..7b5a705686 100644
|
||||
--- a/configs/green_defconfig
|
||||
+++ b/configs/green_defconfig
|
||||
@@ -65,6 +65,8 @@ CONFIG_MISC=y
|
||||
CONFIG_I2C_EEPROM=y
|
||||
CONFIG_SYS_I2C_EEPROM_ADDR=0x0
|
||||
CONFIG_SUPPORT_EMMC_RPMB=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_SPL_MMC_HS200_SUPPORT=y
|
||||
CONFIG_MMC_DW=y
|
||||
CONFIG_MMC_DW_ROCKCHIP=y
|
||||
CONFIG_MMC_SDHCI=y
|
@@ -0,0 +1,52 @@
|
||||
From d3fb1ec2364b20025d71e2263514a71208cfb61e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= <sairon@sairon.cz>
|
||||
Date: Tue, 13 Aug 2024 17:51:29 +0200
|
||||
Subject: [PATCH] arch: arm64: dts: green: Improve LED representation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fix color and use labels/node names according to the LEDs functionality.
|
||||
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
Co-authored-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
arch/arm/dts/rk3566-ha-green.dts | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/dts/rk3566-ha-green.dts b/arch/arm/dts/rk3566-ha-green.dts
|
||||
index 68d836911e..c3adc59904 100644
|
||||
--- a/arch/arm/dts/rk3566-ha-green.dts
|
||||
+++ b/arch/arm/dts/rk3566-ha-green.dts
|
||||
@@ -48,16 +48,18 @@
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
- led_power: led-0 {
|
||||
+ led_power: led-power {
|
||||
+ label = "power";
|
||||
gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;
|
||||
function = LED_FUNCTION_POWER;
|
||||
- color = <LED_COLOR_ID_RED>;
|
||||
+ color = <LED_COLOR_ID_WHITE>;
|
||||
default-state = "keep";
|
||||
linux,default-trigger = "default-on";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&led_power_pin>;
|
||||
};
|
||||
- led_act: led-1 {
|
||||
+ led_act: led-activity {
|
||||
+ label = "activity";
|
||||
gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
|
||||
function = LED_FUNCTION_ACTIVITY;
|
||||
color = <LED_COLOR_ID_GREEN>;
|
||||
@@ -65,7 +67,8 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&led_act_pin>;
|
||||
};
|
||||
- led_user: led-2 {
|
||||
+ led_user: led-user {
|
||||
+ label = "user";
|
||||
gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
function = LED_FUNCTION_HEARTBEAT;
|
||||
color = <LED_COLOR_ID_YELLOW>;
|
@@ -27,9 +27,39 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
|
||||
# HassOS bootargs
|
||||
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 rootwait systemd.machine_id=${MACHINE_ID} fsck.repair=yes ${BOOT_CONDITION}"
|
||||
|
||||
i2c dev 0
|
||||
setenv check_btn_pressed ' \
|
||||
i2c read 0x20 0xf0.1 1 ${loadaddr}; \
|
||||
setexpr PWRON_STS *${loadaddr} \\\& 0x80; \
|
||||
test ${PWRON_STS} -eq 0x0;'
|
||||
|
||||
# Check if button is held for device wipe
|
||||
setenv counter 0
|
||||
while test ${counter} -lt 2; do
|
||||
if run check_btn_pressed; then
|
||||
echo "Reset button pressed for ${counter} seconds"
|
||||
setexpr counter ${counter} + 1
|
||||
|
||||
if test ${counter} -eq 2; then
|
||||
led user on
|
||||
echo "Waiting for button to be released"
|
||||
while run check_btn_pressed; do
|
||||
sleep 0.5
|
||||
done
|
||||
echo "Proceeding with device wipe"
|
||||
setenv bootargs_hassos "${bootargs_hassos} haos.wipe=1"
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
else
|
||||
# U-Boot has no break statement :')
|
||||
setenv counter 2
|
||||
fi
|
||||
done
|
||||
|
||||
# HassOS system A/B
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype=squashfs ro"
|
||||
setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd ro"
|
||||
setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 ro"
|
||||
|
||||
part number ${devtype} ${devnum} hassos-boot boot_partnum
|
||||
|
||||
|
3
buildroot-external/board/nabucasa/green/uboot.config
Normal file
3
buildroot-external/board/nabucasa/green/uboot.config
Normal file
@@ -0,0 +1,3 @@
|
||||
CONFIG_LED=y
|
||||
CONFIG_LED_GPIO=y
|
||||
CONFIG_CMD_LED=y
|
@@ -1 +1 @@
|
||||
console=tty1
|
||||
console=tty0
|
||||
|
@@ -9,14 +9,10 @@ function hassos_pre_image() {
|
||||
|
||||
cp "${BOARD_DIR}/../grub.cfg" "${EFIPART_DATA}/EFI/BOOT/grub.cfg"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${EFIPART_DATA}/cmdline.txt"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" create
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" set ORDER="A B"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" set A_OK=1
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" set A_TRY=0
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" create
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set ORDER="B A"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set B_OK=1
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set B_TRY=0
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" create
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set ORDER="A B"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set A_OK=1
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set A_TRY=0
|
||||
|
||||
cp -r "${EFIPART_DATA}/"* "${BOOT_DATA}/"
|
||||
}
|
||||
|
@@ -172,3 +172,6 @@ CONFIG_DLN2_ADC=m
|
||||
|
||||
CONFIG_IIO=m
|
||||
CONFIG_BMP280=m
|
||||
|
||||
# Required for some PCIe devices such as ath12k
|
||||
CONFIG_IRQ_REMAP=y
|
||||
|
@@ -3,9 +3,9 @@ BOARD_NAME="Generic x86-64"
|
||||
CHASSIS=embedded
|
||||
BOOTLOADER=grub
|
||||
KERNEL_FILE=bzImage
|
||||
BOOT_SYS=efi
|
||||
PARTITION_TABLE_TYPE=gpt
|
||||
BOOT_SIZE=32M
|
||||
BOOT_SPL=false
|
||||
DISK_SIZE=6
|
||||
DISK_SIZE=6G
|
||||
SUPERVISOR_MACHINE=generic-x86-64
|
||||
SUPERVISOR_ARCH=amd64
|
||||
|
@@ -77,9 +77,9 @@ menuentry "Slot B (OK=$B_OK TRY=$B_TRY)" {
|
||||
}
|
||||
|
||||
menuentry "Slot A (rescue shell)" {
|
||||
linux (${boothd},gpt2)/bzImage root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd $default_cmdline $cmdline rauc.slot=A systemd.unit=recovery.target
|
||||
linux (${boothd},gpt2)/bzImage root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd $default_cmdline $cmdline rauc.slot=A systemd.unit=recovery.target debug
|
||||
}
|
||||
|
||||
menuentry "Slot B (rescue shell)" {
|
||||
linux (${boothd},gpt4)/bzImage root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 $default_cmdline $cmdline rauc.slot=B systemd.unit=recovery.target
|
||||
linux (${boothd},gpt4)/bzImage root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 $default_cmdline $cmdline rauc.slot=B systemd.unit=recovery.target debug
|
||||
}
|
||||
|
@@ -1 +1 @@
|
||||
console=ttyS0 console=tty1
|
||||
console=ttyS0 console=tty0
|
||||
|
@@ -9,14 +9,10 @@ function hassos_pre_image() {
|
||||
|
||||
cp "${BOARD_DIR}/../grub.cfg" "${EFIPART_DATA}/EFI/BOOT/grub.cfg"
|
||||
cp "${BOARD_DIR}/cmdline.txt" "${EFIPART_DATA}/cmdline.txt"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" create
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" set ORDER="A B"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" set A_OK=1
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-A" set A_TRY=0
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" create
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set ORDER="B A"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set B_OK=1
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set B_TRY=0
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" create
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set ORDER="A B"
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set A_OK=1
|
||||
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv" set A_TRY=0
|
||||
|
||||
cp -r "${EFIPART_DATA}/"* "${BOOT_DATA}/"
|
||||
}
|
||||
|
@@ -124,4 +124,19 @@ CONFIG_DWMAC_INTEL=m
|
||||
CONFIG_I6300ESB_WDT=y
|
||||
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_BOARDINFO=y
|
||||
CONFIG_I2C_COMPAT=y
|
||||
CONFIG_I2C_CHARDEV=m
|
||||
CONFIG_I2C_MUX=y
|
||||
CONFIG_I2C_TINY_USB=m
|
||||
|
||||
CONFIG_I2C_DLN2=m
|
||||
CONFIG_GPIO_DLN2=m
|
||||
CONFIG_MFD_DLN2=m
|
||||
CONFIG_DLN2_ADC=m
|
||||
|
||||
CONFIG_IIO=m
|
||||
CONFIG_BMP280=m
|
||||
|
||||
# Required for some PCIe devices such as ath12k
|
||||
CONFIG_IRQ_REMAP=y
|
||||
|
@@ -3,9 +3,9 @@ BOARD_NAME="Open Virtual Appliance"
|
||||
CHASSIS=vm
|
||||
BOOTLOADER=grub
|
||||
KERNEL_FILE=bzImage
|
||||
BOOT_SYS=efi
|
||||
PARTITION_TABLE_TYPE=gpt
|
||||
BOOT_SIZE=32M
|
||||
BOOT_SPL=false
|
||||
DISK_SIZE=32
|
||||
DISK_SIZE=32G
|
||||
SUPERVISOR_MACHINE=qemux86-64
|
||||
SUPERVISOR_ARCH=amd64
|
||||
|
@@ -1 +1 @@
|
||||
dwc_otg.lpm_enable=0 console=tty1 usb-storage.quirks=174c:55aa:u,2109:0715:u,152d:0578:u,152d:0579:u,152d:1561:u,174c:0829:u,14b0:0206:u,174c:225c:u,7825:a2a4:u,152d:0562:u
|
||||
dwc_otg.lpm_enable=0 console=tty0 usb-storage.quirks=174c:55aa:u,2109:0715:u,152d:0578:u,152d:0579:u,152d:1561:u,174c:0829:u,14b0:0206:u,174c:225c:u,7825:a2a4:u,152d:0562:u,125f:a88a:u,152d:a583:u
|
||||
|
@@ -1,5 +1,4 @@
|
||||
From 57188c09ac02bfa61cce55932ccba43ec7210e54 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <57188c09ac02bfa61cce55932ccba43ec7210e54.1677499675.git.stefan@agner.ch>
|
||||
From e2f2644f306f44e65bb8082bac3c26cb5e699664 Mon Sep 17 00:00:00 2001
|
||||
From: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
Date: Tue, 2 Jun 2020 21:20:08 +0000
|
||||
Subject: [PATCH] ARM: dts: bcm283x: add compatible picked up by U-Boot
|
||||
@@ -12,14 +11,14 @@ not using that compatible string.
|
||||
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2711.dtsi | 8 ++++----
|
||||
arch/arm/boot/dts/bcm283x.dtsi | 2 +-
|
||||
arch/arm/boot/dts/broadcom/bcm2711.dtsi | 8 ++++----
|
||||
arch/arm/boot/dts/broadcom/bcm283x.dtsi | 2 +-
|
||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
|
||||
index 941c4d16791b..3cd49fa4bafd 100644
|
||||
--- a/arch/arm/boot/dts/bcm2711.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm2711.dtsi
|
||||
diff --git a/arch/arm/boot/dts/broadcom/bcm2711.dtsi b/arch/arm/boot/dts/broadcom/bcm2711.dtsi
|
||||
index 4a379a14966d8..30f6ccdcef178 100644
|
||||
--- a/arch/arm/boot/dts/broadcom/bcm2711.dtsi
|
||||
+++ b/arch/arm/boot/dts/broadcom/bcm2711.dtsi
|
||||
@@ -128,7 +128,7 @@ rng@7e104000 {
|
||||
};
|
||||
|
||||
@@ -56,11 +55,11 @@ index 941c4d16791b..3cd49fa4bafd 100644
|
||||
reg = <0x7e201a00 0x200>;
|
||||
interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clocks BCM2835_CLOCK_UART>,
|
||||
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
|
||||
index d2d9c6e67f39..7b9a2e8cf529 100644
|
||||
--- a/arch/arm/boot/dts/bcm283x.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm283x.dtsi
|
||||
@@ -302,7 +302,7 @@ uart1_ctsrts_gpio42: uart1_ctsrts_gpio42 {
|
||||
diff --git a/arch/arm/boot/dts/broadcom/bcm283x.dtsi b/arch/arm/boot/dts/broadcom/bcm283x.dtsi
|
||||
index 2ca8a2505a4db..6f91c85677d89 100644
|
||||
--- a/arch/arm/boot/dts/broadcom/bcm283x.dtsi
|
||||
+++ b/arch/arm/boot/dts/broadcom/bcm283x.dtsi
|
||||
@@ -302,7 +302,7 @@ uart1_ctsrts_gpio42: uart1-ctsrts-gpio42 {
|
||||
};
|
||||
|
||||
uart0: serial@7e201000 {
|
||||
@@ -69,6 +68,3 @@ index d2d9c6e67f39..7b9a2e8cf529 100644
|
||||
reg = <0x7e201000 0x200>;
|
||||
interrupts = <2 25>;
|
||||
clocks = <&clocks BCM2835_CLOCK_UART>,
|
||||
--
|
||||
2.39.1
|
||||
|
||||
|
@@ -1,677 +0,0 @@
|
||||
From 74c48f9493b3e95ec1f76b92b88061194c1874fc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= <sairon@sairon.cz>
|
||||
Date: Mon, 4 Mar 2024 13:52:34 +0100
|
||||
Subject: [PATCH] Revert USB core changes causing issues with Z-Wave.me UZB
|
||||
stick
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Workaround for issues described on GH [1] and reported in [2].
|
||||
|
||||
* Revert "USB: core: Fix oversight in SuperSpeed initialization"
|
||||
This reverts commit f705617bab4766567874715eeed1b39dacb58671.
|
||||
|
||||
* Revert "USB: core: Fix race by not overwriting udev->descriptor in hub_port_init()"
|
||||
This reverts commit 8186596a663506b1124bede9fde6f243ef9f37ee.
|
||||
|
||||
* Revert "USB: core: Change usb_get_device_descriptor() API"
|
||||
This reverts commit d309fa69c2e3c5e6134ac9386f833f683e66ad1a.
|
||||
|
||||
* Revert "USB: core: Unite old scheme and new scheme descriptor reads"
|
||||
This reverts commit 90b01f8df56844cb4ac8f188eed92a5ee866020a.
|
||||
|
||||
[1] https://github.com/home-assistant/operating-system/issues/2995
|
||||
[2] https://lore.kernel.org/linux-usb/1e954652-dfb3-4248-beea-b8a449128ff0@sairon.cz/
|
||||
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/usb/core/hcd.c | 10 +-
|
||||
drivers/usb/core/hub.c | 349 ++++++++++++++++---------------------
|
||||
drivers/usb/core/message.c | 29 +--
|
||||
drivers/usb/core/usb.h | 4 +-
|
||||
4 files changed, 169 insertions(+), 223 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
|
||||
index be96045e4d6e3..4e240151c06af 100644
|
||||
--- a/drivers/usb/core/hcd.c
|
||||
+++ b/drivers/usb/core/hcd.c
|
||||
@@ -983,7 +983,6 @@ static int register_root_hub(struct usb_hcd *hcd)
|
||||
{
|
||||
struct device *parent_dev = hcd->self.controller;
|
||||
struct usb_device *usb_dev = hcd->self.root_hub;
|
||||
- struct usb_device_descriptor *descr;
|
||||
const int devnum = 1;
|
||||
int retval;
|
||||
|
||||
@@ -995,16 +994,13 @@ static int register_root_hub(struct usb_hcd *hcd)
|
||||
mutex_lock(&usb_bus_idr_lock);
|
||||
|
||||
usb_dev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
|
||||
- descr = usb_get_device_descriptor(usb_dev);
|
||||
- if (IS_ERR(descr)) {
|
||||
- retval = PTR_ERR(descr);
|
||||
+ retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE);
|
||||
+ if (retval != sizeof usb_dev->descriptor) {
|
||||
mutex_unlock(&usb_bus_idr_lock);
|
||||
dev_dbg (parent_dev, "can't read %s device descriptor %d\n",
|
||||
dev_name(&usb_dev->dev), retval);
|
||||
- return retval;
|
||||
+ return (retval < 0) ? retval : -EMSGSIZE;
|
||||
}
|
||||
- usb_dev->descriptor = *descr;
|
||||
- kfree(descr);
|
||||
|
||||
if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) {
|
||||
retval = usb_get_bos_descriptor(usb_dev);
|
||||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
|
||||
index 574b8104a8199..708b63bcd38af 100644
|
||||
--- a/drivers/usb/core/hub.c
|
||||
+++ b/drivers/usb/core/hub.c
|
||||
@@ -2664,17 +2664,12 @@ int usb_authorize_device(struct usb_device *usb_dev)
|
||||
}
|
||||
|
||||
if (usb_dev->wusb) {
|
||||
- struct usb_device_descriptor *descr;
|
||||
-
|
||||
- descr = usb_get_device_descriptor(usb_dev);
|
||||
- if (IS_ERR(descr)) {
|
||||
- result = PTR_ERR(descr);
|
||||
+ result = usb_get_device_descriptor(usb_dev, sizeof(usb_dev->descriptor));
|
||||
+ if (result < 0) {
|
||||
dev_err(&usb_dev->dev, "can't re-read device descriptor for "
|
||||
"authorization: %d\n", result);
|
||||
goto error_device_descriptor;
|
||||
}
|
||||
- usb_dev->descriptor = *descr;
|
||||
- kfree(descr);
|
||||
}
|
||||
|
||||
usb_dev->authorized = 1;
|
||||
@@ -4685,67 +4680,6 @@ static int hub_enable_device(struct usb_device *udev)
|
||||
return hcd->driver->enable_device(hcd, udev);
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Get the bMaxPacketSize0 value during initialization by reading the
|
||||
- * device's device descriptor. Since we don't already know this value,
|
||||
- * the transfer is unsafe and it ignores I/O errors, only testing for
|
||||
- * reasonable received values.
|
||||
- *
|
||||
- * For "old scheme" initialization, size will be 8 so we read just the
|
||||
- * start of the device descriptor, which should work okay regardless of
|
||||
- * the actual bMaxPacketSize0 value. For "new scheme" initialization,
|
||||
- * size will be 64 (and buf will point to a sufficiently large buffer),
|
||||
- * which might not be kosher according to the USB spec but it's what
|
||||
- * Windows does and what many devices expect.
|
||||
- *
|
||||
- * Returns: bMaxPacketSize0 or a negative error code.
|
||||
- */
|
||||
-static int get_bMaxPacketSize0(struct usb_device *udev,
|
||||
- struct usb_device_descriptor *buf, int size, bool first_time)
|
||||
-{
|
||||
- int i, rc;
|
||||
-
|
||||
- /*
|
||||
- * Retry on all errors; some devices are flakey.
|
||||
- * 255 is for WUSB devices, we actually need to use
|
||||
- * 512 (WUSB1.0[4.8.1]).
|
||||
- */
|
||||
- for (i = 0; i < GET_MAXPACKET0_TRIES; ++i) {
|
||||
- /* Start with invalid values in case the transfer fails */
|
||||
- buf->bDescriptorType = buf->bMaxPacketSize0 = 0;
|
||||
- rc = usb_control_msg(udev, usb_rcvaddr0pipe(),
|
||||
- USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
|
||||
- USB_DT_DEVICE << 8, 0,
|
||||
- buf, size,
|
||||
- initial_descriptor_timeout);
|
||||
- switch (buf->bMaxPacketSize0) {
|
||||
- case 8: case 16: case 32: case 64: case 9:
|
||||
- if (buf->bDescriptorType == USB_DT_DEVICE) {
|
||||
- rc = buf->bMaxPacketSize0;
|
||||
- break;
|
||||
- }
|
||||
- fallthrough;
|
||||
- default:
|
||||
- if (rc >= 0)
|
||||
- rc = -EPROTO;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Some devices time out if they are powered on
|
||||
- * when already connected. They need a second
|
||||
- * reset, so return early. But only on the first
|
||||
- * attempt, lest we get into a time-out/reset loop.
|
||||
- */
|
||||
- if (rc > 0 || (rc == -ETIMEDOUT && first_time &&
|
||||
- udev->speed > USB_SPEED_FULL))
|
||||
- break;
|
||||
- }
|
||||
- return rc;
|
||||
-}
|
||||
-
|
||||
-#define GET_DESCRIPTOR_BUFSIZE 64
|
||||
-
|
||||
/* Reset device, (re)assign address, get device descriptor.
|
||||
* Device connection must be stable, no more debouncing needed.
|
||||
* Returns device in USB_STATE_ADDRESS, except on error.
|
||||
@@ -4755,17 +4689,10 @@ static int get_bMaxPacketSize0(struct usb_device *udev,
|
||||
* the port lock. For a newly detected device that is not accessible
|
||||
* through any global pointers, it's not necessary to lock the device,
|
||||
* but it is still necessary to lock the port.
|
||||
- *
|
||||
- * For a newly detected device, @dev_descr must be NULL. The device
|
||||
- * descriptor retrieved from the device will then be stored in
|
||||
- * @udev->descriptor. For an already existing device, @dev_descr
|
||||
- * must be non-NULL. The device descriptor will be stored there,
|
||||
- * not in @udev->descriptor, because descriptors for registered
|
||||
- * devices are meant to be immutable.
|
||||
*/
|
||||
static int
|
||||
hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
- int retry_counter, struct usb_device_descriptor *dev_descr)
|
||||
+ int retry_counter)
|
||||
{
|
||||
struct usb_device *hdev = hub->hdev;
|
||||
struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
|
||||
@@ -4777,13 +4704,6 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
int devnum = udev->devnum;
|
||||
const char *driver_name;
|
||||
bool do_new_scheme;
|
||||
- const bool initial = !dev_descr;
|
||||
- int maxp0;
|
||||
- struct usb_device_descriptor *buf, *descr;
|
||||
-
|
||||
- buf = kmalloc(GET_DESCRIPTOR_BUFSIZE, GFP_NOIO);
|
||||
- if (!buf)
|
||||
- return -ENOMEM;
|
||||
|
||||
/* root hub ports have a slightly longer reset period
|
||||
* (from USB 2.0 spec, section 7.1.7.5)
|
||||
@@ -4816,34 +4736,32 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
}
|
||||
oldspeed = udev->speed;
|
||||
|
||||
- if (initial) {
|
||||
- /* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
|
||||
- * it's fixed size except for full speed devices.
|
||||
- * For Wireless USB devices, ep0 max packet is always 512 (tho
|
||||
- * reported as 0xff in the device descriptor). WUSB1.0[4.8.1].
|
||||
+ /* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
|
||||
+ * it's fixed size except for full speed devices.
|
||||
+ * For Wireless USB devices, ep0 max packet is always 512 (tho
|
||||
+ * reported as 0xff in the device descriptor). WUSB1.0[4.8.1].
|
||||
+ */
|
||||
+ switch (udev->speed) {
|
||||
+ case USB_SPEED_SUPER_PLUS:
|
||||
+ case USB_SPEED_SUPER:
|
||||
+ case USB_SPEED_WIRELESS: /* fixed at 512 */
|
||||
+ udev->ep0.desc.wMaxPacketSize = cpu_to_le16(512);
|
||||
+ break;
|
||||
+ case USB_SPEED_HIGH: /* fixed at 64 */
|
||||
+ udev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
|
||||
+ break;
|
||||
+ case USB_SPEED_FULL: /* 8, 16, 32, or 64 */
|
||||
+ /* to determine the ep0 maxpacket size, try to read
|
||||
+ * the device descriptor to get bMaxPacketSize0 and
|
||||
+ * then correct our initial guess.
|
||||
*/
|
||||
- switch (udev->speed) {
|
||||
- case USB_SPEED_SUPER_PLUS:
|
||||
- case USB_SPEED_SUPER:
|
||||
- case USB_SPEED_WIRELESS: /* fixed at 512 */
|
||||
- udev->ep0.desc.wMaxPacketSize = cpu_to_le16(512);
|
||||
- break;
|
||||
- case USB_SPEED_HIGH: /* fixed at 64 */
|
||||
- udev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
|
||||
- break;
|
||||
- case USB_SPEED_FULL: /* 8, 16, 32, or 64 */
|
||||
- /* to determine the ep0 maxpacket size, try to read
|
||||
- * the device descriptor to get bMaxPacketSize0 and
|
||||
- * then correct our initial guess.
|
||||
- */
|
||||
- udev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
|
||||
- break;
|
||||
- case USB_SPEED_LOW: /* fixed at 8 */
|
||||
- udev->ep0.desc.wMaxPacketSize = cpu_to_le16(8);
|
||||
- break;
|
||||
- default:
|
||||
- goto fail;
|
||||
- }
|
||||
+ udev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
|
||||
+ break;
|
||||
+ case USB_SPEED_LOW: /* fixed at 8 */
|
||||
+ udev->ep0.desc.wMaxPacketSize = cpu_to_le16(8);
|
||||
+ break;
|
||||
+ default:
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
if (udev->speed == USB_SPEED_WIRELESS)
|
||||
@@ -4866,24 +4784,22 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
if (udev->speed < USB_SPEED_SUPER)
|
||||
dev_info(&udev->dev,
|
||||
"%s %s USB device number %d using %s\n",
|
||||
- (initial ? "new" : "reset"), speed,
|
||||
+ (udev->config) ? "reset" : "new", speed,
|
||||
devnum, driver_name);
|
||||
|
||||
- if (initial) {
|
||||
- /* Set up TT records, if needed */
|
||||
- if (hdev->tt) {
|
||||
- udev->tt = hdev->tt;
|
||||
- udev->ttport = hdev->ttport;
|
||||
- } else if (udev->speed != USB_SPEED_HIGH
|
||||
- && hdev->speed == USB_SPEED_HIGH) {
|
||||
- if (!hub->tt.hub) {
|
||||
- dev_err(&udev->dev, "parent hub has no TT\n");
|
||||
- retval = -EINVAL;
|
||||
- goto fail;
|
||||
- }
|
||||
- udev->tt = &hub->tt;
|
||||
- udev->ttport = port1;
|
||||
+ /* Set up TT records, if needed */
|
||||
+ if (hdev->tt) {
|
||||
+ udev->tt = hdev->tt;
|
||||
+ udev->ttport = hdev->ttport;
|
||||
+ } else if (udev->speed != USB_SPEED_HIGH
|
||||
+ && hdev->speed == USB_SPEED_HIGH) {
|
||||
+ if (!hub->tt.hub) {
|
||||
+ dev_err(&udev->dev, "parent hub has no TT\n");
|
||||
+ retval = -EINVAL;
|
||||
+ goto fail;
|
||||
}
|
||||
+ udev->tt = &hub->tt;
|
||||
+ udev->ttport = port1;
|
||||
}
|
||||
|
||||
/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
|
||||
@@ -4902,6 +4818,9 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
|
||||
for (retries = 0; retries < GET_DESCRIPTOR_TRIES; (++retries, msleep(100))) {
|
||||
if (do_new_scheme) {
|
||||
+ struct usb_device_descriptor *buf;
|
||||
+ int r = 0;
|
||||
+
|
||||
retval = hub_enable_device(udev);
|
||||
if (retval < 0) {
|
||||
dev_err(&udev->dev,
|
||||
@@ -4910,14 +4829,52 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- maxp0 = get_bMaxPacketSize0(udev, buf,
|
||||
- GET_DESCRIPTOR_BUFSIZE, retries == 0);
|
||||
- if (maxp0 > 0 && !initial &&
|
||||
- maxp0 != udev->descriptor.bMaxPacketSize0) {
|
||||
- dev_err(&udev->dev, "device reset changed ep0 maxpacket size!\n");
|
||||
- retval = -ENODEV;
|
||||
- goto fail;
|
||||
+#define GET_DESCRIPTOR_BUFSIZE 64
|
||||
+ buf = kmalloc(GET_DESCRIPTOR_BUFSIZE, GFP_NOIO);
|
||||
+ if (!buf) {
|
||||
+ retval = -ENOMEM;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* Retry on all errors; some devices are flakey.
|
||||
+ * 255 is for WUSB devices, we actually need to use
|
||||
+ * 512 (WUSB1.0[4.8.1]).
|
||||
+ */
|
||||
+ for (operations = 0; operations < GET_MAXPACKET0_TRIES;
|
||||
+ ++operations) {
|
||||
+ buf->bMaxPacketSize0 = 0;
|
||||
+ r = usb_control_msg(udev, usb_rcvaddr0pipe(),
|
||||
+ USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
|
||||
+ USB_DT_DEVICE << 8, 0,
|
||||
+ buf, GET_DESCRIPTOR_BUFSIZE,
|
||||
+ initial_descriptor_timeout);
|
||||
+ switch (buf->bMaxPacketSize0) {
|
||||
+ case 8: case 16: case 32: case 64: case 255:
|
||||
+ if (buf->bDescriptorType ==
|
||||
+ USB_DT_DEVICE) {
|
||||
+ r = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ fallthrough;
|
||||
+ default:
|
||||
+ if (r == 0)
|
||||
+ r = -EPROTO;
|
||||
+ break;
|
||||
+ }
|
||||
+ /*
|
||||
+ * Some devices time out if they are powered on
|
||||
+ * when already connected. They need a second
|
||||
+ * reset. But only on the first attempt,
|
||||
+ * lest we get into a time out/reset loop
|
||||
+ */
|
||||
+ if (r == 0 || (r == -ETIMEDOUT &&
|
||||
+ retries == 0 &&
|
||||
+ udev->speed > USB_SPEED_FULL))
|
||||
+ break;
|
||||
}
|
||||
+ udev->descriptor.bMaxPacketSize0 =
|
||||
+ buf->bMaxPacketSize0;
|
||||
+ kfree(buf);
|
||||
|
||||
retval = hub_port_reset(hub, port1, udev, delay, false);
|
||||
if (retval < 0) /* error or disconnect */
|
||||
@@ -4928,13 +4885,14 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
retval = -ENODEV;
|
||||
goto fail;
|
||||
}
|
||||
- if (maxp0 < 0) {
|
||||
- if (maxp0 != -ENODEV)
|
||||
+ if (r) {
|
||||
+ if (r != -ENODEV)
|
||||
dev_err(&udev->dev, "device descriptor read/64, error %d\n",
|
||||
- maxp0);
|
||||
- retval = maxp0;
|
||||
+ r);
|
||||
+ retval = -EMSGSIZE;
|
||||
continue;
|
||||
}
|
||||
+#undef GET_DESCRIPTOR_BUFSIZE
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4980,22 +4938,18 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
break;
|
||||
}
|
||||
|
||||
- /* !do_new_scheme || wusb */
|
||||
- maxp0 = get_bMaxPacketSize0(udev, buf, 8, retries == 0);
|
||||
- if (maxp0 < 0) {
|
||||
- retval = maxp0;
|
||||
+ retval = usb_get_device_descriptor(udev, 8);
|
||||
+ if (retval < 8) {
|
||||
if (retval != -ENODEV)
|
||||
dev_err(&udev->dev,
|
||||
"device descriptor read/8, error %d\n",
|
||||
retval);
|
||||
+ if (retval >= 0)
|
||||
+ retval = -EMSGSIZE;
|
||||
} else {
|
||||
u32 delay;
|
||||
|
||||
- if (!initial && maxp0 != udev->descriptor.bMaxPacketSize0) {
|
||||
- dev_err(&udev->dev, "device reset changed ep0 maxpacket size!\n");
|
||||
- retval = -ENODEV;
|
||||
- goto fail;
|
||||
- }
|
||||
+ retval = 0;
|
||||
|
||||
delay = udev->parent->hub_delay;
|
||||
udev->hub_delay = min_t(u32, delay,
|
||||
@@ -5014,61 +4968,48 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
goto fail;
|
||||
|
||||
/*
|
||||
- * Check the ep0 maxpacket guess and correct it if necessary.
|
||||
- * maxp0 is the value stored in the device descriptor;
|
||||
- * i is the value it encodes (logarithmic for SuperSpeed or greater).
|
||||
+ * Some superspeed devices have finished the link training process
|
||||
+ * and attached to a superspeed hub port, but the device descriptor
|
||||
+ * got from those devices show they aren't superspeed devices. Warm
|
||||
+ * reset the port attached by the devices can fix them.
|
||||
*/
|
||||
- i = maxp0;
|
||||
- if (udev->speed >= USB_SPEED_SUPER) {
|
||||
- if (maxp0 <= 16)
|
||||
- i = 1 << maxp0;
|
||||
- else
|
||||
- i = 0; /* Invalid */
|
||||
- }
|
||||
- if (usb_endpoint_maxp(&udev->ep0.desc) == i) {
|
||||
- ; /* Initial ep0 maxpacket guess is right */
|
||||
- } else if ((udev->speed == USB_SPEED_FULL ||
|
||||
- udev->speed == USB_SPEED_HIGH) &&
|
||||
- (i == 8 || i == 16 || i == 32 || i == 64)) {
|
||||
- /* Initial guess is wrong; use the descriptor's value */
|
||||
+ if ((udev->speed >= USB_SPEED_SUPER) &&
|
||||
+ (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) {
|
||||
+ dev_err(&udev->dev, "got a wrong device descriptor, "
|
||||
+ "warm reset device\n");
|
||||
+ hub_port_reset(hub, port1, udev,
|
||||
+ HUB_BH_RESET_TIME, true);
|
||||
+ retval = -EINVAL;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (udev->descriptor.bMaxPacketSize0 == 0xff ||
|
||||
+ udev->speed >= USB_SPEED_SUPER)
|
||||
+ i = 512;
|
||||
+ else
|
||||
+ i = udev->descriptor.bMaxPacketSize0;
|
||||
+ if (usb_endpoint_maxp(&udev->ep0.desc) != i) {
|
||||
+ if (udev->speed == USB_SPEED_LOW ||
|
||||
+ !(i == 8 || i == 16 || i == 32 || i == 64)) {
|
||||
+ dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", i);
|
||||
+ retval = -EMSGSIZE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
if (udev->speed == USB_SPEED_FULL)
|
||||
dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i);
|
||||
else
|
||||
dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i);
|
||||
udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i);
|
||||
usb_ep0_reinit(udev);
|
||||
- } else {
|
||||
- /* Initial guess is wrong and descriptor's value is invalid */
|
||||
- dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", maxp0);
|
||||
- retval = -EMSGSIZE;
|
||||
- goto fail;
|
||||
}
|
||||
|
||||
- descr = usb_get_device_descriptor(udev);
|
||||
- if (IS_ERR(descr)) {
|
||||
- retval = PTR_ERR(descr);
|
||||
+ retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE);
|
||||
+ if (retval < (signed)sizeof(udev->descriptor)) {
|
||||
if (retval != -ENODEV)
|
||||
dev_err(&udev->dev, "device descriptor read/all, error %d\n",
|
||||
retval);
|
||||
- goto fail;
|
||||
- }
|
||||
- if (initial)
|
||||
- udev->descriptor = *descr;
|
||||
- else
|
||||
- *dev_descr = *descr;
|
||||
- kfree(descr);
|
||||
-
|
||||
- /*
|
||||
- * Some superspeed devices have finished the link training process
|
||||
- * and attached to a superspeed hub port, but the device descriptor
|
||||
- * got from those devices show they aren't superspeed devices. Warm
|
||||
- * reset the port attached by the devices can fix them.
|
||||
- */
|
||||
- if ((udev->speed >= USB_SPEED_SUPER) &&
|
||||
- (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) {
|
||||
- dev_err(&udev->dev, "got a wrong device descriptor, warm reset device\n");
|
||||
- hub_port_reset(hub, port1, udev, HUB_BH_RESET_TIME, true);
|
||||
- retval = -EINVAL;
|
||||
+ if (retval >= 0)
|
||||
+ retval = -ENOMSG;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -5094,7 +5035,6 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
|
||||
hub_port_disable(hub, port1, 0);
|
||||
update_devnum(udev, devnum); /* for disconnect processing */
|
||||
}
|
||||
- kfree(buf);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -5175,7 +5115,7 @@ hub_power_remaining(struct usb_hub *hub)
|
||||
|
||||
|
||||
static int descriptors_changed(struct usb_device *udev,
|
||||
- struct usb_device_descriptor *new_device_descriptor,
|
||||
+ struct usb_device_descriptor *old_device_descriptor,
|
||||
struct usb_host_bos *old_bos)
|
||||
{
|
||||
int changed = 0;
|
||||
@@ -5186,8 +5126,8 @@ static int descriptors_changed(struct usb_device *udev,
|
||||
int length;
|
||||
char *buf;
|
||||
|
||||
- if (memcmp(&udev->descriptor, new_device_descriptor,
|
||||
- sizeof(*new_device_descriptor)) != 0)
|
||||
+ if (memcmp(&udev->descriptor, old_device_descriptor,
|
||||
+ sizeof(*old_device_descriptor)) != 0)
|
||||
return 1;
|
||||
|
||||
if ((old_bos && !udev->bos) || (!old_bos && udev->bos))
|
||||
@@ -5360,7 +5300,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
|
||||
}
|
||||
|
||||
/* reset (non-USB 3.0 devices) and get descriptor */
|
||||
- status = hub_port_init(hub, udev, port1, i, NULL);
|
||||
+ status = hub_port_init(hub, udev, port1, i);
|
||||
if (status < 0)
|
||||
goto loop;
|
||||
|
||||
@@ -5507,8 +5447,9 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
|
||||
{
|
||||
struct usb_port *port_dev = hub->ports[port1 - 1];
|
||||
struct usb_device *udev = port_dev->child;
|
||||
- struct usb_device_descriptor *descr;
|
||||
+ struct usb_device_descriptor descriptor;
|
||||
int status = -ENODEV;
|
||||
+ int retval;
|
||||
|
||||
dev_dbg(&port_dev->dev, "status %04x, change %04x, %s\n", portstatus,
|
||||
portchange, portspeed(hub, portstatus));
|
||||
@@ -5535,20 +5476,23 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
|
||||
* changed device descriptors before resuscitating the
|
||||
* device.
|
||||
*/
|
||||
- descr = usb_get_device_descriptor(udev);
|
||||
- if (IS_ERR(descr)) {
|
||||
+ descriptor = udev->descriptor;
|
||||
+ retval = usb_get_device_descriptor(udev,
|
||||
+ sizeof(udev->descriptor));
|
||||
+ if (retval < 0) {
|
||||
dev_dbg(&udev->dev,
|
||||
- "can't read device descriptor %ld\n",
|
||||
- PTR_ERR(descr));
|
||||
+ "can't read device descriptor %d\n",
|
||||
+ retval);
|
||||
} else {
|
||||
- if (descriptors_changed(udev, descr,
|
||||
+ if (descriptors_changed(udev, &descriptor,
|
||||
udev->bos)) {
|
||||
dev_dbg(&udev->dev,
|
||||
"device descriptor has changed\n");
|
||||
+ /* for disconnect() calls */
|
||||
+ udev->descriptor = descriptor;
|
||||
} else {
|
||||
status = 0; /* Nothing to do */
|
||||
}
|
||||
- kfree(descr);
|
||||
}
|
||||
#ifdef CONFIG_PM
|
||||
} else if (udev->state == USB_STATE_SUSPENDED &&
|
||||
@@ -5986,7 +5930,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
|
||||
struct usb_device *parent_hdev = udev->parent;
|
||||
struct usb_hub *parent_hub;
|
||||
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
|
||||
- struct usb_device_descriptor descriptor;
|
||||
+ struct usb_device_descriptor descriptor = udev->descriptor;
|
||||
struct usb_host_bos *bos;
|
||||
int i, j, ret = 0;
|
||||
int port1 = udev->portnum;
|
||||
@@ -6018,7 +5962,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
|
||||
/* ep0 maxpacket size may change; let the HCD know about it.
|
||||
* Other endpoints will be handled by re-enumeration. */
|
||||
usb_ep0_reinit(udev);
|
||||
- ret = hub_port_init(parent_hub, udev, port1, i, &descriptor);
|
||||
+ ret = hub_port_init(parent_hub, udev, port1, i);
|
||||
if (ret >= 0 || ret == -ENOTCONN || ret == -ENODEV)
|
||||
break;
|
||||
}
|
||||
@@ -6030,6 +5974,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
|
||||
/* Device might have changed firmware (DFU or similar) */
|
||||
if (descriptors_changed(udev, &descriptor, bos)) {
|
||||
dev_info(&udev->dev, "device firmware changed\n");
|
||||
+ udev->descriptor = descriptor; /* for disconnect() calls */
|
||||
goto re_enumerate;
|
||||
}
|
||||
|
||||
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
|
||||
index 678c43234d65f..e8045997d6ec2 100644
|
||||
--- a/drivers/usb/core/message.c
|
||||
+++ b/drivers/usb/core/message.c
|
||||
@@ -1039,35 +1039,40 @@ char *usb_cache_string(struct usb_device *udev, int index)
|
||||
}
|
||||
|
||||
/*
|
||||
- * usb_get_device_descriptor - read the device descriptor
|
||||
- * @udev: the device whose device descriptor should be read
|
||||
+ * usb_get_device_descriptor - (re)reads the device descriptor (usbcore)
|
||||
+ * @dev: the device whose device descriptor is being updated
|
||||
+ * @size: how much of the descriptor to read
|
||||
*
|
||||
* Context: task context, might sleep.
|
||||
*
|
||||
+ * Updates the copy of the device descriptor stored in the device structure,
|
||||
+ * which dedicates space for this purpose.
|
||||
+ *
|
||||
* Not exported, only for use by the core. If drivers really want to read
|
||||
* the device descriptor directly, they can call usb_get_descriptor() with
|
||||
* type = USB_DT_DEVICE and index = 0.
|
||||
*
|
||||
- * Returns: a pointer to a dynamically allocated usb_device_descriptor
|
||||
- * structure (which the caller must deallocate), or an ERR_PTR value.
|
||||
+ * This call is synchronous, and may not be used in an interrupt context.
|
||||
+ *
|
||||
+ * Return: The number of bytes received on success, or else the status code
|
||||
+ * returned by the underlying usb_control_msg() call.
|
||||
*/
|
||||
-struct usb_device_descriptor *usb_get_device_descriptor(struct usb_device *udev)
|
||||
+int usb_get_device_descriptor(struct usb_device *dev, unsigned int size)
|
||||
{
|
||||
struct usb_device_descriptor *desc;
|
||||
int ret;
|
||||
|
||||
+ if (size > sizeof(*desc))
|
||||
+ return -EINVAL;
|
||||
desc = kmalloc(sizeof(*desc), GFP_NOIO);
|
||||
if (!desc)
|
||||
- return ERR_PTR(-ENOMEM);
|
||||
-
|
||||
- ret = usb_get_descriptor(udev, USB_DT_DEVICE, 0, desc, sizeof(*desc));
|
||||
- if (ret == sizeof(*desc))
|
||||
- return desc;
|
||||
+ return -ENOMEM;
|
||||
|
||||
+ ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, size);
|
||||
if (ret >= 0)
|
||||
- ret = -EMSGSIZE;
|
||||
+ memcpy(&dev->descriptor, desc, size);
|
||||
kfree(desc);
|
||||
- return ERR_PTR(ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
|
||||
index 3bb2e1db42b5d..82538daac8b89 100644
|
||||
--- a/drivers/usb/core/usb.h
|
||||
+++ b/drivers/usb/core/usb.h
|
||||
@@ -42,8 +42,8 @@ extern bool usb_endpoint_is_ignored(struct usb_device *udev,
|
||||
struct usb_endpoint_descriptor *epd);
|
||||
extern int usb_remove_device(struct usb_device *udev);
|
||||
|
||||
-extern struct usb_device_descriptor *usb_get_device_descriptor(
|
||||
- struct usb_device *udev);
|
||||
+extern int usb_get_device_descriptor(struct usb_device *dev,
|
||||
+ unsigned int size);
|
||||
extern int usb_set_isoch_delay(struct usb_device *dev);
|
||||
extern int usb_get_bos_descriptor(struct usb_device *dev);
|
||||
extern void usb_release_bos_descriptor(struct usb_device *dev);
|
||||
--
|
||||
2.37.3
|
||||
|
@@ -0,0 +1,30 @@
|
||||
From 8b7bfad7fda35949975f359c7e207bc57bc765db Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= <sairon@sairon.cz>
|
||||
Date: Mon, 15 Apr 2024 14:07:34 +0200
|
||||
Subject: [PATCH] USB: storage: Increase maximum length of the quirks string
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Maximum length of the quirks string is 127 characters which is not sufficient
|
||||
for the already long list of quirky controllers in HAOS. Increase the size of
|
||||
the quirks variable to allow up to 255 characters.
|
||||
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/usb/storage/usb.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
|
||||
index 7b36a3334fb34..9691e6b9fe5aa 100644
|
||||
--- a/drivers/usb/storage/usb.c
|
||||
+++ b/drivers/usb/storage/usb.c
|
||||
@@ -71,7 +71,7 @@ static unsigned int delay_use = 1;
|
||||
module_param(delay_use, uint, S_IRUGO | S_IWUSR);
|
||||
MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
|
||||
|
||||
-static char quirks[128];
|
||||
+static char quirks[256];
|
||||
module_param_string(quirks, quirks, sizeof(quirks), S_IRUGO | S_IWUSR);
|
||||
MODULE_PARM_DESC(quirks, "supplemental list of device IDs and their quirks");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user