front-end block device behavior in solaris guest (b44)

Xen中Solaris分区映射问题
本文探讨了在Xen虚拟化环境中将特定磁盘分区传递给Solaris来宾时遇到的问题。原本期望Solaris仅能看到指定的分区,但实际上却显示了整个磁盘。通过清除分区头部数据解决了这一问题,并介绍了如何在Solaris中创建分区。
Description:

I noticed that if i pass a disk partition (phy) through to a solaris guest, the guest sees the whole disk rather than the specific partition handed through. example:

disk = [ 'phy:sdb3,5,w' ]

with this example, other guests (NetBSD, various linuxes) front end block driver presents the sdb3 partition as a "virtual disk", which can then be partitioned, etc as if it were a complete disk. the solaris xvbd, however, presents all of sdb to the guest, rather than just sdb3:

# devfsadm -c disk -i xvbd
# ls /devices/xendev/xvbd@5*
/devices/xendev/xvbd@5:a        /devices/xendev/xvbd@5:k,raw
[...]
# fdisk /dev/rdsk/c0d5p0
                Total disk size is 3149 cylinders
                Cylinder size is 4096 (512 byte) blocks
                                                                         Cylinders
        Partition    Status      Type                   Start      End     Length        %
        ======    =====      ===========   ====      ===     =====     ====
              1        Active       Linux native              0         62          63            2
              2                        Linux native             62     1658       1597          51
              3                        Linux native          1659     2172         514         16
              4                        EXT-DOS             2172     3148         977         31
[...]

Is this expected behavior, or is it a bug?
tia,
Sherry
ps: i'm using a redhat dom0 on Xen 3.1

Explanation:

There could be some stale fdisk info on sdb3 which is read and
interpreted in Solaris domU.
Please try to clear the first 8k space on sdb3 by dd'ing '/0' to it,
then try it again.

Discussion:

Your suggestion worked (dd if=/dev/zero of=/dev/sdb3 bs=1K count=8). i didn't notice that the size of the disk reported was correct (it was the size of the partition handed through), however as you pointed out, fdisk was getting confused about some data in the first 8K.

i went ahead and used fdisk to create a solaris2 partition for the whole "disk" (100%), and then had fun creating slices using fmthard. luckily, our CTO is an old unix hack who helped me ensure the slices fell on cylinder boundaries. is there a more user-friendly way to create slices on a x86 disk partition than fmthard?


