diff options
author | bors <bors@rust-lang.org> | 2018-03-16 20:09:52 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2018-03-16 20:09:52 +0000 |
commit | 12bdc41b8ee100b1578a51db0fa690ac0836cd39 (patch) | |
tree | ff3d43611dab275e75b2b05ec0fb9615dd0530cc | |
parent | 9c561768f9435428d847f18fd777dbd4e369317d (diff) | |
parent | cddc3385ce6e1c66b7871c916a283488a9f0b95b (diff) | |
download | rust-libc-12bdc41b8ee100b1578a51db0fa690ac0836cd39.tar.gz |
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
-rw-r--r-- | ci/README.md | 92 | ||||
-rw-r--r-- | ci/docker/x86_64-unknown-freebsd/Dockerfile | 8 | ||||
-rwxr-xr-x | ci/run.sh | 7 | ||||
-rw-r--r-- | libc-test/build.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/mod.rs | 14 |
5 files changed, 86 insertions, 36 deletions
diff --git a/ci/README.md b/ci/README.md index aef6ef1db1..28152e5d00 100644 --- a/ci/README.md +++ b/ci/README.md @@ -128,32 +128,72 @@ QEMU is available, and if so mount it, run a script (it'll specifically be `run-qemu.sh` in this folder which is copied into the generated image talked about above), and then shut down. -### QEMU setup - FreeBSD - -1. Download CD installer (most minimal is fine) -2. `qemu-img create -f qcow2 foo.qcow2 2G` -3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user` -4. run installer -5. `echo 'console="comconsole"' >> /boot/loader.conf` -6. `echo 'autoboot_delay="0"' >> /boot/loader.conf` -7. look at /etc/ttys, see what getty argument is for ttyu0 -8. edit /etc/gettytab, look for ttyu0 argument, prepend `:al=root` to line - beneath - -(note that the current image has a `freebsd` user, but this isn't really -necessary) - -Once that's done, arrange for this script to run at login: - -``` -#!/bin/sh - -sudo kldload ext2fs -[ -e /dev/vtbd1 ] || exit 0 -sudo mount -t ext2fs /dev/vtbd1 /mnt -sh /mnt/run.sh /mnt -sudo poweroff -``` +### QEMU Setup - FreeBSD + +1. [Download the latest stable amd64-bootonly release ISO](https://www.freebsd.org/where.html). + E.g. FreeBSD-11.1-RELEASE-amd64-bootonly.iso +2. Create the disk image: `qemu-img create -f qcow2 FreeBSD-11.1-RELEASE-amd64.qcow2 2G` +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` +4. Run the installer, and install FreeBSD: + 1. Install + 1. Continue with default keymap + 1. Set Hostname: freebsd-ci + 1. Distribution Select: + 1. Uncheck lib32 + 1. Uncheck ports + 1. Network Configuration: vtnet0 + 1. Configure IPv4? Yes + 1. DHCP? Yes + 1. Configure IPv6? No + 1. Resolver Configuration: Ok + 1. Mirror Selection: Main Site + 1. Partitioning: Auto (UFS) + 1. Partition: Entire Disk + 1. Partition Scheme: MBR + 1. App Partition: Ok + 1. Partition Editor: Finish + 1. Confirmation: Commit + 1. Wait for sets to install + 1. Set the root password to nothing (press enter twice) + 1. Set time zone to UTC + 1. Set Date: Skip + 1. Set Time: Skip + 1. System Configuration: + 1. Disable sshd + 1. Disable dumpdev + 1. System Hardening + 1. Disable Sendmail service + 1. Add User Accounts: No + 1. Final Configuration: Exit + 1. Manual Configuration: Yes + 1. `echo 'console="comconsole"' >> /boot/loader.conf` + 1. `echo 'autoboot_delay="0"' >> /boot/loader.conf` + 1. `echo 'ext2fs_load="YES"' >> /boot/loader.conf` + 1. Look at `/etc/ttys`, see what getty argument is for `ttyu0` (E.g. `3wire`) + 1. Edit `/etc/gettytab` (with `vi` for example), look for `ttyu0` argument, + prepend `:al=root` to the line beneath to have the machine auto-login as + root. E.g. + + 3wire:\ + :np:nc:sp#0: + becomes: + + 3wire:\ + :al=root:np:nc:sp#0: + + 1. Edit `/root/.login` and put this in it: + + [ -e /dev/vtbd1 ] || exit 0 + mount -t ext2fs /dev/vtbd1 /mnt + sh /mnt/run.sh /mnt + poweroff + + 1. Exit the post install shell: `exit` + 1. Back in in the installer choose Reboot + 1. If all went well the machine should reboot and show a login prompt. + If you switch to the serial console by choosing View > serial0 in + the qemu menu, you should be logged in as root. + 1. Shutdown the machine: `shutdown -p now` Helpful links diff --git a/ci/docker/x86_64-unknown-freebsd/Dockerfile b/ci/docker/x86_64-unknown-freebsd/Dockerfile index 7ad3faff37..35f1036575 100644 --- a/ci/docker/x86_64-unknown-freebsd/Dockerfile +++ b/ci/docker/x86_64-unknown-freebsd/Dockerfile @@ -1,13 +1,13 @@ -FROM alexcrichton/port-prebuilt-freebsd:2017-09-16 +FROM wezm/port-prebuilt-freebsd11@sha256:43553e2265ec702ec72a63a765df333f50b1858b896e69385749e96d8624e9b0 RUN apt-get update RUN apt-get install -y --no-install-recommends \ - qemu genext2fs + qemu genext2fs xz-utils RUN apt-get install -y curl ca-certificates gcc ENTRYPOINT ["sh"] ENV PATH=$PATH:/rust/bin \ - QEMU=2016-11-06/freebsd.qcow2.gz \ + QEMU=2018-03-15/FreeBSD-11.1-RELEASE-amd64.qcow2.xz \ CAN_CROSS=1 \ - CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc + CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd11-gcc @@ -24,6 +24,13 @@ if [ "$QEMU" != "" ]; then curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \ gunzip -d > $tmpdir/$qemufile fi + elif [ -z "${QEMU#*.xz}" ]; then + # image is .xz : download and uncompress it + qemufile=$(echo ${QEMU%.xz} | sed 's/\//__/g') + if [ ! -f $tmpdir/$qemufile ]; then + curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \ + unxz > $tmpdir/$qemufile + fi else # plain qcow2 image: just download it qemufile=$(echo ${QEMU} | sed 's/\//__/g') diff --git a/libc-test/build.rs b/libc-test/build.rs index c2394c7555..a96bcfd414 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -509,6 +509,7 @@ fn main() { "CTL_MAXID" | "KERN_MAXID" | "HW_MAXID" | + "NET_MAXID" | "USER_MAXID" if freebsd => true, // These constants were added in FreeBSD 11 diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 34d34d89ec..e7a312741c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3,7 +3,7 @@ pub type clock_t = i32; pub type ino_t = u32; pub type lwpid_t = i32; pub type nlink_t = u16; -pub type blksize_t = u32; +pub type blksize_t = i32; pub type clockid_t = ::c_int; pub type sem_t = _sem; @@ -182,7 +182,9 @@ pub const EOWNERDEAD: ::c_int = 96; pub const ELAST: ::c_int = 96; pub const RLIMIT_NPTS: ::c_int = 11; pub const RLIMIT_SWAP: ::c_int = 12; -pub const RLIM_NLIMITS: ::rlim_t = 13; +pub const RLIMIT_KQUEUES: ::c_int = 13; +pub const RLIMIT_UMTXP: ::c_int = 14; +pub const RLIM_NLIMITS: ::rlim_t = 15; pub const Q_GETQUOTA: ::c_int = 0x700; pub const Q_SETQUOTA: ::c_int = 0x800; @@ -801,10 +803,10 @@ pub const SHUTDOWN_TIME: ::c_short = 8; pub const LC_COLLATE_MASK: ::c_int = (1 << 0); pub const LC_CTYPE_MASK: ::c_int = (1 << 1); -pub const LC_MESSAGES_MASK: ::c_int = (1 << 2); -pub const LC_MONETARY_MASK: ::c_int = (1 << 3); -pub const LC_NUMERIC_MASK: ::c_int = (1 << 4); -pub const LC_TIME_MASK: ::c_int = (1 << 5); +pub const LC_MONETARY_MASK: ::c_int =(1 << 2); +pub const LC_NUMERIC_MASK: ::c_int = (1 << 3); +pub const LC_TIME_MASK: ::c_int = (1 << 4); +pub const LC_MESSAGES_MASK: ::c_int = (1 << 5); pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK |