Sergey 'Jin' Bostandzhyan | 80a90ed | 2013-01-04 02:29:03 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 Sergey 'Jin' Bostandzhyan |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* This is a hack for Rockchip rk30xx based devices. The problem is that |
| 18 | * the MEMERASE ioctl is failing (hangs and never returns) in their kernel. |
| 19 | * The sources are not fully available, so fixing it in the rk30xxnand_ko driver |
| 20 | * is not possible. |
| 21 | * |
| 22 | * I straced the stock recovery application and it seems to avoid this |
| 23 | * particular ioctl, instead it is simply writing zeroes using the write() call. |
| 24 | * |
| 25 | * This workaround does the same and will replace all MEMERASE occurances in |
| 26 | * the recovery code. |
| 27 | */ |
| 28 | |
| 29 | #ifndef __RK30_HACK_H__ |
| 30 | #define __RK30_HACK_H__ |
| 31 | |
| 32 | #include <sys/types.h> // for size_t, etc. |
| 33 | |
| 34 | // write zeroes to fd at position pos |
| 35 | int zero_out(int fd, off_t pos, ssize_t length); |
| 36 | |
| 37 | #endif//__RK30_HACK_H__ |