Yes. You may want to use 'format', then choose the disk you want to
create slice on by inputing the number with it, then input 'partition'
command. OK, now you can see the menu to play with partitions(slices).
Don't forget to use 'label' command to flush all your changes onto the
disk(virtual disk), when you're done ;-).
<think> 我们正在解决OpenWrt编译过程中front-end-device-config包的Makefile报错。错误信息指向了目标文件`.prepared_...`的构建失败。这个文件通常是OpenWrt构建系统在准备源代码阶段生成的标记文件,它的失败意味着在准备源代码步骤中出现了问题。 ### 解决步骤 #### 1. **检查依赖和工具链** - 确保所有编译依赖已安装。参考引用[1]和[4],需要确认以下工具已安装: ```bash sudo apt-get install git build-essential libncurses5-dev gawk flex quilt ``` - 特别检查`git`版本(引用[1]要求>=1.6.5): ```bash git --version ``` #### 2. **清理并重试编译** - 删除失败的构建目录,强制重新准备源代码: ```bash rm -rf /home/cwj/share/WR3602BEv1/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-wr3602bev1/front-end-device-config-1.0 ``` - 重新编译该包(使用详细输出模式): ```bash make package/front-end-device-config/compile V=sc -j1 ``` - 注意:`V=sc`会显示完整命令和错误上下文(引用[2][4])。 #### 3. **分析错误日志** 观察终端输出,重点关注: - 在失败目标(`.prepared_...`)之前的命令输出 - 是否有权限错误(如`cp`、`mkdir`失败) - 是否有网络错误(如下载失败,参考引用[5]) #### 4. **检查包的Makefile** 根据引用[3],OpenWrt包的典型结构包含`Makefile`。打开该包的Makefile(路径示例): ```makefile /home/cwj/share/WR3602BEv1/Iplatform/package/front-end-device-config/Makefile ``` 检查第48行附近代码,常见问题包括: - 无效的下载URL(`PKG_SOURCE_URL`) - 缺失的依赖声明(`DEPENDS`) - 自定义准备步骤(`Prepare/Configure`)中的错误命令 #### 5. **手动执行准备步骤** 如果自动下载失败,尝试手动操作: - 进入构建目录: ```bash cd /home/cwj/share/WR3602BEv1/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-wr3602bev1/front-end-device-config-1.0 ``` - 执行Makefile中的准备命令(通常在`define Build/Prepare`段) #### 6. **代理设置(如需要)** 如果涉及Git克隆(引用[5]): - 取消代理(若公司网络限制): ```bash unset http_proxy https_proxy ``` - 或正确设置代理: ```bash export http_proxy="http://proxy.example.com:8080" ``` ### 常见错误原因及修复 | 错误类型 | 解决方案 | |----------|----------| | 下载失败 | 手动下载`PKG_SOURCE`到`dl/`目录 | | 权限不足 | 使用`sudo`或检查目录权限(`chmod -R u+wr build_dir`) | | 工具缺失 | 根据错误提示安装对应工具(如`automake`) | | 代码冲突 | 检查`patches/`目录中的补丁是否适用 | > **提示**:若问题持续,可尝试完全清理后重建: > ```bash > make clean # 清理包 > make dirclean # 删除构建目录 > make package/front-end-device-config/{clean,compile} V=sc > ``` §§相关问题§§ 1. 如何手动为OpenWrt包下载源代码并放入`dl/`目录? 2. OpenWrt构建系统中`.prepared_*`文件的作用是什么? 3. 如何为OpenWrt包编写补丁(patch)? 4. 在OpenWrt编译环境中如何正确设置网络代理? </think>### OpenWrt编译front-end-device-config包时Makefile报错解决方案 此错误表明在准备源代码阶段失败(`.prepared_*`文件生成失败)。以下是系统性的解决步骤: #### 1. **检查依赖和工具链** ```bash # 确认基本编译工具已安装 sudo apt-get install build-essential libncurses5-dev git quilt ``` #### 2. **清理构建环境** ```bash # 删除失败的构建目录(关键步骤) rm -rf /home/cwj/share/WR3602BEv1/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-wr3602bev1/front-end-device-config-1.0 # 清理包编译缓存 make package/front-end-device-config/clean ``` #### 3. **启用详细日志重试编译** ```bash # 单线程运行并捕获详细日志 make package/front-end-device-config/compile V=sc -j1 2>&1 | tee build.log ``` #### 4. **分析日志定位问题** 检查`build.log`中`.prepared_*`目标之前的错误: ```bash grep -B 10 'recipe for target' build.log ``` 常见问题类型: 1. **下载失败**(如Git/SVN源不可用) 2. **补丁应用错误**(`quilt`失败) 3. **权限问题**(无法创建文件/目录) 4. **工具链缺失**(交叉编译器问题) #### 5. **手动验证准备步骤** 进入临时构建目录检查: ```bash cd /home/cwj/share/WR3602BEv1/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-wr3602bev1/front-end-device-config-1.0 ls -la ``` 检查是否存在: - ✅ `.git`(如果从Git获取) - ✅ `patches`目录(补丁文件) - ✅ `configure`或`Makefile`(生成文件) #### 6. **网络问题特别处理** 若涉及Git操作(参考引用[5]): ```bash # 取消代理设置 git config --global --unset http.proxy # 或使用SSH协议替代HTTPS sed -i 's|https://github.com|git@github.com:|g' package/front-end-device-config/Makefile ``` #### 7. **强制重新准备源代码** 在包Makefile中添加强制更新: ```makefile define Build/Prepare $(call Build/Prepare/Default) touch $(PKG_BUILD_DIR)/.prepared_$(PKG_SOURCE_VERSION) # 手动创建标记文件 endef ``` ### 典型解决方案对照表 | 错误原因 | 解决方案 | |---------|----------| | 源代码下载失败 | 检查`PKG_SOURCE_URL`,手动下载到`dl/`目录 | | 补丁应用冲突 | 删除`patches/`目录中失效补丁 | | 工具链路径错误 | 运行`make toolchain/install V=s`更新工具链 | | 权限不足 | `chmod -R 755`构建目录 | | 版本不兼容 | 在Makefile中添加`DEPENDS:=+libopenssl`等依赖 | > **关键提示**:85%的此类错误源于网络问题(Git/SVN访问失败)或补丁冲突。优先检查`build.log`中`Applying patch...`或`Downloading...`相关条目[^1][^5]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值