Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some changes to kopernicus's refactoring + fix some things (CONTRIBUTING.md & README.md) #380

Merged
merged 9 commits into from
Dec 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 63 additions & 82 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,166 +1,147 @@
# Contributing
# Contributing to Redox

Thank you for your interest in contributing to Redox! This document is a guide to help newcomers contribute!
There are many ways to help us out and we appreciate all of them.

### Index

* [Communication](#communication)
* [Slack Chat](#slack)
* [Reddit](#reddit)
* [How to contribute?](#how-to-contribute)
* [Low-Hanging Fruit - Easy Targets for Newbies](#easy-targets)
* [GitHub Issues](#gh-issues)
* [Pull Requests](#prs)
* [Creating a Pull Request](#creating-a-pr)
* [Slack Chat](#slack)
* [Reddit](#reddit)
* [Direct Contributing](#direct-contributing)
* [Low-Hanging Fruit - Easy Targets for Newbies](#easy-targets)
* [GitHub Issues](#gh-issues)
* [Pull Requests](#prs)
* [Creating a Pull Request](#creating-a-pr)
* [Best Practices/Guidelines](#best-practices)
* [General](#general)
* [Kernel](#kernel)
* [Testing pratices](#testing-practices)
* [Style guidelines](#style-guidelines)
* [Rust](#rust-style-guidelines)
* [Git](#git-style-guidelines)
* [General](#general)
* [Kernel](#kernel)
* [Testing Practices](#testing-practices)
* [Style Guidelines](#style-guidelines)
* [Rust](#rust-style-guidelines)
* [Git](#git-style-guidelines)
* [Interactions with other projects](#interactions-with-other-projects)
* [Applications vs Kernel](#applications-vs-kernel)

### External links
### <a name="extern-links" /> Other External Links

* [redox-os.org](http://redox-os.org)
* [rust-os-comparison](https://github.com/jackpot51/rust-os-comparison)
* [rust-lang.org](http://rust-lang.org)

<!-- TODO add more links here -->

<a name="communication" />
## Communication
## <a name="communication" /> Communication

<a name="slack" />
### Slack Chat
### <a name="slack" /> Slack Chat

The quickest and most open way to communicate with the Redox team is with [Slack](https://slack.com/). Currently, the only way to join our slack team is by sending an email to [[email protected]](mailto:[email protected]), which might take a little while, since it's not automated. We're currently working on an easier way to do this, but this is the most convenient way right now.

<a name="reddit" />
### Reddit
### <a name="reddit" /> Reddit

Don't forget to talk about the RedoxOS in [Reddit](https://www.reddit.com/r/rust/), especially when the new RedoxOS weekly news has been edited!
You can find Redox on Reddit in [/r/rust/](https://www.reddit.com/r/rust/) and [/r/redox/](https://www.reddit.com/r/redox/). The weekly update news is posted on the former.

<a name="how-to-contribute" />
## How to contribute ?
## <a name="direct-contributing" /> Direct Contributing

<a name="easy-targets" />
### Low-Hanging Fruit - Easy Targets for Newbies
### <a name="easy-targets" /> Low-Hanging Fruit - Easy Targets for Newbies

<!-- TODO improve this section -->

* If you're not fluent in [Rust](https://www.rust-lang.org/):
* Writing documentation
* Using/testing Redox, filing issues for bugs and needed features
* Web development (Redox website, separate repo)
* Unit tests (may require minimal knowledge of rust)
* If you're not fluent in Rust:

* Writing documentation
* Using/testing Redox, filing issues for bugs and needed features
* Web development (Redox website, separate repo)
* Writing unit tests (may require minimal knowledge of rust)

* If you are fluent in Rust, but not OS Development:
* Apps
* Shell (Ion) development
* Package manager (Oxide) development
* High-level code

* Apps development
* Shell ((Ion)[https://github.com/redox-os/ion]) development
* Package manager ((Oxide)[https://github.com/redox-os/oxide]) development
* Other high-level code tasks

* If you are fluent in Rust, and have experience with OS Dev:
* Familiarize yourself with the repository and codebase
* Find tags in comments like `TODO`, `FIXME` etc. and complete those tasks

<a name="gh-issues" />
### GitHub Issues
* Familiarize yourself with the repository and codebase
* Find tags in comments like `TODO`, `FIXME` etc. and complete those tasks
* Improve and optimize code, especially in the kernel

### <a name="gh-issues" /> GitHub Issues

A bit more formal way of communication with fellow Redox devs, but a little less quick and convienent like the Slack chat (unless of course you aren't in it yet, which if you're going to be involved in this project really at all, it is recommended that you request to join). These are for more specific topics, simply put, issues try to state something more than ask.
A bit more formal way of communication with fellow Redox devs, but a little less quick and convienent like the Slack chat (unless of course you aren't in it yet, which if you're going to be involved in this project really at all, it is recommended that you request to join). These are for more specific topics.

<a name="prs" />
### Pull Requests
### <a name="prs" /> Pull Requests

It's completely fine to just submit a small pull request without first making an issue or something, but if it's a big change that will require a lot of planning and reviewing, it's best you start with writing an issue first.
It's completely fine to just submit a small pull request without first making an issue or something, but if it's a big change that will require a lot of planning and reviewing, it's best you start with writing an issue first. Also see (git guidelines)[#git-style-guidelines]

<a name="creating-a-pr" />
### Creating a Pull Request

1. Fork the repository
2. Clone the original repository to your local PC using one of the following commands based on the protocol you are using:
* HTTPS:`git clone https://github.com/redox-os/redox.git`
* SSH:`git clone [email protected]:redox-os/redox.git --origin upstream --recursive`
* Then rebase: `git rebase upstream master`
Use HTTPS if you don't know which one to use. (Recommended: learn about SSH if you don't want to have to login every time you push/pull!)
* HTTPS:`git clone https://github.com/redox-os/redox.git`
* SSH:`git clone [email protected]:redox-os/redox.git --origin upstream --recursive`
* Then rebase: `git rebase upstream master`
Use HTTPS if you don't know which one to use. (Recommended: learn about SSH if you don't want to have to login every time you push/pull!)
3. Add your fork with
* HTTPS:`git remote add origin https://github.com/your-username/redox.git`
* SSH:`git remote add origin [email protected]:your-username/redox.git --origin upstream --recursive`
* HTTPS:`git remote add origin https://github.com/your-username/redox.git`
* SSH:`git remote add origin [email protected]:your-username/redox.git --origin upstream --recursive`
4. Alternatively, if you already have a fork and copy of the repo, you can simply check to make sure you're up-to-date
* Fetch the upstream:`git fetch upstream master`
* Rebase with local commits:`git rebase upstream master`
* Update the submodules:`git submodule update --init`
* Fetch the upstream:`git fetch upstream master`
* Rebase with local commits:`git rebase upstream master`
* Update the submodules:`git submodule update --init`
5. Optionally create a separate branch (recommended if you're making multiple changes simultaneously) (`git checkout -b my-branch`)
6. Make changes
7. Commit (`git add . --all; git commit -m "my commit"`)
8. Optionally run `rustfmt` on the files you changed and commit again if it did anything.
8. Optionally run (rustfmt)[https://github.com/rust-lang-nursery/rustfmt] on the files you changed and commit again if it did anything (check with `git diff` first)
9. Test your changes with `make qemu` or `make virtualbox` (you might have to use `make qemu_no_kvm`) (see [Best Practices and Guidelines])
10. Pull from upstream (`git fetch upstream; git rebase upstream/master`) (Note: try not to use `git pull`, it is equivalent to doing `git fetch upstream; git merge master upstream/master`, which is not usually preferred for local/fork repositories, although it is fine in some cases.)
11. Repeat step 9 to make sure the rebase still works
11. Repeat step 9 to make sure the rebase still builds and starts
12. Push to your fork (`git push origin my-branch`)
13. Create a pull request
14. Describe your changes
15. Submit!

<a name="best-practices" />
## Best Practices and Guidelines
## <a name="best-practices" /> Best Practices and Guidelines

<!-- TODO add this section to the index/TOC -->

<a name="general" />
### General
### <a name="general" /> General

* Follow the style conventions
* Use `.into()` and `.to_owned()` over `.to_string()`.
* Prefer passing references to the data over owned data. (Don't take `String`, take `&str`. Don't take `Vec<T>` take `&[T]`).
* Use generics, traits, and other abstractions Rust provides.
* Be sure to mark parts that need work with `TODO`, `FIXME`, `BUG`, and `UNOPTIMIZED`.
* Don't forget to look after news in [Reddit](https://www.reddit.com/r/rust/).
* Check (Slack)[#slack], (the Website)[#], and **the Subreddit** frequently.

<a name="kernel" />
### Kernel
### <a name="kernel" /> Kernel

* When trying to access a slice, **always** use the `common::GetSlice` trait and the `.get_slice()` method to get a slice without causing the kernel to panic.
The problem with slicing in regular Rust, e.g. `foo[a..b]`, is that if someone tries to access with a range that is out of bounds of an array/string/slice, it will cause a panic at runtime, as a safety measure. Same thing when accessing an element.
Always use `foo.get(n)` instead of `foo[n]` and try to cover for the possibility of `Option::None`. Doing the regular way may work fine for applications, but never in the kernel. No possible panics should ever exist in kernel space, because then the whole OS would just stop working.

<a name="testing-practices" />
### Testing Practices
### <a name="testing-practices" /> Testing Practices

* It's always better to test boot (`make qemu` or `make virtualbox`) every time you make a change, because it is important to see how the OS boots and works after it compiles.
Even though Rust is a safety-oriented language, something as unstable as an in-dev operating system will have problems in many cases and may completely break on even the slightest critical change.
Also, make sure you check how the unmodified version runs on your machine before making any changes. Else, you won't have anything to compare to, and it will generally just lead to confusion. TLDR: Rebuild and test boot often.

* To run the ZFS tests:
* Create the zfs.img only once. If one has not been created, run `make filesystem/apps/zfs/zfs.img` before booting into Redox.
* Run `open zfs.img` to open the created ZFS image.
* Run `file /home/LICENSE.md` twice to ensure ARC isn't broken.
* Create the zfs.img only once. If one has not been created, run `make filesystem/apps/zfs/zfs.img` before booting into Redox.
* Run `open zfs.img` to open the created ZFS image.
* Run `file /home/LICENSE.md` twice to ensure ARC isn't broken.

<a name="style-guidelines" />
## Style Guidelines

<!-- TODO improve this section -->

<a name="rust-style-guidelines" />
### Rust

Since Rust is a relatively small and new language compared to others like C, there's really only one standard. Just follow the official Rust standards for formatting, and maybe run `rustfmt` on your changes, until we setup the CI system to do it automatically.

<a name="git-style-guidelines" />
### Git
### <a name="git-style-guidelines" /> Git

* Commit messages should describe their changes in present-tense, e.g. "`Add stuff to file.ext`" instead of "`added stuff to file.ext`". This logically makes more sense because, say you're scrolling through history, and you see a commit named "`create file X`". You immediately know that this is what this commit will do to your working directory. It also generally is just more consistent and conventional.
* Try to remove duplicate commits from PRs as these clutter up history.

<a name="interactions-with-other-projects" />
## Interactions with Other Projects

<!-- TODO fill out this section -->

<a name="applications-vs-kernel" />
## Applications vs Kernel

<!-- TODO fill out this section -->
* Generally, when syncing your local copy with the master branch, you will want to rebase instead of merge. This is because it will create duplicate commits that don't actually do anything when merged into the master branch.
* When you start to make changes, you will want to create a separate branch, and keep the `master` branch of your fork identical to the main repository, so that you can compare your changes with the main branch and test out a more stable build if you need to.
60 changes: 25 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img alt="Redox" height="190" src="img/logo.png">
<img alt="Redox" height="150" src="img/logo.png">

**Redox** is a operating system written in pure Rust, designed to be modular and secure. The development blog can be found at http://www.redox-os.org.

Expand All @@ -11,56 +11,46 @@ Please make sure you use the **latest nightly** of `rustc` before building (for

## Contents

* [What it looks like](#what_it_looks_like)
* [HELP! Redox won't compile](#compile-help)
* [What it looks like](#what-it-looks-like)
* [Help! Redox won't compile](#compile-help)
* [Contributing to Redox](#contributing)
* [Cloning the repository](#cloning)
* [Installation](#installation)
* [Building and running](#bulding_running)
* [Debian and Ubuntu family](#debian_ubuntu)
* [Archlinux](#archlinux)
* [Building and running](#bulding-running)
* [Debian and Ubuntu family](#debian-ubuntu)
* [Archlinux](#arch-linux)
* [Fedora](#fedora)
* [Suse](#suse)
* [NixOS](#nixos)
* [OS X](#osx)
* [Windows](#windows)


## <a name="what_it_looks_like"></a>What it looks like
## <a name="what-it-looks-like" />What it looks like

<img alt="Redox" height="170" src="img/screenshots/Desktop.png">
<img alt="Redox" height="170" src="img/screenshots/Fancy_opacity.png">
<img alt="Redox" height="170" src="img/screenshots/File_manager.png">
<img alt="Redox" height="170" src="img/screenshots/Sodium_v1.png">
<img alt="Redox" height="170" src="img/screenshots/Boot.png">
<img alt="Redox" height="170" src="img/screenshots/start.png">
<img alt="Redox" height="150" src="img/screenshots/Desktop.png">
<img alt="Redox" height="150" src="img/screenshots/Fancy_opacity.png">
<img alt="Redox" height="150" src="img/screenshots/File_manager.png">
<img alt="Redox" height="150" src="img/screenshots/Sodium_v1.png">
<img alt="Redox" height="150" src="img/screenshots/Boot.png">
<img alt="Redox" height="150" src="img/screenshots/start.png">

## <a name="compile_help"></a>Help! Redox won't compile!
## <a name="compile-help" />Help! Redox won't compile!

Sometimes things go wrong when compiling. Try the following before opening an issue:

1. Run `make clean`.
2. Run `git clean -X -f -d`.
3. Make sure you have **the latest version of Rust nightly!** (`multirust` is recommended for managing Rust versions).
3. Make sure you have **the latest version of Rust nightly!** ([multirust](https://github.com/brson/multirust) is recommended for managing Rust versions).
4. Update **LLVM**, **GNU Make**, **nasm** and **QEMU/VirtualBox**.
5. Pull the upstream master branch (`git remote add upstream [email protected]:redox-os/redox.git; git pull upstream master`).

and then rebuild!

When you have completed these steps, done a full rebuild, you can open an issue. **Make sure you answer the following questions**:

- Have you followed the steps in "Help! Redox won't compile!"? (confirmation)
- What host OS are you building Redox on?
- What is the output of `rustc -V`?
- Have you made any changes?
- Is it a build problem or a launch problem? On some systems, VirtualBox/QEMU may have problems. Try `make virtualbox`, `make qemu`, and `make qemu_no_kvm`.

Else, your issue may be closed.

## <a name="contributing"></a>Contributing to Redox
## <a name="contributing" />Contributing to Redox
If you're interested in this project, and you'd like to help us out, [here](CONTRIBUTING.md) is a list of ways you can do just that.

## <a name="cloning"></a>Cloning the repository
## <a name="cloning" />Cloning the Repository

Make sure you get submodules when you clone the repository.
```bash
Expand All @@ -73,11 +63,11 @@ can download them with:
git submodule update --init
```

## <a name="installation"></a>Installation
## <a name="installation" />Installation

### <a name="building_running"></a>Building and running
### <a name="building-running" />Building and running

#### <a name="debian_ubuntu"></a>Debian/Ubuntu family
#### <a name="debian_ubuntu" />Debian/Ubuntu family

##### Building

Expand Down Expand Up @@ -113,7 +103,7 @@ sudo apt-get install qemu-system-x86 qemu-kvm
make qemu
```

#### <a name="archlinux"></a>Archlinux
#### <a name="arch-linux"></a>Arch Linux

##### Building
* Run the setup script and enter your password when prompted (to install the Rust compiler and its dependencies)
Expand Down Expand Up @@ -172,7 +162,7 @@ sudo yum install qemu-system-x86 qemu-kvm
make qemu
```

#### <a name="suse"></a>Suse
#### <a name="suse" />SUSE

##### Building

Expand All @@ -198,7 +188,7 @@ sudo zypper install qemu-x86 qemu-kvm
make qemu
```

#### <a name="nixos"></a>NixOS
#### <a name="nixos" />NixOS

##### Building and running (Qemu, Advanced)

Expand All @@ -208,7 +198,7 @@ make all
make qemu
```

#### <a name="osx"></a>OS X
#### <a name="osx" />OS X

##### Building

Expand All @@ -235,7 +225,7 @@ make all
make virtualbox
```

#### <a name="windows"></a>Windows
#### <a name="windows" />Windows

##### Building
* Download and install the latest 32-bit Rust nightly from http://www.rust-lang.org/install.html
Expand Down