File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -128,11 +128,16 @@ fn main() {
128
128
// create a file with the `PHYSICAL_MEMORY_OFFSET` constant
129
129
let file_path = out_dir. join ( "physical_memory_offset.rs" ) ;
130
130
let mut file = File :: create ( file_path) . expect ( "failed to create physical_memory_offset.rs" ) ;
131
- let physical_memory_offset = match option_env ! ( "BOOTLOADER_PHYSICAL_MEMORY_OFFSET" ) {
132
- None => 0o_177777_770_000_000_000_0000u64 ,
133
- Some ( s ) => s . parse ( ) . expect (
134
- "The `BOOTLOADER_PHYSICAL_MEMORY_OFFSET` environment variable must be an integer." ,
131
+ let physical_memory_offset = match env :: var ( "BOOTLOADER_PHYSICAL_MEMORY_OFFSET" ) {
132
+ Err ( env :: VarError :: NotPresent ) => 0o_177777_770_000_000_000_0000u64 ,
133
+ Err ( env :: VarError :: NotUnicode ( _ ) ) => panic ! (
134
+ "The `BOOTLOADER_PHYSICAL_MEMORY_OFFSET` environment variable must be valid unicode"
135
135
) ,
136
+ Ok ( s) => s. parse ( ) . expect ( & format ! (
137
+ "The `BOOTLOADER_PHYSICAL_MEMORY_OFFSET` environment variable must be an\
138
+ integer (is `{}`).",
139
+ s
140
+ ) ) ,
136
141
} ;
137
142
file. write_all (
138
143
format ! (
@@ -151,6 +156,7 @@ fn main() {
151
156
) ;
152
157
153
158
println ! ( "cargo:rerun-if-env-changed=KERNEL" ) ;
159
+ println ! ( "cargo:rerun-if-env-changed=BOOTLOADER_PHYSICAL_MEMORY_OFFSET" ) ;
154
160
println ! ( "cargo:rerun-if-changed={}" , kernel. display( ) ) ;
155
161
println ! ( "cargo:rerun-if-changed=build.rs" ) ;
156
162
}
You can’t perform that action at this time.
0 commit comments