Skip to content

Commit 7d77fc0

Browse files
authored
Add Qemu/integration platform (#222)
* Copy paste some stuff over for qemu WIP commit to integrate a dedicated integration target based of generic arm Qemu and to fix the broken simulator Signed-off-by: Marvin Drees <[email protected]> * Add 32bit and 64bit qemu platform folders Add basic Qemu platform folders to allow both integration and the simulator to be dedicated targets, also allow testing on both 32bit and 64bit Signed-off-by: Marvin Drees <[email protected]> * Add block device support to loader Make the boot/ directory a go submodule to be able to use u-root as a module dependency and add support to also mount block devices and not only MTD flash. Signed-off-by: Marvin Drees <[email protected]> * Switch from u-root to gobusybox+u-root Because u-root wasn't able to properly create the busybox binary now that we use go modules I switched to using gobusybox instead which in turn wasn't able to work properly with direct code dependencies in u-bmc on u-root. The loader is already in its own submodule to account for that, othre parts still need adoption now! Signed-off-by: Marvin Drees <[email protected]> * Restructure taskfile flow and directories Qemu needs different components from the buildsystem than e.g. ast socs need so we make more use of the Platform.yml file now and split tasks up further. In addition we don't need go vendoring anymore so removed these from the gitignores and taskfiles. Finally the streamline the linux configs for qemu a bit more. 32bit still has some issues for now. Signed-off-by: Marvin Drees <[email protected]> * Update go.mod Update go.mod and go.sum to go 1.17 Signed-off-by: Marvin Drees <[email protected]> * Fix paths in taskfiles Some paths were wrong and have been fixed now. This commit is part of adding Qemu support and very much WIP. The added kexec binary is only for testing purposes and will be removed soon. Signed-off-by: Marvin Drees <[email protected]> * Add boot/mounter In order to account for future rootfs layouts that need a readonly and readwrite part a new mounter is introduced which is loaded by the runtime kernel initramfs and executes the main init. Signed-off-by: Marvin Drees <[email protected]> * Add boot/cpio to pack the initrd The boot/cpio tool uses u-roots cpio library to assemble an initrd for both the LinuxBoot and runtime kernel. This removes the need for and external cpio command and makes creating the initrds much easier. Signed-off-by: Marvin Drees <[email protected]> * Fix boot/loader implementation of kexec The loader tool can now be used in both the LinuxBoot and runtime initrd and does not rely on having a kexec binary in the image as we already got proper kexec_load support on both arm and arm64. On arm64 the loader tries kexec_file_load first and falls back to kexec_load if it did not succeed. Signed-off-by: Marvin Drees <[email protected]> * Remove nested go.mod For some reason gobusybox now works without the workaround of having a nested go.mod. I won't question it... Signed-off-by: Marvin Drees <[email protected]> * Update CircleCI to go 1.17.1 Update the circleci config to remove some unnecessary steps like go vendor and update the go version to match the one marked in the go.mod files Signed-off-by: Marvin Drees <[email protected]> * Update README Signed-off-by: Marvin Drees <[email protected]> * Satisfy gofmt As we updated go to 1.17 we got slightly different requirements with gofmt, those are now fixed. Signed-off-by: Marvin Drees <[email protected]> * Change qemu-virt-a72 toolchain As CircleCI and regular Ubuntu images don't feature a musl toolchain we switch back to gnu for the kernel. Signed-off-by: Marvin Drees <[email protected]> * Compile erofs-utils in CircleCI Because the current CircleCI image does not contain a recent enough erofs-utils version we need to compile one from source there. Signed-off-by: Marvin Drees <[email protected]>
1 parent a64146a commit 7d77fc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1577
-705
lines changed

.circleci/config.yml

+34-31
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ workflows:
3131
jobs:
3232
clean-code:
3333
docker:
34-
- image: cimg/go:1.16.7
34+
- image: cimg/go:1.17.1
3535
working_directory: ~/go/src/github.com/u-root/u-bmc
36-
environment:
37-
- CGO_ENABLED: 0
3836
steps:
3937
- checkout
4038
- run:
@@ -48,26 +46,21 @@ jobs:
4846
command: |
4947
ssh-keygen -t rsa -b 4096 -C "testkey" -N "testpass" -f config/ssh_keys
5048
touch i_agree_to_the_acme_terms
51-
echo quanta-f06-leopard-ddr3 > TARGET
49+
echo qemu-virt-a72 > TARGET
5250
task config:generate
53-
- run:
54-
name: vendor
55-
command: go mod vendor
5651
- run:
5752
name: vet
58-
command: go vet $(go list ./... | grep -v vendor/)
53+
command: go vet $(go list ./...)
5954
- run:
6055
name: gofmt
61-
command: test -z "$(gofmt -s -l $(go list ./... | grep -v vendor/ | cut -f 4- -d '/'))"
56+
command: test -z "$(gofmt -s -l $(go list ./... | cut -f 4- -d '/'))"
6257
- run:
6358
name: ineffassign
6459
command: ineffassign .
6560
test:
6661
docker:
67-
- image: cimg/go:1.16.7
62+
- image: cimg/go:1.17.1
6863
working_directory: ~/go/src/github.com/u-root/u-bmc
69-
environment:
70-
- CGO_ENABLED: 0
7164
steps:
7265
- checkout
7366
- run:
@@ -78,7 +71,7 @@ jobs:
7871
command: |
7972
ssh-keygen -t rsa -b 4096 -C "testkey" -N "testpass" -f config/ssh_keys
8073
touch i_agree_to_the_acme_terms
81-
echo quanta-f06-leopard-ddr3 > TARGET
74+
echo qemu-virt-a72 > TARGET
8275
task config:generate
8376
- run:
8477
name: Test all
@@ -88,10 +81,8 @@ jobs:
8881
command: task coverage
8982
race:
9083
docker:
91-
- image: cimg/go:1.16.7
84+
- image: cimg/go:1.17.1
9285
working_directory: ~/go/src/github.com/u-root/u-bmc
93-
environment:
94-
- CGO_ENABLED: 1
9586
steps:
9687
- checkout
9788
- run:
@@ -102,17 +93,15 @@ jobs:
10293
command: |
10394
ssh-keygen -t rsa -b 4096 -C "testkey" -N "testpass" -f config/ssh_keys
10495
touch i_agree_to_the_acme_terms
105-
echo quanta-f06-leopard-ddr3 > TARGET
96+
echo qemu-virt-a72 > TARGET
10697
task config:generate
10798
- run:
10899
name: Race detector
109100
command: task race
110101
compile:
111102
docker:
112-
- image: cimg/go:1.16.7
103+
- image: cimg/go:1.17.1
113104
working_directory: ~/go/src/github.com/u-root/u-bmc
114-
environment:
115-
- CGO_ENABLED: 0
116105
steps:
117106
- checkout
118107
- run:
@@ -123,43 +112,57 @@ jobs:
123112
command: |
124113
ssh-keygen -t rsa -b 4096 -C "testkey" -N "testpass" -f config/ssh_keys
125114
touch i_agree_to_the_acme_terms
126-
echo quanta-f06-leopard-ddr3 > TARGET
115+
echo qemu-virt-a72 > TARGET
127116
task config:generate
128117
- run:
129118
name: build all commands
130119
command: |
131120
cd cmd
132121
go install -a ./...
133122
cd ../
134-
go install -a ./platform/quanta-f06-leopard-ddr3/cmd/uinit
123+
go install -a ./platform/qemu-virt-a72/cmd/uinit
135124
image:
136125
docker:
137-
- image: cimg/go:1.16.7
126+
- image: cimg/go:1.17.1
138127
working_directory: ~/go/src/github.com/u-root/u-bmc
139-
environment:
140-
- CGO_ENABLED: 0
141128
steps:
142129
- checkout
143130
- run:
144131
name: Install dependencies
145-
# Workaround for u-root only needed until proper modules support is in place
146132
command: |
147-
sudo apt-get update
148-
sudo apt-get install gcc-arm-none-eabi mtd-utils fakeroot flex bison device-tree-compiler bc libssl-dev zlib1g-dev libglib2.0-dev libpixman-1-dev unzip cpio patch libelf-dev qemu-kvm
133+
sudo apt update
134+
sudo apt install gcc-aarch64-linux-gnu fakeroot flex bison bc patch libssl-dev zlib1g-dev libelf-dev qemu-kvm
149135
GO111MODULE=off go get github.com/u-root/u-root
150136
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
137+
# Because the included version is too old and lacks the -U flag...
138+
- run:
139+
name: Compile erofs-utils
140+
command: |
141+
sudo apt install libtool liblz4-dev uuid-dev
142+
cd ~/
143+
curl -O https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/snapshot/erofs-utils-1.3.tar.gz
144+
tar -xzf erofs-utils-1.3.tar.gz
145+
cd erofs-utils-1.3
146+
./autogen.sh
147+
./configure
148+
make
149+
sudo make install
150+
sudo ln -sf /usr/local/bin/mkfs.erofs /usr/bin/mkfs.erofs
151151
- run:
152152
name: Create test key
153153
command: |
154154
ssh-keygen -t rsa -b 4096 -C "testkey" -N "testpass" -f config/ssh_keys
155155
touch i_agree_to_the_acme_terms
156-
echo quanta-f06-leopard-ddr3 > TARGET
156+
echo qemu-virt-a72 > TARGET
157157
- run:
158158
name: Build image
159159
command: task build
160160
- store_artifacts:
161-
path: build/flash.img
162-
destination: flash.img
161+
path: build/img/rootfs.img
162+
destination: rootfs.img
163+
- store_artifacts:
164+
path: build/linux/zImage.boot
165+
destination: zImage.boot
163166
- run:
164167
name: Run integration tests
165168
command: task integration

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
vendor/*
21
build/*
32
.task/*
43
i_agree_to_the_acme_terms

0 commit comments

Comments
 (0)