Skip to content

Commit 12bdc41

Browse files
committed
Auto merge of #950 - wezm:update-freebsd-ci-image, r=alexcrichton
Update the FreeBSD CI image As per #948 and #799 the FreeBSD CI qemu image needs to be updated to FreeBSD 11. I have done this and updated the README with the detailed steps taken. The new image is available for download at: http://bsd-ci.com/FreeBSD-11.1-RELEASE-amd64.qcow2.xz
2 parents 9c56176 + cddc338 commit 12bdc41

File tree

5 files changed

+86
-36
lines changed

5 files changed

+86
-36
lines changed

ci/README.md

+66-26
Original file line numberDiff line numberDiff line change
@@ -128,32 +128,72 @@ QEMU is available, and if so mount it, run a script (it'll specifically be
128128
`run-qemu.sh` in this folder which is copied into the generated image talked
129129
about above), and then shut down.
130130

131-
### QEMU setup - FreeBSD
132-
133-
1. Download CD installer (most minimal is fine)
134-
2. `qemu-img create -f qcow2 foo.qcow2 2G`
135-
3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user`
136-
4. run installer
137-
5. `echo 'console="comconsole"' >> /boot/loader.conf`
138-
6. `echo 'autoboot_delay="0"' >> /boot/loader.conf`
139-
7. look at /etc/ttys, see what getty argument is for ttyu0
140-
8. edit /etc/gettytab, look for ttyu0 argument, prepend `:al=root` to line
141-
beneath
142-
143-
(note that the current image has a `freebsd` user, but this isn't really
144-
necessary)
145-
146-
Once that's done, arrange for this script to run at login:
147-
148-
```
149-
#!/bin/sh
150-
151-
sudo kldload ext2fs
152-
[ -e /dev/vtbd1 ] || exit 0
153-
sudo mount -t ext2fs /dev/vtbd1 /mnt
154-
sh /mnt/run.sh /mnt
155-
sudo poweroff
156-
```
131+
### QEMU Setup - FreeBSD
132+
133+
1. [Download the latest stable amd64-bootonly release ISO](https://www.freebsd.org/where.html).
134+
E.g. FreeBSD-11.1-RELEASE-amd64-bootonly.iso
135+
2. Create the disk image: `qemu-img create -f qcow2 FreeBSD-11.1-RELEASE-amd64.qcow2 2G`
136+
3. Boot the machine: `qemu-system-x86_64 -cdrom FreeBSD-11.1-RELEASE-amd64-bootonly.iso -drive if=virtio,file=FreeBSD-11.1-RELEASE-amd64.qcow2 -net nic,model=virtio -net user`
137+
4. Run the installer, and install FreeBSD:
138+
1. Install
139+
1. Continue with default keymap
140+
1. Set Hostname: freebsd-ci
141+
1. Distribution Select:
142+
1. Uncheck lib32
143+
1. Uncheck ports
144+
1. Network Configuration: vtnet0
145+
1. Configure IPv4? Yes
146+
1. DHCP? Yes
147+
1. Configure IPv6? No
148+
1. Resolver Configuration: Ok
149+
1. Mirror Selection: Main Site
150+
1. Partitioning: Auto (UFS)
151+
1. Partition: Entire Disk
152+
1. Partition Scheme: MBR
153+
1. App Partition: Ok
154+
1. Partition Editor: Finish
155+
1. Confirmation: Commit
156+
1. Wait for sets to install
157+
1. Set the root password to nothing (press enter twice)
158+
1. Set time zone to UTC
159+
1. Set Date: Skip
160+
1. Set Time: Skip
161+
1. System Configuration:
162+
1. Disable sshd
163+
1. Disable dumpdev
164+
1. System Hardening
165+
1. Disable Sendmail service
166+
1. Add User Accounts: No
167+
1. Final Configuration: Exit
168+
1. Manual Configuration: Yes
169+
1. `echo 'console="comconsole"' >> /boot/loader.conf`
170+
1. `echo 'autoboot_delay="0"' >> /boot/loader.conf`
171+
1. `echo 'ext2fs_load="YES"' >> /boot/loader.conf`
172+
1. Look at `/etc/ttys`, see what getty argument is for `ttyu0` (E.g. `3wire`)
173+
1. Edit `/etc/gettytab` (with `vi` for example), look for `ttyu0` argument,
174+
prepend `:al=root` to the line beneath to have the machine auto-login as
175+
root. E.g.
176+
177+
3wire:\
178+
:np:nc:sp#0:
179+
becomes:
180+
181+
3wire:\
182+
:al=root:np:nc:sp#0:
183+
184+
1. Edit `/root/.login` and put this in it:
185+
186+
[ -e /dev/vtbd1 ] || exit 0
187+
mount -t ext2fs /dev/vtbd1 /mnt
188+
sh /mnt/run.sh /mnt
189+
poweroff
190+
191+
1. Exit the post install shell: `exit`
192+
1. Back in in the installer choose Reboot
193+
1. If all went well the machine should reboot and show a login prompt.
194+
If you switch to the serial console by choosing View > serial0 in
195+
the qemu menu, you should be logged in as root.
196+
1. Shutdown the machine: `shutdown -p now`
157197

158198
Helpful links
159199

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
FROM alexcrichton/port-prebuilt-freebsd:2017-09-16
1+
FROM wezm/port-prebuilt-freebsd11@sha256:43553e2265ec702ec72a63a765df333f50b1858b896e69385749e96d8624e9b0
22

33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
5-
qemu genext2fs
5+
qemu genext2fs xz-utils
66
RUN apt-get install -y curl ca-certificates gcc
77

88
ENTRYPOINT ["sh"]
99

1010
ENV PATH=$PATH:/rust/bin \
11-
QEMU=2016-11-06/freebsd.qcow2.gz \
11+
QEMU=2018-03-15/FreeBSD-11.1-RELEASE-amd64.qcow2.xz \
1212
CAN_CROSS=1 \
13-
CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc
13+
CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd11-gcc

ci/run.sh

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ if [ "$QEMU" != "" ]; then
2424
curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \
2525
gunzip -d > $tmpdir/$qemufile
2626
fi
27+
elif [ -z "${QEMU#*.xz}" ]; then
28+
# image is .xz : download and uncompress it
29+
qemufile=$(echo ${QEMU%.xz} | sed 's/\//__/g')
30+
if [ ! -f $tmpdir/$qemufile ]; then
31+
curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \
32+
unxz > $tmpdir/$qemufile
33+
fi
2734
else
2835
# plain qcow2 image: just download it
2936
qemufile=$(echo ${QEMU} | sed 's/\//__/g')

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ fn main() {
509509
"CTL_MAXID" |
510510
"KERN_MAXID" |
511511
"HW_MAXID" |
512+
"NET_MAXID" |
512513
"USER_MAXID" if freebsd => true,
513514

514515
// These constants were added in FreeBSD 11

src/unix/bsd/freebsdlike/freebsd/mod.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub type clock_t = i32;
33
pub type ino_t = u32;
44
pub type lwpid_t = i32;
55
pub type nlink_t = u16;
6-
pub type blksize_t = u32;
6+
pub type blksize_t = i32;
77
pub type clockid_t = ::c_int;
88
pub type sem_t = _sem;
99

@@ -182,7 +182,9 @@ pub const EOWNERDEAD: ::c_int = 96;
182182
pub const ELAST: ::c_int = 96;
183183
pub const RLIMIT_NPTS: ::c_int = 11;
184184
pub const RLIMIT_SWAP: ::c_int = 12;
185-
pub const RLIM_NLIMITS: ::rlim_t = 13;
185+
pub const RLIMIT_KQUEUES: ::c_int = 13;
186+
pub const RLIMIT_UMTXP: ::c_int = 14;
187+
pub const RLIM_NLIMITS: ::rlim_t = 15;
186188

187189
pub const Q_GETQUOTA: ::c_int = 0x700;
188190
pub const Q_SETQUOTA: ::c_int = 0x800;
@@ -801,10 +803,10 @@ pub const SHUTDOWN_TIME: ::c_short = 8;
801803

802804
pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
803805
pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
804-
pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
805-
pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
806-
pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
807-
pub const LC_TIME_MASK: ::c_int = (1 << 5);
806+
pub const LC_MONETARY_MASK: ::c_int =(1 << 2);
807+
pub const LC_NUMERIC_MASK: ::c_int = (1 << 3);
808+
pub const LC_TIME_MASK: ::c_int = (1 << 4);
809+
pub const LC_MESSAGES_MASK: ::c_int = (1 << 5);
808810
pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
809811
| LC_CTYPE_MASK
810812
| LC_MESSAGES_MASK

0 commit comments

Comments
 (0)