Skip to content

Commit 0ca16df

Browse files
MDr164bluecmd
andauthored
Rebase bootlock against 5.10 (#215)
* Add go modules support and fix syntax Fixed deprecated syntax and introduced go modules support. Signed-off-by: Marvin Drees <[email protected]> * bootlock: Rebase against 5.10 Upgraded bootlock code to 5.10 sources and update CircleCI image along the way. Signed-off-by: Marvin Drees <[email protected]> Co-authored-by: Christian Svensson <[email protected]>
1 parent fcbedea commit 0ca16df

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

Diff for: .circleci/config.yml

+13-14
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ workflows:
3030
jobs:
3131
clean-code:
3232
docker:
33-
- image: circleci/golang:1.13
34-
working_directory: /go/src/github.com/u-root/u-bmc
33+
- image: cimg/go:1.16.5
34+
working_directory: ~/go/src/github.com/u-root/u-bmc
3535
steps:
3636
- checkout
3737
- run:
3838
name: Install dep
3939
command: |
40-
wget https://github.com/golang/dep/releases/download/v0.5.1/dep-linux-amd64
40+
wget https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64
4141
mv dep-linux-amd64 dep
4242
chmod +x dep
4343
- run:
@@ -62,8 +62,8 @@ jobs:
6262
command: ineffassign .
6363
test:
6464
docker:
65-
- image: circleci/golang:1.13
66-
working_directory: /go/src/github.com/u-root/u-bmc
65+
- image: cimg/go:1.16.5
66+
working_directory: ~/go/src/github.com/u-root/u-bmc
6767
environment:
6868
- CGO_ENABLED: 0
6969
steps:
@@ -84,8 +84,8 @@ jobs:
8484
command: make test TESTFLAGS=-cover
8585
race:
8686
docker:
87-
- image: circleci/golang:1.13
88-
working_directory: /go/src/github.com/u-root/u-bmc
87+
- image: cimg/go:1.16.5
88+
working_directory: ~/go/src/github.com/u-root/u-bmc
8989
environment:
9090
- CGO_ENABLED: 1
9191
steps:
@@ -103,8 +103,8 @@ jobs:
103103
make test TESTFLAGS=-race
104104
compile:
105105
docker:
106-
- image: circleci/golang:1.13
107-
working_directory: /go/src/github.com/u-root/u-bmc
106+
- image: cimg/go:1.16.5
107+
working_directory: ~/go/src/github.com/u-root/u-bmc
108108
environment:
109109
- CGO_ENABLED: 0
110110
steps:
@@ -125,20 +125,19 @@ jobs:
125125
go install -a ./platform/quanta-f06-leopard-ddr3/cmd/uinit
126126
image:
127127
docker:
128-
- image: circleci/golang:1.13
129-
working_directory: /go/src/github.com/u-root/u-bmc
128+
- image: cimg/go:1.16.5
129+
working_directory: ~/go/src/github.com/u-root/u-bmc
130130
environment:
131131
- CGO_ENABLED: 0
132-
- GO111MODULE: "on"
133132
steps:
134133
- checkout
135134
- run:
136135
name: Install dependencies
137136
command: |
138137
sudo apt-get update
139138
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
140-
go mod download
141-
go mod verify
139+
go mod vendor
140+
GO111MODULE=off go get github.com/u-root/u-root
142141
- run:
143142
name: Create test key
144143
command: |

Diff for: Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ flash.sim.img: flash.img
298298

299299
initramfs.cpio: u-bmc ssh_keys.pub config/config.go $(shell find $(ROOT_DIR)cmd $(ROOT_DIR)platform/$(PLATFORM) $(ROOT_DIR)pkg $(ROOT_DIR)proto -name \*.go -type f)
300300
go generate ./config/
301+
rm -r vendor/github.com/u-root/u-root
302+
ln -sf ../../../../u-root vendor/github.com/u-root
301303
GOARM=5 GOARCH=$(ARCH) ./u-bmc -o "$@.tmp" -p "$(PLATFORM)"
302304
mv "$@.tmp" "$@"
303305

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ touch config/i_agree_to_the_acme_terms
8383
go generate ./config/
8484
```
8585

86-
Builld image:
86+
Build image:
8787
```
8888
make get
8989
make

Diff for: module/bootlock.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define COMMON_OP_RDSR 0x05
2525

2626
static struct spi_nor *nor;
27+
static struct spi_nor_controller_ops *ctrl;
2728
static void __iomem* aspeed_fmc_base;
2829
static void __iomem* aspeed_nor_base;
2930

@@ -114,7 +115,7 @@ static ssize_t lock_show(struct kobject *kobj, struct kobj_attribute *attr,
114115
uint32_t addr;
115116

116117
mutex_lock(&nor->lock);
117-
nor->prepare(nor, SPI_NOR_OPS_LOCK);
118+
ctrl->prepare(nor);
118119
aspeed_user_control(1);
119120

120121
if (!device_supported()) {
@@ -140,7 +141,7 @@ static ssize_t lock_show(struct kobject *kobj, struct kobj_attribute *attr,
140141

141142
read_err:
142143
aspeed_user_control(0);
143-
nor->unprepare(nor, SPI_NOR_OPS_LOCK);
144+
ctrl->unprepare(nor);
144145
mutex_unlock(&nor->lock);
145146
if (ret < 0) {
146147
return ret;
@@ -157,7 +158,7 @@ static ssize_t lock_store(struct kobject *kobj, struct kobj_attribute *attr,
157158
uint32_t addr;
158159

159160
mutex_lock(&nor->lock);
160-
nor->prepare(nor, SPI_NOR_OPS_LOCK);
161+
ctrl->prepare(nor);
161162
aspeed_user_control(1);
162163

163164
if (!device_supported()) {
@@ -176,7 +177,7 @@ static ssize_t lock_store(struct kobject *kobj, struct kobj_attribute *attr,
176177

177178
lock_err:
178179
aspeed_user_control(0);
179-
nor->unprepare(nor, SPI_NOR_OPS_LOCK);
180+
ctrl->unprepare(nor);
180181
mutex_unlock(&nor->lock);
181182
return ret < 0 ? ret : count;
182183
}

Diff for: pkg/bmc/grpc_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func TestStreamConsoleTransmit(t *testing.T) {
125125
go func() {
126126
err := sc.Send(&pb.ConsoleData{Data: []byte(expected)})
127127
if err != nil {
128-
t.Fatalf("sc.Send: %v", err)
128+
t.Errorf("sc.Send: %v", err) // should be Fatalf but vet complains
129129
}
130130
}()
131131

0 commit comments

Comments
 (0)